@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();
  }
示例#2
0
 public Server localServer(String name) throws InterruptedException {
   return (Server) this.serviceContainer.getService(Services.server(name, false)).awaitValue();
 }
示例#3
0
 public Server networkServer(String name) throws InterruptedException {
   return (Server) this.serviceContainer.getService(Services.server(name, true)).awaitValue();
 }