1 16 17 18 package org.apache.commons.modeler.demo; 19 20 21 import java.util.HashMap ; 22 23 24 31 32 public class Service { 33 34 35 37 38 41 public Service() { 42 43 super(); 44 45 } 46 47 48 54 public Service(String name, Server server) { 55 56 super(); 57 setName(name); 58 setServer(server); 59 60 } 61 62 63 65 66 69 private HashMap connectors = new HashMap (); 70 71 72 74 75 78 public Container container = null; 79 80 public Container getContainer() { 81 return (this.container); 82 } 83 84 public void setContainer(Container container) { 85 this.container = container; 86 } 87 88 89 92 private String name = null; 93 94 public String getName() { 95 return (this.name); 96 } 97 98 public void setName(String name) { 99 this.name = name; 100 } 101 102 103 106 private Server server = null; 107 108 public Server getServer() { 109 return (this.server); 110 } 111 112 public void setServer(Server server) { 113 this.server = server; 114 } 115 116 117 119 120 125 public void addConnector(Connector connector) { 126 127 connectors.put(new Integer (connector.getPort()), connector); 128 129 } 130 131 132 137 public Connector findConnector(int port) { 138 139 return ((Connector) connectors.get(new Integer (port))); 140 141 } 142 143 144 147 public Connector[] findConnectors() { 148 149 return ((Connector[]) connectors.values().toArray(new Connector[0])); 150 151 } 152 153 154 159 public void removeConnector(Connector connector) { 160 161 connectors.remove(new Integer (connector.getPort())); 162 163 } 164 165 166 167 170 public String toString() { 171 172 StringBuffer sb = new StringBuffer ("Service["); 173 sb.append("name="); 174 sb.append(name); 175 sb.append("]"); 176 return (sb.toString()); 177 178 } 179 180 181 } 182 | Popular Tags |