本文整理汇总了Java中org.jboss.ejb.client.EJBClientContext类的典型用法代码示例。如果您正苦于以下问题:Java EJBClientContext类的具体用法?Java EJBClientContext怎么用?Java EJBClientContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EJBClientContext类属于org.jboss.ejb.client包,在下文中一共展示了EJBClientContext类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initializeEJBClientContext
import org.jboss.ejb.client.EJBClientContext; //导入依赖的package包/类
private void initializeEJBClientContext()
{
Properties properties = new Properties();
properties.put("endpoint.name", "client-endpoint");
properties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
properties.put("remote.connections", "default");
properties.put("remote.connection.default.host", "localhost");
properties.put("remote.connection.default.port", "4447"); // this is port number to migrate
properties.put("remote.connection.default.port", "8080"); // this is correct port number
properties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
PropertiesBasedEJBClientConfiguration configuration =
new PropertiesBasedEJBClientConfiguration(properties);
final ContextSelector<EJBClientContext> ejbClientContextSelector =
new ConfigBasedEJBClientContextSelector(configuration);
final ContextSelector<EJBClientContext> previousSelector =
EJBClientContext.setSelector(ejbClientContextSelector);
}
开发者ID:windup,项目名称:windup-rulesets,代码行数:24,代码来源:RemoteTestClient2.java
示例2: getInitialContext
import org.jboss.ejb.client.EJBClientContext; //导入依赖的package包/类
private Context getInitialContext() throws NamingException, IOException {
Context localContext = initialContext;
if (localContext == null) {
final Properties ejb = getEjbProperties();
EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(ejb);
ConfigBasedEJBClientContextSelector selector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration);
EJBClientContext.setSelector(selector);
initialContext = localContext = new InitialContext(ejb);
}
return localContext;
}
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:12,代码来源:EJBConnectionProviderService.java
示例3: getInitialContext
import org.jboss.ejb.client.EJBClientContext; //导入依赖的package包/类
private Context getInitialContext() throws NamingException, IOException {
Context localContext = initialContext;
if (localContext == null) {
final EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(getEjbProperties());
final ConfigBasedEJBClientContextSelector selector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration);
EJBClientContext.setSelector(selector);
initialContext = localContext = new InitialContext(getEjbProperties());
}
return localContext;
}
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:11,代码来源:RemoteConnectionProvider.java
示例4: initContext
import org.jboss.ejb.client.EJBClientContext; //导入依赖的package包/类
private static InitialContext initContext() {
final Properties jndiProperties = new Properties();
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
final String host = System.getProperty("integration.provider.host", "localhost");
final String port = System.getProperty("integration.provider.port", "8080");
jndiProperties.put(Context.PROVIDER_URL, "remote://" + host + ":" + port);
jndiProperties.put("java.naming.factory.initial", org.jboss.naming.remote.client.InitialContextFactory.class.getName());
jndiProperties.put("endpoint.name", "integration-test-client");
jndiProperties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
jndiProperties.put("remote.connections", "default");
jndiProperties.put("remote.connection.default.host", host);
jndiProperties.put("remote.connection.default.port", port);
if (System.getProperty("integration.provider.username") != null) {
jndiProperties.put("remote.connection.default.username", System.getProperty("integration.provider.username"));
}
if (System.getProperty("integration.provider.password") != null) {
jndiProperties.put("remote.connection.default.password", System.getProperty("integration.provider.password"));
}
jndiProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
jndiProperties.put("jboss.naming.client.ejb.context", "true");
final EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(jndiProperties);
final ContextSelector<EJBClientContext> ejbClientContextSelector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration);
EJBClientContext.setSelector(ejbClientContextSelector);
try {
return new InitialContext(jndiProperties);
} catch (NamingException e) {
throw new IllegalStateException(e);
}
}
开发者ID:chr-krenn,项目名称:chr-krenn-fhj-ws2016-sd14-pse,代码行数:35,代码来源:IntegrationTestUtil.java
示例5: connect
import org.jboss.ejb.client.EJBClientContext; //导入依赖的package包/类
/**
* Connect to a running Siebog cluster. This method should be called before any other
* interaction with the server.
*
* @param masterAddress Address of the master node.
* @param slaves Address of at least one slave node (if any).
*/
public static void connect(String masterAddress, String... slaves) {
if (connected)
return;
Properties p = new Properties();
p.put("endpoint.name", "client-endpoint");
p.put("deployment.node.selector", RRDeploymentNodeSelector.class.getName());
p.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
p.put("remote.clusters", "ejb");
p.put("remote.cluster.ejb.username", USERNAME);
p.put("remote.cluster.ejb.password", PASSWORD);
// p.put("remote.cluster.ejb.clusternode.selector", RRClusterNodeSelector.class.getName());
addConnection(p, "master", masterAddress, 8080);
String connections = "";
for (String addr : slaves) {
String name = "s" + addr.replace('.', '_');
addConnection(p, name, addr, 8080);
connections += "," + name;
}
p.put("remote.connections", "master" + connections);
EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(p);
ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc);
EJBClientContext.setSelector(selector);
connected = true;
}
开发者ID:gcvt,项目名称:siebog,代码行数:35,代码来源:SiebogClient.java
示例6: main
import org.jboss.ejb.client.EJBClientContext; //导入依赖的package包/类
/**
* @param args no args needed
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// suppress output of client messages
Logger.getLogger("org.jboss").setLevel(Level.OFF);
Logger.getLogger("org.xnio").setLevel(Level.OFF);
Properties p = new Properties();
p.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
p.put("remote.connections", "one");
p.put("remote.connection.one.port", "4447");
p.put("remote.connection.one.host", "localhost");
p.put("remote.connection.one.username", "quickuser");
p.put("remote.connection.one.password", "quick-123");
EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(p);
ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc);
EJBClientContext.setSelector(selector);
Properties props = new Properties();
props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
InitialContext context = new InitialContext(props);
final boolean useScopedExample = Boolean.getBoolean("UseEjbClient34");
final String rcal = "ejb:jboss-ejb-multi-server-app-main/ejb//" + (useScopedExample ? "MainEjbClient34AppBean" : "MainAppBean") + "!" + MainApp.class.getName();
final MainApp remote = (MainApp) context.lookup(rcal);
final String result = remote.invokeAll("Client call at "+new Date());
System.out.println("InvokeAll succeed: "+result);
}
开发者ID:wfink,项目名称:jboss-as-quickstart,代码行数:33,代码来源:Client.java
示例7: main
import org.jboss.ejb.client.EJBClientContext; //导入依赖的package包/类
/**
* @param args
* @throws FacadeException
*/
public static void main(String[] args) throws FacadeException {
// Lookup Format will be
// <app-name>/<module-name>/<distinct-name>/<bean-name>!<fully-qualified-classname-of-the-remote-interface>
Context context = null;
try {
Properties props = new Properties();
// props.put(Context.INITIAL_CONTEXT_FACTORY,
// "org.jboss.naming.remote.client.InitialContextFactory");
// props.put(Context.PROVIDER_URL, "remote://localhost:8080");
props.put("remote.connections", "default");
props.put("remote.connection.default.port", "8080");
props.put("remote.connection.default.host", "localhost");
props.put("remote.connection.default.username", "de");
props.put("remote.connection.default.password", "de");
// props.setProperty(Context.PROVIDER_URL, "remote://localhost:8080/");
// props.setProperty(Context.SECURITY_PRINCIPAL, "de");
// props.setProperty(Context.SECURITY_CREDENTIALS, "de");
props.put(
"remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED",
"false");
props.put(
"remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS",
"false");
props.put("remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS", "JBOSS-LOCAL-USER");
props.put("jboss.naming.client.ejb.context", true);
//
EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(
props);
ContextSelector<EJBClientContext> contextSelector = new ConfigBasedEJBClientContextSelector(
ejbClientConfiguration);
EJBClientContext.setSelector(contextSelector);
Properties properties = new Properties();
properties.put(Context.URL_PKG_PREFIXES,
"org.jboss.ejb.client.naming");
context = new InitialContext(properties);
System.out.println("\n\tGot initial Context: "
+ context.SECURITY_PRINCIPAL.toString());
String lookUpString = "ejb:los.reference/project-ejb3/RefTopologyFacadeBean!de.linogistix.los.reference.facade.RefTopologyFacade";
RefTopologyFacade topo = (RefTopologyFacade) context.lookup(lookUpString);
context.close();
topo.createDemoTopology();
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:salimvanak,项目名称:myWMS,代码行数:70,代码来源:CreateRefTopologyStandalone.java
示例8: authentification
import org.jboss.ejb.client.EJBClientContext; //导入依赖的package包/类
private void authentification(String username, String password) {
// logger.info("authentification with username: " + username + " and password: " + password);
initialContextProperties.put("remote.connections", "default");
initialContextProperties.put("remote.connection.default.username", username);
initialContextProperties.put("remote.connection.default.password", password);
initialContextProperties.put("remote.connection.default.host",
initialContextProperties.get("remote.connection.default.host"));
initialContextProperties.put("remote.connection.default.port",
initialContextProperties.get("remote.connection.default.port"));
initialContextProperties.put(
"remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS",
initialContextProperties
.get("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS"));
initialContextProperties.put(
"remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT",
initialContextProperties
.get("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT"));
initialContextProperties.put(
"remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS",
initialContextProperties
.get("remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS"));
initialContextProperties.put("remote.initialContextProperties.create.options.org.xnio.Options.SSL_ENABLED",
initialContextProperties.get("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED"));
final EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(
initialContextProperties);
// EJB client context selection is based on selectors. So let's create a
// ConfigBasedEJBClientContextSelector which uses our
// EJBClientConfiguration created in previous step
final ContextSelector<EJBClientContext> ejbClientContextSelector = new ConfigBasedEJBClientContextSelector(
ejbClientConfiguration);
// Now let's setup the EJBClientContext to use this selector
EJBClientContext.setSelector(ejbClientContextSelector);
}
开发者ID:salimvanak,项目名称:myWMS,代码行数:43,代码来源:BeanLocator.java
示例9: testInvokeWithUser
import org.jboss.ejb.client.EJBClientContext; //导入依赖的package包/类
/**
* JBoss specific!
*
* @throws Exception
*/
@Test
@InSequence(3)
public void testInvokeWithUser() throws Exception {
log.debug("start testInvokeWithUser()");
if (!APPSERVER.equals(JBOSS)) {
return;
}
TEntity te = new TEntity("myName", 46, "winter");
Properties ejbProperties = new Properties();
ejbProperties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
// ejbProperties.put(javax.naming.Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
ejbProperties.put("remote.connections", "1");
ejbProperties.put("remote.connection.1.host", "localhost");
// ejbProperties.put("remote.connection.1.port", "4447");
ejbProperties.put("remote.connection.1.port", "8180");
ejbProperties.put("remote.connection.1.username", "ejbuser");
ejbProperties.put("remote.connection.1.password", "ejbuser123!");
EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(ejbProperties);
ConfigBasedEJBClientContextSelector selector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration);
EJBClientContext.setSelector(selector);
JBossEjbClientInterceptor interc = new JBossEjbClientInterceptor();
EJBClientContext.getCurrent().registerInterceptor(0, interc);
StatelessEJBLocator<RemoteEJB> locator = new StatelessEJBLocator(RemoteEJB.class, "",
CibetContextInterceptorIT.class.getSimpleName(), "RemoteEJBImpl", "");
RemoteEJB remoteEjb = org.jboss.ejb.client.EJBClient.createProxy(locator);
TEntity te2 = remoteEjb.persist(te);
log.debug(te2);
Assert.assertTrue(te2.getId() != 0);
// user and tenant are set in JBossEjbClientInterceptor
Context.sessionScope().setTenant("comp");
List<Archive> list = ArchiveLoader.loadArchives(TEntity.class.getName());
Assert.assertEquals(1, list.size());
Assert.assertEquals("Ernst", list.get(0).getCreateUser());
Assert.assertEquals(46, ((TEntity) list.get(0).getResource().getUnencodedTargetObject()).getCounter());
Context.end();
interc.setActive(false);
}
开发者ID:Wolfgang-Winter,项目名称:cibet,代码行数:49,代码来源:CibetContextInterceptorIT.java
注:本文中的org.jboss.ejb.client.EJBClientContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论