示例#1
0
  @Override
  protected void addServicesOnStartup(
      final Map<String, KeyValueHolder<Object, Dictionary>> services) {
    final String jmsPort = System.getProperty("fcrepo.dynamic.jms.port", "61616");
    final String webPort = System.getProperty("fcrepo.dynamic.test.port", "8080");
    final ActiveMQComponent amq = new ActiveMQComponent();

    amq.setBrokerURL("tcp://localhost:" + jmsPort);
    amq.setExposeAllQueues(true);

    final FcrepoComponent fcrepo = new FcrepoComponent();
    fcrepo.setBaseUrl("http://localhost:" + webPort + "/fcrepo/rest");

    services.put("broker", asService(amq, "osgi.jndi.service.name", "fcrepo/Broker"));
    services.put("fcrepo", asService(fcrepo, "osgi.jndi.service.name", "fcrepo/Camel"));
  }
  public ForwardExpressTestApplication() throws Exception {
    final SimpleRegistry registry = new SimpleRegistry();

    this.context = new DefaultCamelContext(registry);
    context.setTracing(true);
    this.producerTemplate = new DefaultProducerTemplate(context);

    final ActiveMQComponent jmsComponent = new ActiveMQComponent();
    jmsComponent.setBrokerURL("tcp://localhost:61616");
    context.addComponent("jms", jmsComponent);

    context.addRoutes(new Routes());
    context.start();
    producerTemplate.start();

    this.ui = new UI();
  }