| 1 | /** |
| 2 | * Licensed to jclouds, Inc. (jclouds) under one or more |
| 3 | * contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. jclouds licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | package org.jclouds.ovf; |
| 20 | |
| 21 | import org.jclouds.ovf.internal.BaseEnvelope; |
| 22 | |
| 23 | import com.google.common.collect.Multimap; |
| 24 | |
| 25 | /** |
| 26 | * @author Adrian Cole |
| 27 | */ |
| 28 | public class Envelope extends BaseEnvelope<VirtualSystem, Envelope> { |
| 29 | |
| 30 | @SuppressWarnings("unchecked") |
| 31 | public static Builder builder() { |
| 32 | return new Builder(); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * {@inheritDoc} |
| 37 | */ |
| 38 | public Builder toBuilder() { |
| 39 | return new Builder().fromEnvelope(this); |
| 40 | } |
| 41 | |
| 42 | public static class Builder extends BaseEnvelope.Builder<VirtualSystem, Envelope> { |
| 43 | |
| 44 | /** |
| 45 | * {@inheritDoc} |
| 46 | */ |
| 47 | public Envelope build() { |
| 48 | return new Envelope(diskSections, networkSections, additionalSections, virtualSystem); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * {@inheritDoc} |
| 53 | */ |
| 54 | @SuppressWarnings("unchecked") |
| 55 | @Override |
| 56 | public Builder additionalSection(String name, Section additionalSection) { |
| 57 | return Builder.class.cast(super.additionalSection(name, additionalSection)); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * {@inheritDoc} |
| 62 | */ |
| 63 | @SuppressWarnings("unchecked") |
| 64 | @Override |
| 65 | public Builder additionalSections(Multimap<String, Section> additionalSections) { |
| 66 | return Builder.class.cast(super.additionalSections(additionalSections)); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * {@inheritDoc} |
| 71 | */ |
| 72 | @Override |
| 73 | public Builder diskSection(DiskSection diskSection) { |
| 74 | return Builder.class.cast(super.diskSection(diskSection)); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * {@inheritDoc} |
| 79 | */ |
| 80 | @Override |
| 81 | public Builder diskSections(Iterable<? extends DiskSection> diskSections) { |
| 82 | return Builder.class.cast(super.diskSections(diskSections)); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * {@inheritDoc} |
| 87 | */ |
| 88 | @Override |
| 89 | public Builder fromEnvelope(BaseEnvelope<VirtualSystem, Envelope> in) { |
| 90 | return Builder.class.cast(super.fromEnvelope(in)); |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * {@inheritDoc} |
| 95 | */ |
| 96 | @Override |
| 97 | public Builder networkSection(NetworkSection networkSection) { |
| 98 | return Builder.class.cast(super.networkSection(networkSection)); |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * {@inheritDoc} |
| 103 | */ |
| 104 | @Override |
| 105 | public Builder networkSections(Iterable<? extends NetworkSection> networkSections) { |
| 106 | return Builder.class.cast(super.networkSections(networkSections)); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * {@inheritDoc} |
| 111 | */ |
| 112 | @Override |
| 113 | public Builder virtualSystem(VirtualSystem virtualSystem) { |
| 114 | return Builder.class.cast(super.virtualSystem(virtualSystem)); |
| 115 | } |
| 116 | |
| 117 | } |
| 118 | |
| 119 | @SuppressWarnings("unchecked") |
| 120 | public Envelope(Iterable<? extends DiskSection> diskSections, Iterable<? extends NetworkSection> networkSections, |
| 121 | Multimap<String, Section> additionalSections, VirtualSystem virtualSystem) { |
| 122 | super(diskSections, networkSections, additionalSections, virtualSystem); |
| 123 | } |
| 124 | |
| 125 | } |