001 /**
002 *
003 */
004 package de.jw.cloud42.webservice.wrapper;
005
006 import java.util.ArrayList;
007 import java.util.List;
008
009 /**
010 * Wrapper around Typicas GroupDesritopm.IpPermission since Axis2 does not recognize nested types.
011 * Morever, cidrIps is returned as array instead of list.
012 *
013 * @author fbitzer
014 *
015 */
016 public class Cloud42IpPermission {
017
018 private String protocol;
019 private int fromPort;
020 private int toPort;
021 private List<String> cidrIps = new ArrayList<String>();
022
023 //not used!
024 //private List<String[]> uid_group_pairs = new ArrayList<String[]>();
025
026
027 /**
028 * Load data from wrapped object in the constructor.
029 */
030 public Cloud42IpPermission(com.xerox.amazonws.ec2.GroupDescription.IpPermission p) {
031 this.protocol = p.getProtocol();
032 this.fromPort = p.getFromPort();
033 this.toPort = p.getToPort();
034 this.cidrIps = p.getIpRanges();
035
036 }
037
038
039
040 public String getProtocol() {
041 return protocol;
042 }
043
044 public int getFromPort() {
045 return fromPort;
046 }
047
048 public int getToPort() {
049 return toPort;
050 }
051
052 public void addIpRange(String cidrIp) {
053 this.cidrIps.add(cidrIp);
054 }
055
056 public String[] getIpRanges() {
057 return cidrIps.toArray(new String[0]);
058 }
059
060
061
062
063 }