Java Code Examples for org.wildfly.swarm.container.Container#fractions()

The following examples show how to use org.wildfly.swarm.container.Container#fractions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RuntimeServer.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 6 votes vote down vote up
/**
 * Wraps common iteration pattern over fraction and server configurations
 *
 * @param container
 * @param context   processing context (i.e. accumulator)
 * @param fn        a {@link org.wildfly.swarm.container.runtime.RuntimeServer.FractionProcessor} instance
 */
private <T> void visitFractions(Container container, T context, FractionProcessor<T> fn) {
    OUTER:
    for (ServerConfiguration eachConfig : this.configList) {
        boolean found = false;
        INNER:
        for (Fraction eachFraction : container.fractions()) {
            if (eachConfig.getType().isAssignableFrom(eachFraction.getClass())) {
                found = true;
                fn.accept(context, eachConfig, eachFraction);
                break INNER;
            }
        }
        if (!found && !eachConfig.isIgnorable()) {
            System.err.println("*** unable to find fraction for: " + eachConfig.getType());
        }

    }
}
 
Example 2
Source File: RuntimeServer.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
private void configureFractions(Container config, List<ModelNode> list) throws Exception {
    for (ServerConfiguration<Fraction> eachConfig : this.configList) {
        boolean found = false;
        for (Fraction eachFraction : config.fractions()) {
            if (eachConfig.getType().isAssignableFrom(eachFraction.getClass())) {
                found = true;
                list.addAll(eachConfig.getList(eachFraction));
                break;
            }
        }
        if (!found && !eachConfig.isIgnorable()) {
            System.err.println("*** unable to find fraction for: " + eachConfig.getType());
        }
    }
}