use of org.jvnet.hk2.config.types.Property in project Payara by payara.
the class CustomResourceManager method createConfigBean.
private CustomResource createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
CustomResource newResource = param.createChild(CustomResource.class);
newResource.setJndiName(jndiName);
newResource.setFactoryClass(factoryClass);
newResource.setResType(resType);
newResource.setEnabled(enabled);
if (description != null) {
newResource.setDescription(description);
}
if (properties != null) {
for (Map.Entry e : properties.entrySet()) {
Property prop = newResource.createChild(Property.class);
prop.setName((String) e.getKey());
prop.setValue((String) e.getValue());
newResource.getProperty().add(prop);
}
}
return newResource;
}
use of org.jvnet.hk2.config.types.Property in project Payara by payara.
the class ResourceAdapterAdminServiceImpl method updateRAConfigInDescriptor.
/**
* Updates the connector descriptor of the connector module, with the
* contents of a resource adapter config if specified.
*
* This modified ConnectorDescriptor is then bound to JNDI so that ACC
* clients while configuring a non-system RAR could get the correct merged
* configuration. Any updates to resource-adapter config while an ACC client
* is in use is not transmitted to the client dynamically. All such changes
* would be visible on ACC client restart.
*/
private void updateRAConfigInDescriptor(ConnectorDescriptor connectorDescriptor, String moduleName) {
ResourceAdapterConfig raConfig = ConnectorRegistry.getInstance().getResourceAdapterConfig(moduleName);
List<Property> raConfigProps = null;
if (raConfig != null) {
raConfigProps = raConfig.getProperty();
}
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("current RAConfig In Descriptor " + connectorDescriptor.getConfigProperties());
}
if (raConfigProps != null) {
Set mergedProps = ConnectorDDTransformUtils.mergeProps(raConfigProps, connectorDescriptor.getConfigProperties());
Set actualProps = connectorDescriptor.getConfigProperties();
actualProps.clear();
actualProps.addAll(mergedProps);
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("updated RAConfig In Descriptor " + connectorDescriptor.getConfigProperties());
}
}
}
use of org.jvnet.hk2.config.types.Property in project Payara by payara.
the class ConnectionPoolObjectsUtils method setLazyEnlistAndLazyAssocProperties.
/**
* Validates and sets the values for LazyConnectionEnlistment and LazyConnectionAssociation.
* @param lazyAssocString Property value
* @param adminPool Config Bean
* @param conConnPool Connector Connection Pool
*/
public static void setLazyEnlistAndLazyAssocProperties(String lazyAssocString, List<Property> properties, ConnectorConnectionPool conConnPool) {
if (properties == null)
return;
Property lazyEnlistElement = null;
for (Property property : properties) {
if (property.getName().equalsIgnoreCase("LAZYCONNECTIONENLISTMENT")) {
lazyEnlistElement = property;
}
}
boolean lazyAssoc = toBoolean(lazyAssocString, false);
if (lazyEnlistElement != null) {
boolean lazyEnlist = toBoolean(lazyEnlistElement.getValue(), false);
if (lazyAssoc) {
if (lazyEnlist) {
conConnPool.setLazyConnectionAssoc(true);
conConnPool.setLazyConnectionEnlist(true);
} else {
_logger.log(Level.SEVERE, "conn_pool_obj_utils.lazy_enlist-lazy_assoc-invalid-combination", conConnPool.getName());
String i18nMsg = localStrings.getString("cpou.lazy_enlist-lazy_assoc-invalid-combination");
throw new RuntimeException(i18nMsg + conConnPool.getName());
}
} else {
conConnPool.setLazyConnectionAssoc(false);
}
} else {
if (lazyAssoc) {
conConnPool.setLazyConnectionAssoc(true);
conConnPool.setLazyConnectionEnlist(true);
} else {
conConnPool.setLazyConnectionAssoc(false);
}
}
}
use of org.jvnet.hk2.config.types.Property in project Payara by payara.
the class ResourceAdapterConfigManager method createConfigBean.
private ResourceAdapterConfig createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
ResourceAdapterConfig newResource = param.createChild(ResourceAdapterConfig.class);
newResource.setResourceAdapterName(raName);
if (threadPoolIds != null) {
newResource.setThreadPoolIds(threadPoolIds);
}
newResource.setObjectType(objectType);
if (name != null) {
newResource.setName(name);
}
if (properties != null) {
for (Map.Entry e : properties.entrySet()) {
Property prop = newResource.createChild(Property.class);
prop.setName((String) e.getKey());
prop.setValue((String) e.getValue());
newResource.getProperty().add(prop);
}
}
return newResource;
}
use of org.jvnet.hk2.config.types.Property in project Payara by payara.
the class ConnectorsUtil method isDynamicReconfigurationEnabled.
public static boolean isDynamicReconfigurationEnabled(ResourcePool pool) {
boolean enabled = false;
if (pool instanceof PropertyBag) {
PropertyBag properties = (PropertyBag) pool;
Property property = properties.getProperty(ConnectorConstants.DYNAMIC_RECONFIGURATION_FLAG);
if (property != null) {
try {
if (Long.parseLong(property.getValue()) > 0) {
enabled = true;
}
} catch (NumberFormatException nfe) {
_logger.log(Level.WARNING, "invalid.dynamic-reconfig.value", property.getValue());
}
}
}
return enabled;
}
Aggregations