/** * Constructs a new instance of this policy. The argument given is the connection spec to the slobrok to use for * resolving recipients, as well as the pattern to use when querying. This constructor does _not_ wait for the * mirror to become ready. * * @param arg The slobrok connection spec. */ public ExternPolicy(String arg) { if (arg == null || arg.length() == 0) { error = "Expected parameter, got empty string."; return; } String[] args = arg.split(";", 2); if (args.length != 2 || args[0].length() == 0 || args[1].length() == 0) { error = "Expected parameter on the form '<spec>;<pattern>', got '" + arg + "'."; return; } int pos = args[1].lastIndexOf('/'); if (pos < 0) { error = "Expected pattern on the form '<service>/<session>', got '" + args[1] + "'."; return; } SlobrokList slobroks = new SlobrokList(); slobroks.setup(args[0].split(",")); pattern = args[1]; session = pattern.substring(pos); orb = new Supervisor(new Transport()); mirror = new Mirror(orb, slobroks); error = null; }
@Override public synchronized void configure(SlobroksConfig config) { String[] slist = new String[config.slobrok().size()]; for(int i = 0; i < config.slobrok().size(); i++) { slist[i] = config.slobrok(i).connectionspec(); } if (slobroks == null) { slobroks = new SlobrokList(); } slobroks.setup(slist); if (mirror == null) { mirror = new Mirror(orb, slobroks); } }
@Override public void init() { if (slobroks != null) { orb = new Supervisor(new Transport()); mirror = new Mirror(orb, slobroks); } if (configSources != null) { if (mirror == null) { orb = new Supervisor(new Transport()); subscriber = subscribe(slobrokConfigId, new ConfigSourceSet(configSources)); } } }
task.jrtTask.scheduleNow(); register = new Register(orb, slobrokConfig.getSlobroks(), identity.getHostname(), listener.port()); mirror = new Mirror(orb, slobrokConfig.getSlobroks());