Vector protocols; protocol_configs=parseConfigurations(configuration); protocols=createProtocols(protocol_configs, st); if(protocols == null) return null; protocol_stack=connectProtocols(protocols); return protocol_stack;
/** * Creates a new protocol given the protocol specification. * @param prot_spec The specification of the protocol. Same convention as for specifying a protocol stack. * An exception will be thrown if the class cannot be created. Example: * <pre>"VERIFY_SUSPECT(timeout=1500)"</pre> Note that no colons (:) have to be * specified * @return Protocol The newly created protocol * @exception Exception Will be thrown when the new protocol cannot be created */ public Protocol createProtocol(String prot_spec) throws Exception { return conf.createProtocol(prot_spec, this); }
public void setup() throws Exception { if(top_prot == null) { top_prot=conf.setupProtocolStack(setup_string, this); // calls init() on each protocol if(top_prot == null) throw new Exception("ProtocolStack.setup(): couldn't create protocol stack"); top_prot.setUpProtocol(this); bottom_prot=conf.getBottommostProtocol(top_prot); conf.startProtocolStack(bottom_prot); // sets up queues and threads } }
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(); top=config.setupProtocolStack(props, null); harness.setDownProtocol(top); top.setUpProtocol(harness); // +++ bottom=getBottomProtocol(top); config.startProtocolStack(bottom); // 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); }
evt_type=((Integer)req.up_reqs.elementAt(j)).intValue(); if(!providesDownServices(i, req_list, evt_type)) { throw new Exception("Configurator.sanityCheck(): event " + Event.type2String(evt_type) + " is required by " + evt_type=((Integer)req.down_reqs.elementAt(j)).intValue(); if(!providesUpServices(i, req_list, evt_type)) { throw new Exception("Configurator.sanityCheck(): event " + Event.type2String(evt_type) + " is required by " +
/** * Return a number of ProtocolConfigurations in a vector * @param configuration protocol-stack configuration string * @return Vector of ProtocolConfigurations */ public Vector parseConfigurations(String configuration) throws Exception { Vector retval=new Vector(); // GemStoneAddition - use question mark, not colon to separate entries // so that numeric IPv6 addresses can be in the configuration Vector component_strings=parseComponentStrings(configuration, "?"); String component_string; ProtocolConfiguration protocol_config; if(component_strings == null) return null; for(int i=0; i < component_strings.size(); i++) { component_string=(String)component_strings.elementAt(i); protocol_config=new ProtocolConfiguration(component_string); retval.addElement(protocol_config); } return retval; }
/** * Inserts an already created (and initialized) protocol into the protocol list. Sets the links * to the protocols above and below correctly and adjusts the linked list of protocols accordingly. * Note that this method may change the value of top_prot or bottom_prot. * @param prot The protocol to be inserted. Before insertion, a sanity check will ensure that none * of the existing protocols have the same name as the new protocol. * @param position Where to place the protocol with respect to the neighbor_prot (ABOVE, BELOW) * @param neighbor_prot The name of the neighbor protocol. An exception will be thrown if this name * is not found * @exception Exception Will be thrown when the new protocol cannot be created, or inserted. */ public void insertProtocol(Protocol prot, int position, String neighbor_prot) throws Exception { conf.insertProtocol(prot, position, neighbor_prot, this); }
Vector components=parseComponentStrings(properties_str, ";"); if(components.size() > 0) { for(int i=0; i < components.size(); i++) {