本文整理汇总了Java中org.wildfly.swarm.container.Container类的典型用法代码示例。如果您正苦于以下问题:Java Container类的具体用法?Java Container怎么用?Java Container使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Container类属于org.wildfly.swarm.container包,在下文中一共展示了Container类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Container container = new Container();
container.fraction(new DatasourcesFraction().jdbcDriver("com.mysql", (d) -> {
d.driverClassName("com.mysql.jdbc.Driver");
d.xaDatasourceClass("com.mysql.jdbc.jdbc2.optional.MysqlXADataSource");
d.driverModuleName("com.mysql");
}).dataSource("MySQLDS", (ds) -> {
ds.driverName("com.mysql");
ds.connectionUrl(System.getenv().getOrDefault("JDBC_URL", "jdbc:mysql://mysql:3306/guestbook?useSSL=false&autoReconnect=true"));
ds.userName(System.getenv().getOrDefault("DATASOURCE_USERNAME", "myuser"));
ds.password(System.getenv().getOrDefault("DATASOURCE_PASSWORD", "mypassword"));
ds.backgroundValidation(true);
ds.validConnectionCheckerClassName("org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker");
ds.validateOnMatch(true);
ds.checkValidConnectionSql("SELECT 1");
}));
// Start the container and deploy the default war
container.start().deploy();
}
示例2: main
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
System.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
Container container = new Container(false);
container.setArgs(args);
container.start();
JavaArchive deployment = ShrinkWrap.create(JavaArchive.class);
// Add all of the scanner packages
String[] packages = {
"org.jboss.rhiot.beacon.bluez",
"org.jboss.rhiot.beacon.common",
"org.jboss.rhiot.beacon.publishers",
"org.jboss.rhiot.beacon.scannerjni",
"com.beust.jcommander"
};
deployment.addPackages(true, packages);
deployment.addClass(ScannerService.class);
URL loggingPropsURL = SwarmMain.class.getResource("/logging.properties");
deployment.addAsResource(loggingPropsURL, "/logging.properties");
deployment.as(ServiceActivatorArchive.class).addServiceActivator(ScannerServiceActivator.class);
container.deploy(deployment);
}
示例3: main
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Container container = new Container();
JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class);
deployment.as(TopologyArchive.class).advertise("restaurantService");
deployment.setContextRoot("/api");
deployment.addPackages(true, "org.jboss.shrinkwrap.api");
deployment.addAsLibrary(container.createDefaultDeployment());
deployment.addAllDependencies();
container.start();
container.deploy(deployment);
Topology lookup = Topology.lookup();
lookup.addListener(new TopologyListener() {
@Override
public void onChange(Topology tplg) {
System.out.println(">>> Delivery Service: The Topology Has Changed!");
printTopology(lookup);
}
});
printTopology(lookup);
}
示例4: main
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Container container = new Container();
JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class);
deployment.as(TopologyArchive.class).advertise("deliveryService");
deployment.setContextRoot("/api");
deployment.addPackages(true, "org.jboss.shrinkwrap.api");
deployment.addAsLibrary(container.createDefaultDeployment());
deployment.addAllDependencies();
container.start();
container.deploy(deployment);
Topology lookup = Topology.lookup();
lookup.addListener(new TopologyListener() {
@Override
public void onChange(Topology tplg) {
System.out.println(">>> Delivery Service: The Topology Has Changed!");
printTopology(lookup);
}
});
printTopology(lookup);
}
示例5: main
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
Container container = new Container();
JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class);
deployment.as(TopologyArchive.class).advertise("foodService");
deployment.setContextRoot("/api");
deployment.addPackages(true, "org.jboss.shrinkwrap.api");
deployment.addAsLibrary(container.createDefaultDeployment());
deployment.addAllDependencies();
container.start();
container.deploy(deployment);
Topology lookup = Topology.lookup();
lookup.addListener(new TopologyListener() {
@Override
public void onChange(Topology tplg) {
System.out.println(">>> Delivery Service: The Topology Has Changed!");
printTopology(lookup);
}
});
printTopology(lookup);
}
示例6: getImplicitDeployments
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
@Override
public List<Archive> getImplicitDeployments(SwaggerWebAppFraction fraction) throws Exception {
List<Archive> list = new ArrayList<>();
try {
// Get the swagger-ui bits as an Archive
WARArchive war = Swarm.artifact("org.wildfly.swarm:swagger-webapp-ui:war:" + Container.VERSION,
"swagger-webapp-ui.war")
.as(WARArchive.class)
.setContextRoot(fraction.getContext());
// If any user content has been provided, merge that with the swagger-ui bits
Archive<?> userContent = fraction.getWebContent();
if (userContent != null) {
war.merge(userContent);
}
//war.as(ZipExporter.class).exportTo(new File("swagger-webapp-ui.war"), true);
list.add(war);
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
示例7: initialize
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
@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");
}
}
示例8: configureFractionsFromXML
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void configureFractionsFromXML(Container container, List<ModelNode> operationList) throws Exception {
StandaloneXmlParser parser = new StandaloneXmlParser();
FractionProcessor<StandaloneXmlParser> consumer = (p, cfg, fraction) -> {
try {
if (cfg.getSubsystemParsers().isPresent()) {
Map<QName, XMLElementReader<List<ModelNode>>> fractionParsers =
(Map<QName, XMLElementReader<List<ModelNode>>>) cfg.getSubsystemParsers().get();
fractionParsers.forEach(p::addDelegate);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
};
// collect parsers
visitFractions(container, parser, consumer);
// parse the configurations
List<ModelNode> parseResult = parser.parse(xmlConfig.get());
operationList.addAll(parseResult);
}
示例9: newContainer
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
@Override
public Container newContainer(String... args) throws Exception {
return new Container()
.fraction(
ManagementFraction.createDefaultFraction()
.httpInterfaceManagementInterface((iface) -> {
iface.securityRealm("ManagementRealm");
})
.securityRealm("ManagementRealm", (realm) -> {
realm.inMemoryAuthentication((authn) -> {
authn.add(new Properties() {{
put("bob", "9b511b00aa7f2265621e38d2cf665f2f");
}});
});
realm.inMemoryAuthorization();
})
);
}
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:19,代码来源:ArqSecuredManagementInterfaceWithPrecomputedPropertiesTest.java
示例10: newContainer
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
@Override
public Container newContainer(String... args) throws Exception {
return new Container()
.fraction(
ManagementFraction.createDefaultFraction()
.httpInterfaceManagementInterface((iface) -> {
iface.securityRealm("ManagementRealm");
})
.securityRealm("ManagementRealm", (realm) -> {
realm.inMemoryAuthentication((authn) -> {
authn.add("bob", "tacos!", true);
});
realm.inMemoryAuthorization((authz) -> {
authz.add("bob", "admin");
});
})
);
}
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:19,代码来源:ArqSecuredManagementInterfaceTest.java
示例11: newContainer
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
@Override
public Container newContainer(String... args) throws Exception {
return new Container()
.fraction(
ManagementFraction.createDefaultFraction()
.httpInterfaceManagementInterface((iface) -> {
iface.securityRealm("ManagementRealm");
})
.securityRealm("ManagementRealm", (realm) -> {
realm.inMemoryAuthentication((authn) -> {
authn.add(new Properties() {{
put("bob", "tacos!");
}}, true);
});
realm.inMemoryAuthorization();
})
);
}
开发者ID:wildfly-swarm-archive,项目名称:ARCHIVE-wildfly-swarm,代码行数:19,代码来源:ArqSecuredManagementInterfaceWithPropertiesTest.java
示例12: testSimple
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
@Test
public void testSimple() throws Exception {
// System.setProperty("java.util.logging.manager","org.jboss.logmanager.LogManager");
Container container = new Container();
container.fraction(new VertxFraction());
container.start().stop();
}
示例13: newContainer
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
@Override
public Container newContainer(String... args) throws Exception {
return new Container()
.fraction(new CDIFraction())
.fraction(new VertxFraction())
.fraction(EJBFraction.createDefaultFraction());
}
示例14: testCanFindKubePing
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
@Test
@Ignore
public void testCanFindKubePing() throws Exception {
// TODO: We can't easily test KubePing without a server to hit
System.setProperty(SwarmProperties.ENVIRONMENT, "openshift");
Container container = new Container();
container.start();
// TODO: something useful here to verify we're actually using KubePing
container.stop();
System.setProperty(SwarmProperties.ENVIRONMENT, "");
}
示例15: main
import org.wildfly.swarm.container.Container; //导入依赖的package包/类
public static void main( String[] args ) throws Exception {
Container container = new Swarm();
container.start();
JAXRSArchive deployment = ShrinkWrap.create( JAXRSArchive.class );
deployment.setContextRoot( "/api" );
deployment.addClass( GameService.class );
deployment.addClass( GameServiceImpl.class );
deployment.addClass( GameSessionInfo.class );
deployment.addAllDependencies();
container.deploy( deployment );
}