本文整理汇总了Java中javax.resource.spi.ResourceAdapterInternalException类的典型用法代码示例。如果您正苦于以下问题:Java ResourceAdapterInternalException类的具体用法?Java ResourceAdapterInternalException怎么用?Java ResourceAdapterInternalException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResourceAdapterInternalException类属于javax.resource.spi包,在下文中一共展示了ResourceAdapterInternalException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CredentialExtractor
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
public CredentialExtractor(Subject subject, ConnectionRequestInfo connectionRequestInfo, UserPasswordManagedConnectionFactory managedConnectionFactory) throws ResourceAdapterInternalException {
assert managedConnectionFactory != null;
if (connectionRequestInfo != null && !(connectionRequestInfo instanceof UserPasswordConnectionRequestInfo)) {
throw new ResourceAdapterInternalException("ConnectionRequestInfo must be a UserPasswordConnectionRequestInfo, not a " + connectionRequestInfo.getClass().getName());
}
if (subject != null) {
Set<PasswordCredential> credentials = subject.getPrivateCredentials(PasswordCredential.class);
for (PasswordCredential passwordCredential : credentials) {
if (managedConnectionFactory.equals(passwordCredential.getManagedConnectionFactory())) {
userName = passwordCredential.getUserName();
password = new String(passwordCredential.getPassword());
return;
}
}
throw new ResourceAdapterInternalException("No credential found for this ManagedConnectionFactory: " + managedConnectionFactory);
}
if (connectionRequestInfo != null && ((UserPasswordConnectionRequestInfo) connectionRequestInfo).getUserName() != null) {
userName = ((UserPasswordConnectionRequestInfo) connectionRequestInfo).getUserName();
password = ((UserPasswordConnectionRequestInfo) connectionRequestInfo).getPassword();
return;
}
userName = managedConnectionFactory.getUserName();
password = managedConnectionFactory.getPassword();
}
示例2: matches
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
public boolean matches(Subject subject, UserPasswordConnectionRequestInfo connectionRequestInfo, UserPasswordManagedConnectionFactory managedConnectionFactory) throws ResourceAdapterInternalException {
assert managedConnectionFactory != null;
if (subject != null) {
Set<PasswordCredential> credentials = subject.getPrivateCredentials(PasswordCredential.class);
for (PasswordCredential passwordCredential : credentials) {
if (managedConnectionFactory.equals(passwordCredential.getManagedConnectionFactory())) {
return (userName == null ? passwordCredential.getUserName() == null : userName.equals(passwordCredential.getUserName())
&& (password == null ? passwordCredential.getPassword() == null : Arrays.equals(password.toCharArray(), passwordCredential.getPassword())));
}
}
throw new ResourceAdapterInternalException("No credential found for this ManagedConnectionFactory: " + managedConnectionFactory);
}
if (connectionRequestInfo != null && connectionRequestInfo.getUserName() != null) {
return (userName.equals(connectionRequestInfo.getUserName()))
&& (password == null
? connectionRequestInfo.getPassword() == null
: password.equals(connectionRequestInfo.getPassword()));
}
return (userName == null ? managedConnectionFactory.getUserName() == null : userName.equals(managedConnectionFactory.getUserName())
&& (password == null ? managedConnectionFactory.getPassword() == null : password.equals(managedConnectionFactory.getPassword())));
}
示例3: start
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
/**
* This is called when a resource adapter instance is bootstrapped.
*
* @param ctx
* A bootstrap context containing references
* @throws ResourceAdapterInternalException
* indicates bootstrap failure.
*/
public void start(BootstrapContext ctx)
throws ResourceAdapterInternalException {
log.tracef("start(%s)", ctx);
this.bootstrapContext = ctx;
rabbitCF = new ConnectionFactory();
try {
rabbitCF.setUri(uri);
rabbitCF.setConnectionTimeout(getConnectionTimeout());
rabbitCF.setRequestedHeartbeat(getRequestedHeartbeat());
} catch (KeyManagementException | NoSuchAlgorithmException
| URISyntaxException e) {
throw new ResourceAdapterInternalException(e);
}
}
示例4: start
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
/**
* Start
*
* @param ctx The bootstrap context
* @throws ResourceAdapterInternalException Thrown if an error occurs
*/
@Override
public void start(final BootstrapContext ctx) throws ResourceAdapterInternalException {
if (logger.isTraceEnabled()) {
logger.trace("start(" + ctx + ")");
}
tm = ServiceUtils.getTransactionManager();
recoveryManager.start(useAutoRecovery);
this.ctx = ctx;
if (!configured.getAndSet(true)) {
try {
setup();
} catch (ActiveMQException e) {
throw new ResourceAdapterInternalException("Unable to create activation", e);
}
}
ActiveMQRALogger.LOGGER.resourceAdaptorStarted();
}
示例5: start
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
@Override
public void start(BootstrapContext ctx) throws ResourceAdapterInternalException {
log.debug("");
workManager = ctx.getWorkManager();
xaTerminator = ctx.getXATerminator();
try {
timer = ctx.createTimer();
perMinuteTimerTask = new PerMinuteTimerTask();
perMinuteTimerTask.init();
timer.schedule(perMinuteTimerTask, perMinuteTimerTask.getDelay(), perMinuteTimerTask.getPeriod());
} catch (UnavailableException e) {
log.warn("", e);
//throw new ResourceAdapterInternalException(e);
}
//bind();
log.debug("workManager={}, xaTerminator={}, timer={}", workManager, xaTerminator, timer);
}
示例6: start
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
public void start(BootstrapContext ctx) throws ResourceAdapterInternalException {
try {
Class.forName(ORG_CAMUNDA_BPM_ENGINE_PROCESS_ENGINE);
} catch (Exception e) {
log.info("ProcessEngine classes not found in shared libraries. Not initializing camunda Platform JobExecutor Resource Adapter.");
return;
}
// initialize the ExecutorService (CommonJ or JCA, depending on configuration)
if(isUseCommonJWorkManager) {
if(commonJWorkManagerName != null & commonJWorkManagerName.length() > 0) {
executorServiceWrapper.setExecutorService(new CommonJWorkManagerExecutorService(this, commonJWorkManagerName));
} else {
throw new RuntimeException("Resource Adapter configuration property 'isUseCommonJWorkManager' is set to true but 'commonJWorkManagerName' is not provided.");
}
} else {
executorServiceWrapper.setExecutorService(new JcaWorkManagerExecutorService(this, ctx.getWorkManager()));
}
log.log(Level.INFO, "camunda BPM executor service started.");
}
示例7: closePhysicalConnection
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
protected void closePhysicalConnection() throws ResourceException {
try {
pooledConnection.close();
} catch (SQLException e) {
throw new ResourceAdapterInternalException("Error attempting to destroy managed connection", e);
}
}
示例8: closePhysicalConnection
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
protected void closePhysicalConnection() throws ResourceException {
try {
getPhysicalConnection().close();
} catch (SQLException e) {
throw new ResourceAdapterInternalException("Error attempting to destroy managed connection", e);
}
}
示例9: getLogWriter
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
public PrintWriter getLogWriter() throws ResourceException {
try {
return dataSource.getLogWriter();
} catch (SQLException e) {
throw new ResourceAdapterInternalException(e.getMessage(), e);
}
}
示例10: setLogWriter
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
public void setLogWriter(PrintWriter log) throws ResourceException {
try {
dataSource.setLogWriter(log);
} catch (SQLException e) {
throw new ResourceAdapterInternalException(e.getMessage(), e);
}
}
示例11: closePhysicalConnection
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
protected void closePhysicalConnection() throws ResourceException {
try {
xaConnection.close();
} catch (SQLException e) {
throw new ResourceAdapterInternalException("Error attempting to destroy managed connection", e);
}
}
示例12: createManagedConnection
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo connectionRequestInfo) throws ResourceException {
CredentialExtractor credentialExtractor = new CredentialExtractor(subject, connectionRequestInfo, this);
PooledConnection sqlConnection = getPhysicalConnection(credentialExtractor);
try {
Connection pc = wrap(sqlConnection.getConnection());
return new ManagedPooledConnection(this, sqlConnection, pc, credentialExtractor, exceptionSorter);
} catch (SQLException e) {
throw new ResourceAdapterInternalException("Could not set up ManagedPooledConnection", e);
}
}
示例13: getPhysicalConnection
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
protected PooledConnection getPhysicalConnection(CredentialExtractor credentialExtractor) throws ResourceException {
try {
String username = credentialExtractor.getUserName();
String password = credentialExtractor.getPassword();
if (username != null) {
return dataSource.getPooledConnection(username, password);
} else {
return dataSource.getPooledConnection();
}
} catch (SQLException e) {
throw new ResourceAdapterInternalException("Unable to obtain physical connection to " + dataSource, e);
}
}
示例14: createManagedConnection
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo connectionRequestInfo) throws ResourceException {
CredentialExtractor credentialExtractor = new CredentialExtractor(subject, connectionRequestInfo, this);
XAConnection sqlConnection = getPhysicalConnection(credentialExtractor);
try {
XAResource xares = sqlConnection.getXAResource();
Connection pc = wrap(sqlConnection.getConnection());
return new ManagedXAConnection(this, sqlConnection, xares, pc, credentialExtractor, exceptionSorter);
} catch (SQLException e) {
throw new ResourceAdapterInternalException("Could not set up ManagedXAConnection", e);
}
}
示例15: getPhysicalConnection
import javax.resource.spi.ResourceAdapterInternalException; //导入依赖的package包/类
protected XAConnection getPhysicalConnection(CredentialExtractor credentialExtractor) throws ResourceException {
try {
String username = credentialExtractor.getUserName();
String password = credentialExtractor.getPassword();
if (username != null) {
return dataSource.getXAConnection(username, password);
} else {
return dataSource.getXAConnection();
}
} catch (SQLException e) {
throw new ResourceAdapterInternalException("Unable to obtain physical connection to " + dataSource, e);
}
}