本文整理汇总了Java中javax.resource.spi.InvalidPropertyException类的典型用法代码示例。如果您正苦于以下问题:Java InvalidPropertyException类的具体用法?Java InvalidPropertyException怎么用?Java InvalidPropertyException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InvalidPropertyException类属于javax.resource.spi包,在下文中一共展示了InvalidPropertyException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRemoteCacheWrapperFromProperties
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
@Override
protected RemoteCacheManager createRemoteCacheWrapperFromProperties(
ClassLoader classLoader) throws ResourceException {
File f = new File(this.getHotRodClientPropertiesFile());
if (!f.exists()) {
throw new InvalidPropertyException(InfinispanManagedConnectionFactory.UTIL.getString("clientPropertiesFileDoesNotExist", f.getAbsoluteFile()));
}
try {
Properties props = PropertiesUtils.load(f.getAbsolutePath());
LogManager
.logInfo(LogConstants.CTX_CONNECTOR,
"=== Using RemoteCacheManager (created from properties file " + f.getAbsolutePath() + ") ==="); //$NON-NLS-1$
return createRemoteCacheWrapper(props, classLoader);
} catch (Exception err) {
throw new ResourceException(err);
}
}
示例2: getServers
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
protected List<ServerAddress> getServers() throws ResourceException {
String serverlist = getRemoteServerList();
if (!serverlist.startsWith("mongodb://")) { //$NON-NLS-1$
List<ServerAddress> addresses = new ArrayList<ServerAddress>();
StringTokenizer st = new StringTokenizer(serverlist, ";"); //$NON-NLS-1$
while (st.hasMoreTokens()) {
String token = st.nextToken();
int idx = token.indexOf(':');
if (idx < 0) {
throw new InvalidPropertyException(UTIL.getString("no_database")); //$NON-NLS-1$
}
try {
addresses.add(new ServerAddress(token.substring(0, idx), Integer.valueOf(token.substring(idx+1))));
} catch(UnknownHostException e) {
throw new ResourceException(e);
}
}
return addresses;
}
return null;
}
示例3: testBadDestinationType
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
@Test
public void testBadDestinationType() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();
MyBootstrapContext ctx = new MyBootstrapContext();
qResourceAdapter.start(ctx);
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
spec.setUseJNDI(false);
spec.setDestinationType("badDestinationType");
spec.setDestination("mdbTopic");
spec.setSetupAttempts(1);
spec.setShareSubscriptions(true);
spec.setMaxSession(1);
CountDownLatch latch = new CountDownLatch(5);
DummyMessageEndpoint endpoint = new DummyMessageEndpoint(latch);
DummyMessageEndpointFactory endpointFactory = new DummyMessageEndpointFactory(endpoint, false);
try {
qResourceAdapter.endpointActivation(endpointFactory, spec);
fail();
} catch (Exception e) {
assertTrue(e instanceof InvalidPropertyException);
assertEquals("destinationType", ((InvalidPropertyException) e).getInvalidPropertyDescriptors()[0].getName());
}
}
示例4: setLoginTimeout
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
public void setLoginTimeout(int timeout) throws ResourceException {
try {
dataSource.setLoginTimeout(timeout);
} catch (SQLException e) {
throw new InvalidPropertyException(e.getMessage());
}
}
示例5: createConnectionFactory
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
@Override
@SuppressWarnings("serial")
public BasicConnectionFactory<FileConnectionImpl> createConnectionFactory() throws ResourceException {
if (this.parentDirectory == null) {
throw new InvalidPropertyException(UTIL.getString("parentdirectory_not_set")); //$NON-NLS-1$
}
final Map<String, String> map = StringUtil.valueOf(this.fileMapping, Map.class);
return new BasicConnectionFactory<FileConnectionImpl>() {
@Override
public FileConnectionImpl getConnection() throws ResourceException {
return new FileConnectionImpl(parentDirectory, map, allowParentPaths);
}
};
}
示例6: createConnectionFactory
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
@Override
@SuppressWarnings("serial")
public BasicConnectionFactory<MongoDBConnectionImpl> createConnectionFactory() throws ResourceException {
if (this.remoteServerList == null) {
throw new InvalidPropertyException(UTIL.getString("no_server")); //$NON-NLS-1$
}
if (this.database == null) {
throw new InvalidPropertyException(UTIL.getString("no_database")); //$NON-NLS-1$
}
final List<ServerAddress> servers = getServers();
if (servers != null) {
//if options needed then use URL format
final MongoClientOptions options = MongoClientOptions.builder().build();
return new BasicConnectionFactory<MongoDBConnectionImpl>() {
@Override
public MongoDBConnectionImpl getConnection() throws ResourceException {
MongoCredential credential = null;
if (MongoDBManagedConnectionFactory.this.username != null && MongoDBManagedConnectionFactory.this.password != null) {
credential = MongoCredential.createMongoCRCredential(MongoDBManagedConnectionFactory.this.username, MongoDBManagedConnectionFactory.this.database, MongoDBManagedConnectionFactory.this.password.toCharArray());
}
return new MongoDBConnectionImpl(MongoDBManagedConnectionFactory.this.database, servers, credential, options);
}
};
}
// Make connection using the URI format
return new BasicConnectionFactory<MongoDBConnectionImpl>() {
@Override
public MongoDBConnectionImpl getConnection() throws ResourceException {
try {
return new MongoDBConnectionImpl(MongoDBManagedConnectionFactory.this.database, getConnectionURI());
} catch (UnknownHostException e) {
throw new ResourceException(e);
}
}
};
}
示例7: testNullSubscriptionName
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
@Test
public void testNullSubscriptionName() throws Exception {
ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter();
MyBootstrapContext ctx = new MyBootstrapContext();
qResourceAdapter.start(ctx);
ActiveMQActivationSpec spec = new ActiveMQActivationSpec();
spec.setResourceAdapter(qResourceAdapter);
spec.setUseJNDI(false);
spec.setDestination("mdbTopic");
spec.setSubscriptionDurability("Durable");
spec.setClientID("id-1");
spec.setSetupAttempts(1);
spec.setShareSubscriptions(true);
spec.setMaxSession(1);
CountDownLatch latch = new CountDownLatch(5);
DummyMessageEndpoint endpoint = new DummyMessageEndpoint(latch);
DummyMessageEndpointFactory endpointFactory = new DummyMessageEndpointFactory(endpoint, false);
try {
qResourceAdapter.endpointActivation(endpointFactory, spec);
fail();
} catch (Exception e) {
assertTrue(e instanceof InvalidPropertyException);
assertEquals("subscriptionName", ((InvalidPropertyException) e).getInvalidPropertyDescriptors()[0].getName());
}
}
示例8: parse
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
private Date parse(final String value) {
final String[] formats = {
"EEE MMM d HH:mm:ss z yyyy",
"EEE, d MMM yyyy HH:mm:ss Z",
"yyyy-MM-dd HH:mm:ss.S",
"yyyy-MM-dd HH:mm:ss.SZ",
"yyyy-MM-dd HH:mm:ss.S",
"yyyy-MM-dd HH:mm:ssZ",
"yyyy-MM-dd HH:mm:ss",
"yyyy-MM-dd HH:mmZ",
"yyyy-MM-dd HH:mm",
"yyyy-MM-dd'T'HH:mm:ss.SZ",
"yyyy-MM-dd'T'HH:mm:ss.S",
"yyyy-MM-dd'T'HH:mm:ssZ",
"yyyy-MM-dd'T'HH:mm:ss",
"yyyy-MM-dd'T'HH:mmZ",
"yyyy-MM-dd'T'HH:mm",
"yyyy-MM-dd",
"yyyyMMdd"
};
for (final String format : formats) {
final SimpleDateFormat dateFormat = new SimpleDateFormat(format);
try {
return dateFormat.parse(value);
} catch (final ParseException e) {
invalidProperty = new InvalidPropertyException("Invalid time format " + value, e);
}
}
return null;
}
示例9: validate
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
/**
* @see javax.resource.spi.ActivationSpec#validate()
*/
@Override
public void validate() throws InvalidPropertyException {
if (this.serverName == null) {
throw new InvalidPropertyException("serverName must not be null");
}
if (this.portNumber == null) {
throw new InvalidPropertyException("portNumber must not be null");
}
if (this.portNumber <= 0 || this.portNumber >= 65536) {
throw new InvalidPropertyException("Invalid portNumber " + this.portNumber);
}
}
示例10: validate
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
public void validate() throws InvalidPropertyException {
if (log.isTraceEnabled()) {
log.trace("validate " + this);
}
if (destination == null || destination.trim().equals("")) {
throw new InvalidPropertyException("destination is mandatory");
}
if (connectionFactory == null || connectionFactory.trim().equals("")) {
throw new InvalidPropertyException("connectionFactory is mandatory");
}
}
示例11: validate
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
@Override
public void validate() throws InvalidPropertyException {
}
示例12: createConnectionFactory
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
@Override
public BasicConnectionFactory<InfinispanConnectionImpl> createConnectionFactory()
throws ResourceException {
if (this.cacheTypes == null) {
throw new InvalidPropertyException(
InfinispanPlugin.Util
.getString("InfinispanManagedConnectionFactory.cacheTypeMapNotSet")); //$NON-NLS-1$
}
if (remoteServerList == null
&& configurationFileNameForLocalCache == null
&& hotrodClientPropertiesFile == null && cacheJndiName == null) {
throw new InvalidPropertyException(
InfinispanPlugin.Util
.getString("InfinispanManagedConnectionFactory.invalidServerConfiguration")); //$NON-NLS-1$
}
determineCacheType();
if (cacheType == null) {
throw new InvalidPropertyException(
InfinispanPlugin.Util
.getString("InfinispanManagedConnectionFactory.invalidServerConfiguration")); //$NON-NLS-1$
}
/*
* the cache container that will be accessing a local infinispan cache
* cannot be created at the time of the factory, because at server
* startup, the internal infinispan caches have not been created yet. So
* the container creation has to be delayed until the connection is
* requested.
*/
return new BasicConnectionFactory<InfinispanConnectionImpl>() {
private static final long serialVersionUID = 2579916624625349535L;
@Override
public InfinispanConnectionImpl getConnection()
throws ResourceException {
AbstractInfinispanManagedConnectionFactory.this.createCacheContainer();
return new InfinispanConnectionImpl(
AbstractInfinispanManagedConnectionFactory.this);
}
};
}
示例13: createConnectionFactory
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
@SuppressWarnings("serial")
@Override
public BasicConnectionFactory<WSConnectionImpl> createConnectionFactory() throws ResourceException {
if (this.endPointName == null) {
this.endPointName = WSManagedConnectionFactory.DEFAULT_LOCAL_NAME;
}
if (this.serviceName == null) {
this.serviceName = WSManagedConnectionFactory.DEFAULT_LOCAL_NAME;
}
if (this.namespaceUri == null) {
this.namespaceUri = WSManagedConnectionFactory.DEFAULT_NAMESPACE_URI;
}
this.portQName = new QName(this.namespaceUri, this.endPointName);
this.serviceQName = new QName(this.namespaceUri, this.serviceName);
if (this.wsdl != null) {
try {
this.wsdlUrl = new URL(this.wsdl);
} catch (MalformedURLException e) {
File f = new File(this.wsdl);
try {
this.wsdlUrl = f.toURI().toURL();
} catch (MalformedURLException e1) {
throw new InvalidPropertyException(e1);
}
}
}
if (this.configFile != null) {
this.bus = new SpringBusFactory().createBus(this.configFile);
JaxWsClientFactoryBean instance = new JaxWsClientFactoryBean();
if (this.wsdl == null) {
Configurer configurer = this.bus.getExtension(Configurer.class);
if (null != configurer) {
configurer.configureBean(this.portQName.toString() + ".jaxws-client.proxyFactory", instance); //$NON-NLS-1$
}
this.outInterceptors = instance.getOutInterceptors();
}
}
return new BasicConnectionFactory<WSConnectionImpl>() {
@Override
public WSConnectionImpl getConnection() throws ResourceException {
return new WSConnectionImpl(WSManagedConnectionFactory.this);
}
};
}
示例14: createConnectionFactory
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
@Override
public BasicConnectionFactory<InfinispanConnectionImpl> createConnectionFactory()
throws ResourceException {
if (protobufDefFile == null) {
throw new InvalidPropertyException(InfinispanPlugin.Util.gs(InfinispanPlugin.Event.TEIID25030));
}
if (messageMarshallers == null) {
throw new InvalidPropertyException(InfinispanPlugin.Util.gs(InfinispanPlugin.Event.TEIID25029));
}
if (messageDescriptor == null) {
throw new InvalidPropertyException(InfinispanPlugin.Util.gs(InfinispanPlugin.Event.TEIID25020));
}
if (this.cacheTypes == null) {
throw new InvalidPropertyException(InfinispanPlugin.Util.gs(InfinispanPlugin.Event.TEIID25021));
}
if (remoteServerList == null
&& hotrodClientPropertiesFile == null && cacheJndiName == null) {
throw new InvalidPropertyException(InfinispanPlugin.Util.gs(InfinispanPlugin.Event.TEIID25023));
}
determineCacheType();
if (cacheType == null) {
throw new InvalidPropertyException(InfinispanPlugin.Util.gs(InfinispanPlugin.Event.TEIID25022));
}
/*
* the creation of the cacheContainer has to be done within the
* call to get the connection so that the classloader is driven
* from the caller.
*/
return new BasicConnectionFactory<InfinispanConnectionImpl>() {
private static final long serialVersionUID = 1L;
@Override
public InfinispanConnectionImpl getConnection()
throws ResourceException {
AbstractInfinispanManagedConnectionFactory.this.createCacheContainer();
return new InfinispanConnectionImpl(AbstractInfinispanManagedConnectionFactory.this);
}
};
}
示例15: validate
import javax.resource.spi.InvalidPropertyException; //导入依赖的package包/类
@Override
public void validate() throws InvalidPropertyException {
_logger.debug("call validate");
}