1 /* 2 * Copyright the original author or authors. 3 * 4 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.mozilla.org/MPL/MPL-1.1.html 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 import org.as2lib.core.BasicClass; 18 import org.as2lib.io.conn.core.server.ServerRegistry; 19 import org.as2lib.io.conn.local.server.LocalServerRegistry; 20 21 /** 22 * {@code LocalConfig} is the basic configuration class of the Local Connection API. 23 * 24 * <p>It can be used to configure static parts, that means parts that are shared 25 * globally. 26 * 27 * @author Simon Wacker 28 */ 29 class org.as2lib.io.conn.local.LocalConfig extends BasicClass { 30 31 /** Stores the server registry. */ 32 private static var serverRegistry:ServerRegistry; 33 34 /** 35 * Private constructor. 36 */ 37 private function LocalConfig(Void) { 38 } 39 40 /** 41 * Returns the currently used server registry. 42 * 43 * <p>That is either the server registry set via {@link #setServerRegistry} or the 44 * default on which is an instance of class {@link LocalServerRegistry}. 45 * 46 * @return the currenlty used server registry 47 * @see #setServerRegistry 48 */ 49 public static function getServerRegistry(Void):ServerRegistry { 50 if (!serverRegistry) serverRegistry = new LocalServerRegistry(); 51 return serverRegistry; 52 } 53 54 /** 55 * Sets a new server registry. 56 * 57 * <p>If you set a server registry of value {@code null} or {@code undefined} 58 * {@link #getServerRegistry} will return the default server registry. 59 * 60 * @param newServerRegistry the new server registry 61 * @see #getServerRegistry 62 */ 63 public static function setServerRegistry(newServerRegistry:ServerRegistry):Void { 64 serverRegistry = newServerRegistry; 65 } 66 67 }