1 25 package org.objectweb.carol.jndi.ns; 26 27 import java.util.Properties ; 28 29 30 35 public abstract class AbsRegistry implements NameService { 36 37 40 private int port = 0; 41 42 45 private String host = null; 46 47 48 51 private boolean isStarted = false; 52 53 56 private Properties configurationProperties = null; 57 58 59 62 protected AbsRegistry() { 63 64 } 65 66 70 protected AbsRegistry(int defaultPortNumber) { 71 this.port = defaultPortNumber; 72 } 73 74 75 80 public abstract void start() throws NameServiceException; 81 82 87 public abstract void stop() throws NameServiceException; 88 89 90 91 95 public boolean isStarted() { 96 return isStarted; 97 } 98 99 103 public void setPort(int p) { 104 if (p <= 0) { 105 throw new IllegalArgumentException ( 106 "The number for the port is incorrect. It must be a value > 0. Value was '" + port + "'"); 107 } 108 this.port = p; 109 } 110 111 115 public void setHost(String host) { 116 this.host = host; 117 } 118 119 122 public String getHost() { 123 return host; 124 } 125 126 130 public int getPort() { 131 return port; 132 } 133 134 135 139 public void setConfigProperties(Properties p) { 140 this.configurationProperties = p; 141 } 142 143 144 147 protected void setStarted() { 148 this.isStarted = true; 149 } 150 151 154 protected void resetStarted() { 155 this.isStarted = false; 156 } 157 158 159 162 protected Properties getConfigProperties() { 163 return configurationProperties; 164 } 165 } 166 | Popular Tags |