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

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


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

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

            OVFEnvelopeUtils.addSection(vsystem, product);           
View Full Code Here


        // TODO getHDUnits
        VirtualDiskDescType diskDesc =
            OVFDiskUtils.createDiskDescription("ovfdisk", "diskFile", format, diskSize, null, null,
                null);

        DiskSectionType diskSection = new DiskSectionType();
        OVFDiskUtils.addDisk(diskSection, diskDesc);

        return diskSection;
    }
View Full Code Here

    public static EnvelopeType fixFilePathsAndSize(final EnvelopeType envelope,
        final String snapshot, final String packagePath)
    {
        Set<String> diskFileIds = new HashSet<String>();

        DiskSectionType diskSection;

        try
        {

            diskSection = OVFEnvelopeUtils.getSection(envelope, DiskSectionType.class);
        }
        catch (Exception e)
        {
            throw new AMException(AMError.TEMPLATE_BOUNDLE, String.format(
                "The bundle [%s] can not be created "
                    + "because the original envelope do not exist or do not have Disk Section",
                snapshot), e);
        }

        List<VirtualDiskDescType> disks = diskSection.getDisk();

        if (disks.isEmpty())
        {

            throw new AMException(AMError.TEMPLATE_BOUNDLE, String.format(
View Full Code Here

    public static EnvelopeType fixFilePathsAndSize(final EnvelopeType envelope,
        final String relativeDiskPath, final BigInteger diskSizeInBytes)
    {
        Set<String> diskFileIds = new HashSet<String>();

        DiskSectionType diskSection;

        try
        {

            diskSection = OVFEnvelopeUtils.getSection(envelope, DiskSectionType.class);
        }
        catch (Exception e)
        {
            throw new AMException(AMError.PROMOTE_MASTER_OVF, String.format(
                "The promote [%s] can not be created "
                    + "because the original envelope do not exist or do not have Disk Section",
                relativeDiskPath), e);
        }

        List<VirtualDiskDescType> disks = diskSection.getDisk();

        if (disks.isEmpty())
        {

            throw new AMException(AMError.PROMOTE_MASTER_OVF, String.format(
View Full Code Here

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

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

            OVFEnvelopeUtils.addSection(vsystem, product);
View Full Code Here

        VirtualDiskDescType diskDesc =
            OVFDiskUtils.createDiskDescription("ovfdisk", "diskFile", format, diskSize,
                DiskSizeUnit.MegaBytes, null, null);

        DiskSectionType diskSection = new DiskSectionType();
        OVFDiskUtils.addDisk(diskSection, diskDesc);

        return diskSection;
    }
View Full Code Here

    public static EnvelopeType fixFilePathsAndSize(final EnvelopeType envelope,
        final String snapshot, final String packagePath)
    {
        Set<String> diskFileIds = new HashSet<String>();

        DiskSectionType diskSection;

        try
        {

            diskSection = OVFEnvelopeUtils.getSection(envelope, DiskSectionType.class);
        }
        catch (Exception e)
        {
            throw new AMException(AMError.TEMPLATE_BOUNDLE, String.format(
                "The bundle [%s] can not be created "
                    + "because the original envelope do not exist or do not have Disk Section",
                snapshot), e);
        }

        List<VirtualDiskDescType> disks = diskSection.getDisk();

        if (disks.isEmpty())
        {

            throw new AMException(AMError.TEMPLATE_BOUNDLE, String.format(
View Full Code Here

    public static EnvelopeType fixFilePathsAndSize(final EnvelopeType envelope,
        final String relativeDiskPath, final BigInteger diskSizeInBytes)
    {
        Set<String> diskFileIds = new HashSet<String>();

        DiskSectionType diskSection;

        try
        {

            diskSection = OVFEnvelopeUtils.getSection(envelope, DiskSectionType.class);
        }
        catch (Exception e)
        {
            throw new AMException(AMError.PROMOTE_MASTER_OVF, String.format(
                "The promote [%s] can not be created "
                    + "because the original envelope do not exist or do not have Disk Section",
                relativeDiskPath), e);
        }

        List<VirtualDiskDescType> disks = diskSection.getDisk();

        if (disks.isEmpty())
        {

            throw new AMException(AMError.PROMOTE_MASTER_OVF, String.format(
View Full Code Here

        Map<String, VirtualDiskDescType> diskIdToDiskFormat =
            new HashMap<String, VirtualDiskDescType>();
        Map<String, FileType> fileIdToFileType = new HashMap<String, FileType>();
        Map<String, List<String>> diskIdToVSs = new HashMap<String, List<String>>();
        Map<String, TemplateDto> requiredByVSs = new HashMap<String, TemplateDto>();
        DiskSectionType diskSectionType;

        try
        {
            ContentType contentType = OVFEnvelopeUtils.getTopLevelVirtualSystemContent(envelope);

            ProductSectionType product =
                OVFEnvelopeUtils.getSection(contentType, ProductSectionType.class);
            OperatingSystemSectionType ossection = null;
            try
            {
                ossection =
                    OVFEnvelopeUtils.getSection(contentType, OperatingSystemSectionType.class);
            }
            catch (Exception e) // no such section
            {
            }

            String description = null;
            if (product.getInfo() != null && product.getInfo().getValue() != null)
            {
                description = product.getInfo().getValue();
            }

            String categoryName = null;
            if (product.getOtherAttributes().containsKey(new QName("CategoryName")))
            {
                categoryName = product.getOtherAttributes().get(new QName("CategoryName"));
            }

            String iconPath = getIconPath(product, fileIdToFileType, ovfId);

            diskSectionType = OVFEnvelopeUtils.getSection(envelope, DiskSectionType.class);

            for (FileType fileType : envelope.getReferences().getFile())
            {
                fileIdToFileType.put(fileType.getId(), fileType);
            }
            // Create a hash
            for (VirtualDiskDescType virtualDiskDescType : diskSectionType.getDisk())
            {
                diskIdToDiskFormat.put(virtualDiskDescType.getDiskId(), virtualDiskDescType);
            }

            if (contentType instanceof VirtualSystemType)
View Full Code Here

        {
            Map<String, VirtualDiskDescType> diskIdToDiskFormat =
                new HashMap<String, VirtualDiskDescType>();
            Map<String, FileType> fileIdToFileType = new HashMap<String, FileType>();

            DiskSectionType diskSectionType =
                OVFEnvelopeUtils.getSection(envelope, DiskSectionType.class);

            if (diskSectionType.getDisk().size() != 1)
            {
                // more than one disk in disk section
                throw new AMException(AMError.TEMPLATE_INVALID_MULTIPLE_DISKS);
            }
            else
            {
                int references = 0;
                for (FileType fileType : envelope.getReferences().getFile())
                {
                    fileIdToFileType.put(fileType.getId(), fileType);
                    if (diskSectionType.getDisk().get(0).getFileRef().equals(fileType.getId()))
                    {
                        references++;
                    }
                }
                if (references != 1)
                {
                    // file referenced in diskSection isn't found in file references or found more
                    // than one
                    throw new AMException(AMError.TEMPLATE_INVALID_MULTIPLE_FILES);
                }
            }
            // Create a hash
            for (VirtualDiskDescType virtualDiskDescType : diskSectionType.getDisk())
            {
                diskIdToDiskFormat.put(virtualDiskDescType.getDiskId(), virtualDiskDescType);
            }

            // /
View Full Code Here

TOP

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

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.