Package org.dmtf.schemas.ovf.envelope._1

Examples of org.dmtf.schemas.ovf.envelope._1.ContentType


        // all the disk files should be marked with "snapshot + OVF_BUNDLE_PATH_IDENTIFIER" + hRef
        // (packagePath relative)
        for (String diskFileId : diskFileIds)
        {
            FileType file;
            try
            {
                file = OVFReferenceUtils.getReferencedFile(envelope, diskFileId);
            }
            catch (IdNotFoundException e)
            {
                throw new AMException(AMError.TEMPLATE_BOUNDLE, String.format(
                    "The bundle [%s] can not be created because the "
                        + "referenced file Id [%s] is not found on the Envelope", snapshot,
                    diskFileId), e);
            }

            // TODO check hRef is 'packagePath' relative
            final String relativeBundleFileRef = snapshot + file.getHref();
            final String absoluteBundleFileRef = packagePath + relativeBundleFileRef;

            File bundleFile = new File(absoluteBundleFileRef);
            Long bundleFileSize;

            if (!bundleFile.exists() || bundleFile.isDirectory())
            {

                throw new AMException(AMError.TEMPLATE_BOUNDLE, String.format(
                    "The bundle [%s] can not be created because the "
                        + "referenced file on [%s] is not found", snapshot, absoluteBundleFileRef));
            }
            else
            {
                // actually exist
                bundleFileSize = bundleFile.length(); // Bytes

                file.setSize(BigInteger.valueOf(bundleFileSize));
                file.setHref(relativeBundleFileRef);
            }

            for (VirtualDiskDescType vDiskDesc : disks)
            {
                if (diskFileId.equalsIgnoreCase(vDiskDesc.getFileRef()))
View Full Code Here


        // all the disk files should be marked with "snapshot + OVF_BUNDLE_PATH_IDENTIFIER" + hRef
        // (packagePath relative)
        for (String diskFileId : diskFileIds)
        {
            FileType file;
            try
            {
                file = OVFReferenceUtils.getReferencedFile(envelope, diskFileId);
            }
            catch (IdNotFoundException e)
            {
                throw new AMException(AMError.PROMOTE_MASTER_OVF, String.format(
                    "The promote [%s] can not be created because the "
                        + "referenced file Id [%s] is not found on the Envelope", relativeDiskPath,
                    diskFileId), e);
            }

            file.setSize(diskSizeInBytes);
            file.setHref(relativeDiskPath);
        }

        return envelope;
    }
View Full Code Here

                {
                    String msg = "File Id [" + fileId + "] not found on the ReferencesSection";
                    throw new IdNotFoundException(msg);
                }

                FileType file = fileIdToFileType.get(fileId);
                final String filePath = file.getHref();
                final Long fileSize = file.getSize().longValue();

                String format = diskDescType.getFormat(); // XXX using the same format on the OVF
                // disk

                if (!diskIdToVSs.containsKey(diskId))
View Full Code Here

        // final String completPath = packRelPath +'/'+diskPath;
        // System.err.println(packRelPath);

        try
        {
            FileType fileRef =
                OVFReferenceUtils.createFileType("diskFile", diskPath,
                    BigInteger.valueOf(diskSize), null, null);
            OVFReferenceUtils.addFile(references, fileRef);

            DiskSectionType diskSection = createDiskSection(template);
View Full Code Here

        // all the disk files should be marked with "snapshot + OVF_BUNDLE_PATH_IDENTIFIER" + hRef
        // (packagePath relative)
        for (String diskFileId : diskFileIds)
        {
            FileType file;
            try
            {
                file = OVFReferenceUtils.getReferencedFile(envelope, diskFileId);
            }
            catch (IdNotFoundException e)
            {
                throw new AMException(AMError.TEMPLATE_BOUNDLE, String.format(
                    "The bundle [%s] can not be created because the "
                        + "referenced file Id [%s] is not found on the Envelope", snapshot,
                    diskFileId), e);
            }

            // TODO check hRef is 'packagePath' relative
            final String relativeBundleFileRef = snapshot + file.getHref();
            final String absoluteBundleFileRef = packagePath + relativeBundleFileRef;

            File bundleFile = new File(absoluteBundleFileRef);
            Long bundleFileSize;

            if (!bundleFile.exists() || bundleFile.isDirectory())
            {

                throw new AMException(AMError.TEMPLATE_BOUNDLE, String.format(
                    "The bundle [%s] can not be created because the "
                        + "referenced file on [%s] is not found", snapshot, absoluteBundleFileRef));
            }
            else
            {
                // actually exist
                bundleFileSize = bundleFile.length(); // Bytes

                file.setSize(BigInteger.valueOf(bundleFileSize));
                file.setHref(relativeBundleFileRef);
            }

            for (VirtualDiskDescType vDiskDesc : disks)
            {
                if (diskFileId.equalsIgnoreCase(vDiskDesc.getFileRef()))
View Full Code Here

        // all the disk files should be marked with "snapshot + OVF_BUNDLE_PATH_IDENTIFIER" + hRef
        // (packagePath relative)
        for (String diskFileId : diskFileIds)
        {
            FileType file;
            try
            {
                file = OVFReferenceUtils.getReferencedFile(envelope, diskFileId);
            }
            catch (IdNotFoundException e)
            {
                throw new AMException(AMError.PROMOTE_MASTER_OVF, String.format(
                    "The promote [%s] can not be created because the "
                        + "referenced file Id [%s] is not found on the Envelope", relativeDiskPath,
                    diskFileId), e);
            }

            file.setSize(diskSizeInBytes);
            file.setHref(relativeDiskPath);
        }

        return envelope;
    }
View Full Code Here

            String vsystemName =
                vsystem.getName() != null && !StringUtils.isEmpty(vsystem.getName().getValue())
                    ? vsystem.getName().getValue() : vsystem.getId();

            MsgType prod = new MsgType();
            prod.setValue(vsystemName);

            ProductSectionType product = new ProductSectionType();
            product.setInfo(vsystem.getInfo());
            product.setProduct(prod);
View Full Code Here

            String vsystemName =
                vsystem.getName() != null && vsystem.getName().getValue() != null ? vsystem
                    .getName().getValue() : vsystem.getId();

            MsgType prod = new MsgType();
            prod.setValue(vsystemName);

            ProductSectionType product = new ProductSectionType();
            product.setInfo(vsystem.getInfo());
            product.setProduct(prod);
View Full Code Here

        {
            ContentType contentType = OVFEnvelopeUtils.getTopLevelVirtualSystemContent(envelope);

            ProductSectionType product =
                OVFEnvelopeUtils.getSection(contentType, ProductSectionType.class);
            OperatingSystemSectionType ossection = null;
            try
            {
                ossection =
                    OVFEnvelopeUtils.getSection(contentType, OperatingSystemSectionType.class);
            }
View Full Code Here

            OVFReferenceUtils.addFile(references, fileRef);

            DiskSectionType diskSection = createDiskSection(template);
            VirtualSystemType vsystem = createVirtualSystem(template);
            ProductSectionType product = createProductSection(template);
            OperatingSystemSectionType ossection = createOperatingSystemSection(template);

            OVFEnvelopeUtils.addSection(vsystem, product);           
            OVFEnvelopeUtils.addSection(vsystem, ossection);
            OVFEnvelopeUtils.addSection(envelope, diskSection);
            OVFEnvelopeUtils.addVirtualSystem(envelope, vsystem);
View Full Code Here

TOP

Related Classes of org.dmtf.schemas.ovf.envelope._1.ContentType

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.