public void setup(ProtocolStack stack) throws Exception { if(top_prot == null) { top_prot=new Configurator(this).setupProtocolStack(stack); top_prot.setUpProtocol(this); this.setDownProtocol(top_prot); bottom_prot=getBottomProtocol(); initProtocolStack(); } }
public void setup(List<ProtocolConfiguration> configs) throws Exception { if(top_prot == null) { top_prot=new Configurator(this).setupProtocolStack(configs); top_prot.setUpProtocol(this); this.setDownProtocol(top_prot); bottom_prot=getBottomProtocol(); initProtocolStack(); } }
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; @Configuration @ComponentScan("com.myproject.configuration") @PropertySource("classpath:/application.properties") public class Config { @Bean public Configurator configurator() { return new Configurator(); } }
if(INSTANCE == null) return new Configurator(); return INSTANCE; }
private static Configurator INSTANCE = new Configurator();
public static void main(String args[]) { if(args.length != 1) { System.err.println("Configurator <string>"); System.exit(0); } String config_str=args[0]; Configurator conf=new Configurator(); Vector<ProtocolConfiguration> protocol_configs; Vector<Protocol> protocols=null; Protocol protocol_stack; try { protocol_configs=Configurator.parseConfigurations(config_str); protocols=Configurator.createProtocols(protocol_configs, null); if(protocols == null) return; protocol_stack=Configurator.connectProtocols(protocols); Thread.sleep(3000); Configurator.destroyProtocolStack(protocol_stack); // conf.stopProtocolStackInternal(protocol_stack); } catch(Exception e) { System.err.println(e); } System.err.println(protocols); }
Configurator config=new Configurator(); String cfg=inputAsString(input); Vector tmp=config.parseConfigurations(cfg);
public ProtocolTester(String prot_spec, Protocol harness) throws Exception { if(prot_spec == null || harness == null) throw new Exception("ProtocolTester(): prot_spec or harness is null"); props=prot_spec; this.harness=harness; props="LOOPBACK:" + props; // add a loopback layer at the bottom of the stack config=new Configurator(); ProtocolStack stack=new ProtocolStack(); top=config.setupProtocolStack(props, stack); harness.setDownProtocol(top); top.setUpProtocol(harness); // +++ bottom=getBottomProtocol(top); // has to be set after StartProtocolStack, otherwise the up and down handler threads in the harness // will be started as well (we don't want that) ! // top.setUpProtocol(harness); }
public void setup(ProtocolStack stack) throws Exception { if(top_prot == null) { top_prot=new Configurator(this).setupProtocolStack(stack); top_prot.setUpProtocol(this); this.setDownProtocol(top_prot); bottom_prot=getBottomProtocol(); initProtocolStack(); } }
public void setup(List<ProtocolConfiguration> configs) throws Exception { if(top_prot == null) { top_prot=new Configurator(this).setupProtocolStack(configs); top_prot.setUpProtocol(this); this.setDownProtocol(top_prot); bottom_prot=getBottomProtocol(); initProtocolStack(); } }