Java Code Examples for org.wildfly.swarm.container.Container#InitContext

The following examples show how to use org.wildfly.swarm.container.Container#InitContext . 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: JPAFraction.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize(Container.InitContext initContext) {
    if (!inhibitDefaultDatasource) {
        final DatasourcesFraction datasources = new DatasourcesFraction()
                .jdbcDriver("h2", (d) -> {
                    d.driverClassName("org.h2.Driver");
                    d.xaDatasourceClass("org.h2.jdbcx.JdbcDataSource");
                    d.driverModuleName("com.h2database.h2");
                })
                .dataSource("ExampleDS", (ds) -> {
                    ds.driverName("h2");
                    ds.connectionUrl("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE");
                    ds.userName("sa");
                    ds.password("sa");
                });

        initContext.fraction(datasources);
        System.err.println("setting default Datasource to ExampleDS");
        defaultDatasource("jboss/datasources/ExampleDS");
    }
}
 
Example 2
Source File: LogstashFraction.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(Container.InitContext initContext) {
    final CustomHandler<?> logstashHandler = new CustomHandler<>("logstash-handler")
            .module("org.jboss.logmanager.ext")
            .attributeClass("org.jboss.logmanager.ext.handlers.SocketHandler")
            .namedFormatter("logstash")
            .properties(handlerProperties);
    initContext.fraction(new LoggingFraction()
            .customFormatter("logstash", "org.jboss.logmanager.ext", "org.jboss.logmanager.ext.formatters.LogstashFormatter", this.formatterProperties)
            .customHandler(logstashHandler)
            .rootLogger(this.level, logstashHandler.getKey()));
}
 
Example 3
Source File: EJBRemoteFraction.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(Container.InitContext initContext) {
    initContext.fraction(
            createDefaultFraction()
                    .remoteService(
                            new RemoteService()
                                    .connectorRef("http-remoting-connector")
                                    .threadPoolName("default")
                    )
    );
}
 
Example 4
Source File: ManagementFraction.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(Container.InitContext initContext) {
    initContext.socketBinding(
            new SocketBinding("management-http")
                    .port(SwarmProperties.propertyVar(ManagementProperties.HTTP_PORT, "9990")));
    initContext.socketBinding(
            new SocketBinding("management-https")
                    .port(SwarmProperties.propertyVar(ManagementProperties.HTTPS_PORT, "9993")));
}
 
Example 5
Source File: JGroupsFraction.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(Container.InitContext initContext) {
    initContext.socketBinding(
            new SocketBinding("jgroups-udp")
                    .port(55200)
                    .multicastAddress(SwarmProperties.propertyVar(JGroupsProperties.DEFAULT_MULTICAST_ADDRESS,
                            "230.0.0.4"))
                    .multicastPort(45688));

    initContext.socketBinding(
            new SocketBinding("jgroups-udp-fd")
                    .port(54200));

    initContext.socketBinding(
            new SocketBinding("jgroups-mping")
                    .port(0)
                    .multicastAddress(SwarmProperties.propertyVar(JGroupsProperties.DEFAULT_MULTICAST_ADDRESS,
                            "230.0.0.4"))
                    .multicastPort(45700));

    initContext.socketBinding(
            new SocketBinding("jgroups-tcp")
                    .port(7600));

    initContext.socketBinding(
            new SocketBinding("jgroups-tcp-fd")
                    .port(57600));

}
 
Example 6
Source File: TransactionsFraction.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(Container.InitContext initContext) {

    initContext.socketBinding(new SocketBinding("txn-recovery-environment")
            .port(this.port));

    initContext.socketBinding(new SocketBinding("txn-status-manager")
            .port(this.statusPort));
}
 
Example 7
Source File: UndertowFraction.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(Container.InitContext initContext) {
    initContext.socketBinding(
            new SocketBinding("http")
                    .port(SwarmProperties.propertyVar(UndertowProperties.HTTP_PORT, "8080")));
    initContext.socketBinding(
            new SocketBinding("https")
                    .port(SwarmProperties.propertyVar(UndertowProperties.HTTPS_PORT, "8443")));
}
 
Example 8
Source File: MyJPAFraction.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 4 votes vote down vote up
@Override
public void initialize(Container.InitContext initContext) {
    //Do Nothing
}