@PostConstruct
  public void start() {

    List<Module> modules = new ArrayList<Module>();
    modules.addAll(SiriCoreModule.getModules());
    Injector injector = Guice.createInjector(modules);

    _client = injector.getInstance(SiriClient.class);
    _lifecycleService = injector.getInstance(LifecycleService.class);

    _client.addServiceDeliveryHandler(_handler);

    if (_clientUrl != null) _client.setUrl(_clientUrl);
    if (_logRawXmlType != null) _client.setLogRawXmlType(_logRawXmlType);

    _lifecycleService.start();

    if (!CollectionsLibrary.isEmpty(_endpoints)) {

      SiriClientRequestFactory factory = new SiriClientRequestFactory();

      for (String endpoint : _endpoints) {

        Map<String, String> args = SiriLibrary.getLineAsMap(endpoint);
        SiriClientRequest request = factory.createSubscriptionRequest(args);

        SiriEndpointDetails context = new SiriEndpointDetails();

        String agencyId = args.get("AgencyId");
        if (agencyId != null) context.getDefaultAgencyIds().add(agencyId);

        String agencyIds = args.get("AgencyIds");
        if (agencyIds != null) {
          for (String id : agencyIds.split(",")) context.getDefaultAgencyIds().add(id);
        }

        request.setChannelContext(context);

        _client.handleRequest(request);
      }
    }
  }
 @RequestMapping(value = "/siri.action")
 public void siri(Reader reader, Writer writer) {
   _client.handleRawRequest(reader, writer);
 }
 @PreDestroy
 public void stop() {
   _client.removeServiceDeliveryHandler(_handler);
   _lifecycleService.stop();
 }