All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xlcloud.service.StackBlueprint Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2012 AMG.lab, a Bull Group Company
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.xlcloud.service;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import org.xlcloud.service.heat.template.Template;
import org.xlcloud.service.heat.template.resources.StackResource;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * Representation of Stack Blueprint in XMS.
 *
 * @author Tomek Adamczewski, AMG.net
 * @author Piotr Kulasek-Szwed, AMG.net
 * @author Konrad Król, AMG.net
 */
@XmlAccessorType( XmlAccessType.FIELD )
@XmlType(name = "", propOrder = { "layers" } )
@XmlRootElement( name = "stackBlueprint" )
public class StackBlueprint extends StackBase implements TemplateBasedModel {

    /**
     * TODO Documentation serialVersionUID
     */
    private static final long serialVersionUID = 3779411678737706618L;

    @XmlAttribute
    private String author;

    @XmlAttribute
    private String license;

    @XmlAttribute
    private String copyright;

    @XmlAttribute
    private String type;
    
    @XmlAttribute
    protected CatalogScopeType catalogScope;
    
    private LayerBlueprints layers;
    
    /**
     * Gets the value of {@link #layers}.
     * 
     * @return value of {@link #layers}
     */
    public LayerBlueprints getLayers() {
        if(layers == null) {
            layers = new LayerBlueprints();
        }
        return layers;
    }
    
    /**
     * Sets the value of {@link #layers}.
     * @param layers - value
     */
    public void setLayers(LayerBlueprints layers) {
        this.layers = layers;
        for(LayerBlueprint layerBlueprint : this.getLayers().getLayer()) {
            StackResource stackResource = new StackResource();
            stackResource.setTemplateUrl(layerBlueprint.getHref());
            stackResource.setName(layerBlueprint.getName());
            this.template.getResources().getResource().add(stackResource);
        }
    }
    
    /**
     * Gets the value of the type property.
     *
     * @return possible object is {@link String }
     */
    public String getType() {
        return type;
    }

    /**
     * Sets the value of the type property.
     *
     * @param value
     *            allowed object is {@link String }
     */
    public void setType(String value) {
        this.type = value;
    }

    /**
     * Gets the value of {@link #author}.
     *
     * @return value of {@link #author}
     */
    public String getAuthor() {
        return author;
    }

    /**
     * Sets the value of {@link #author}.
     *
     * @param author
     *            - value
     */
    public void setAuthor(String author) {
        this.author = author;
    }

    /**
     * Gets the value of {@link #license}.
     *
     * @return value of {@link #license}
     */
    public String getLicense() {
        return license;
    }

    /**
     * Sets the value of {@link #license}.
     *
     * @param license
     *            - value
     */
    public void setLicense(String license) {
        this.license = license;
    }

    /**
     * Gets the value of {@link #copyright}.
     *
     * @return value of {@link #copyright}
     */
    public String getCopyright() {
        return copyright;
    }

    /**
     * Sets the value of {@link #copyright}.
     *
     * @param copyright
     *            - value
     */
    public void setCopyright(String copyright) {
        this.copyright = copyright;
    }
    
    /**
     * Gets the value of {@link #catalogScope}.
     * 
     * @return value of {@link #catalogScope}
     */
    public CatalogScopeType getCatalogScope() {
        return catalogScope;
    }

    /**
     * Sets the value of {@link #catalogScope}.
     * 
     * @param catalogScope
     *            - value
     */
    public void setCatalogScope(CatalogScopeType catalogScope) {
        this.catalogScope = catalogScope;
    }
    
    /** {@inheritDoc} */
    @JsonIgnore
    @Override
    public StackBlueprint fromTemplate(Template template) {
        this.template = template;
        return this;
    }
    
    /** {@inheritDoc} */
    @JsonIgnore
    @Override
    public Template toTemplate() {
        return this.template;
    }

    @Override
    protected String getResourcePrefix() {
        return "/stack-blueprints";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy