X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=verigraph%2Fsrc%2Fit%2Fpolito%2Fverigraph%2Ftosca%2Fyaml%2Fbeans%2FNodeTemplateYaml.java;fp=verigraph%2Fsrc%2Fit%2Fpolito%2Fverigraph%2Ftosca%2Fyaml%2Fbeans%2FNodeTemplateYaml.java;h=9821f7cb4e9c3c4552897a79b7af7686355d1b00;hb=0f987a9e1b8e79caef48015adf865eef36216dbc;hp=0000000000000000000000000000000000000000;hpb=fcda9807cfa6a89d691877126b406c5d3909d9b9;p=parser.git diff --git a/verigraph/src/it/polito/verigraph/tosca/yaml/beans/NodeTemplateYaml.java b/verigraph/src/it/polito/verigraph/tosca/yaml/beans/NodeTemplateYaml.java new file mode 100644 index 0000000..9821f7c --- /dev/null +++ b/verigraph/src/it/polito/verigraph/tosca/yaml/beans/NodeTemplateYaml.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2018 Politecnico di Torino and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Apache License, Version 2.0 + * which accompanies this distribution, and is available at + * http://www.apache.org/licenses/LICENSE-2.0 + *******************************************************************************/ +package it.polito.verigraph.tosca.yaml.beans; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.*; + +//These annotations allow polimorphic deserialization of yaml text into beans by using the type field of each node +//In case a specified type is unknown the default implementation will be FieldModifierNode +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property="type", defaultImpl=FieldModifierNode.class, visible= true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = AntispamNode.class, name="verigraph.nodeTypes.Antispam"), + @JsonSubTypes.Type(value = CacheNode.class, name="verigraph.nodeTypes.Cache"), + @JsonSubTypes.Type(value = DpiNode.class, name="verigraph.nodeTypes.Dpi"), + @JsonSubTypes.Type(value = EndhostNode.class, name="verigraph.nodeTypes.Endhost"), + @JsonSubTypes.Type(value = EndpointNode.class, name="verigraph.nodeTypes.Endpoint"), + @JsonSubTypes.Type(value = FieldModifierNode.class, name="verigraph.nodeTypes.FieldModifier"), + @JsonSubTypes.Type(value = FirewallNode.class, name="verigraph.nodeTypes.Firewall"), + @JsonSubTypes.Type(value = MailClientNode.class, name="verigraph.nodeTypes.MailClient"), + @JsonSubTypes.Type(value = MailServerNode.class, name="verigraph.nodeTypes.MailServer"), + @JsonSubTypes.Type(value = NatNode.class, name="verigraph.nodeTypes.Nat"), + @JsonSubTypes.Type(value = VpnAccessNode.class, name="verigraph.nodeTypes.VpnAccess"), + @JsonSubTypes.Type(value = VpnExitNode.class, name="verigraph.nodeTypes.VpnExit"), + @JsonSubTypes.Type(value = WebClientNode.class, name="verigraph.nodeTypes.WebClient"), + @JsonSubTypes.Type(value = WebServerNode.class, name="verigraph.nodeTypes.WebServer") +}) +public class NodeTemplateYaml { + private String name; + private String type; + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + // //Generic YamlNode configuration to be extended in single nodes + // public interface ConfigurationYaml { + // } + +}