Exemplo n.º 1
0
  @Override
  public void extend(ApplicationExtensionContext context) throws Exception {

    String appId = context.application().id();

    ServiceTarget target = context.target();

    DroolsPolicy policy = new DroolsPolicy();
    target
        .addService(
            DroolsPolicyServices.policy(appId, context.resourceId()),
            new ValueService<>(new ImmediateValue<>(policy)))
        .install();

    DroolsPolicyResourceService resource = new DroolsPolicyResourceService(context.resourceId());

    target
        .addService(Services.resource(appId, context.resourceId()), resource)
        .addDependency(
            DroolsPolicyServices.policy(appId, context.resourceId()),
            DroolsPolicy.class,
            resource.policyInjector())
        .install();

    DroolsPolicyConfigResourceService configResource =
        new DroolsPolicyConfigResourceService(context.resourceId());
    target
        .addService(Services.adminResource(appId, context.resourceId()), configResource)
        .addDependency(
            DroolsPolicyServices.policy(appId, context.resourceId()),
            DroolsPolicy.class,
            configResource.policyInjector())
        .install();

    context.mountPublic();
    context.mountPrivate();
  }
Exemplo n.º 2
0
 public Server localServer(String name) throws InterruptedException {
   return (Server) this.serviceContainer.getService(Services.server(name, false)).awaitValue();
 }
Exemplo n.º 3
0
 public Server networkServer(String name) throws InterruptedException {
   return (Server) this.serviceContainer.getService(Services.server(name, true)).awaitValue();
 }