当前位置: 首页>>代码示例>>Java>>正文


Java ResourceAdapterInternalException类代码示例

本文整理汇总了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();
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:26,代码来源:CredentialExtractor.java

示例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())));
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:23,代码来源:CredentialExtractor.java

示例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);
	}

}
 
开发者ID:leogsilva,项目名称:rabbitmq-resource-adapter,代码行数:24,代码来源:RabbitmqResourceAdapter.java

示例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();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:29,代码来源:ActiveMQResourceAdapter.java

示例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);
}
 
开发者ID:dlmiles,项目名称:full-example-ee7-jca-eis,代码行数:20,代码来源:ResourceAdapterImpl.java

示例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.");
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:JcaExecutorServiceConnector.java

示例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);
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:8,代码来源:ManagedPooledConnection.java

示例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);
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:8,代码来源:ManagedJDBCConnection.java

示例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);
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:8,代码来源:AbstractJdbcManagedConnectionFactory.java

示例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);
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:8,代码来源:AbstractJdbcManagedConnectionFactory.java

示例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);
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:8,代码来源:ManagedXAConnection.java

示例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);
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:11,代码来源:ConnectionPoolDataSourceMCF.java

示例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);
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:14,代码来源:ConnectionPoolDataSourceMCF.java

示例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);
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:12,代码来源:XADataSourceMCF.java

示例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);
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:14,代码来源:XADataSourceMCF.java


注:本文中的javax.resource.spi.ResourceAdapterInternalException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。