use of org.jvnet.hk2.config.types.Property in project Payara by payara.
the class ConnectorConnectionPoolDeployer method deployResource.
/**
* {@inheritDoc}
*/
public void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("ConnectorConnectionPoolDeployer : deployResource ");
}
final org.glassfish.connectors.config.ConnectorConnectionPool domainCcp = (org.glassfish.connectors.config.ConnectorConnectionPool) resource;
// redirect call to redeployResource
if (ConnectionPoolObjectsUtils.isPoolSystemPool(domainCcp)) {
this.redeployResource(resource);
return;
}
PoolInfo poolInfo = new PoolInfo(domainCcp.getName(), applicationName, moduleName);
final ConnectorConnectionPool ccp = getConnectorConnectionPool(domainCcp, poolInfo);
String rarName = domainCcp.getResourceAdapterName();
String connDefName = domainCcp.getConnectionDefinitionName();
List<Property> props = domainCcp.getProperty();
List<SecurityMap> securityMaps = domainCcp.getSecurityMap();
populateConnectorConnectionPool(ccp, connDefName, rarName, props, securityMaps);
final String defName = domainCcp.getConnectionDefinitionName();
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "Calling backend to add connectorConnectionPool", domainCcp.getResourceAdapterName());
}
runtime.createConnectorConnectionPool(ccp, defName, domainCcp.getResourceAdapterName(), domainCcp.getProperty(), domainCcp.getSecurityMap());
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "Added connectorConnectionPool in backend", domainCcp.getResourceAdapterName());
}
}
use of org.jvnet.hk2.config.types.Property in project Payara by payara.
the class ConnectorsRecoveryResourceHandler method getdbUserPasswordOfConnectorConnectionPool.
private String[] getdbUserPasswordOfConnectorConnectionPool(ConnectorConnectionPool connectorConnectionPool) {
String[] userPassword = new String[2];
userPassword[0] = null;
userPassword[1] = null;
List<Property> properties = connectorConnectionPool.getProperty();
if (properties != null) {
boolean foundUserPassword = false;
for (Property elementProperty : properties) {
String prop = elementProperty.getName().toUpperCase(locale);
if ("USERNAME".equals(prop) || "USER".equals(prop)) {
userPassword[0] = elementProperty.getValue();
foundUserPassword = true;
} else if ("PASSWORD".equals(prop)) {
userPassword[1] = elementProperty.getValue();
foundUserPassword = true;
}
}
if (foundUserPassword == true) {
return userPassword;
}
}
PoolInfo poolInfo = ConnectorsUtil.getPoolInfo(connectorConnectionPool);
String rarName = connectorConnectionPool.getResourceAdapterName();
String connectionDefName = connectorConnectionPool.getConnectionDefinitionName();
ConnectorRegistry connectorRegistry = ConnectorRegistry.getInstance();
ConnectorDescriptor connectorDescriptor = connectorRegistry.getDescriptor(rarName);
ConnectionDefDescriptor cdd = connectorDescriptor.getConnectionDefinitionByCFType(connectionDefName);
Set configProps = cdd.getConfigProperties();
for (Iterator iter = configProps.iterator(); iter.hasNext(); ) {
ConnectorConfigProperty envProp = (ConnectorConfigProperty) iter.next();
String prop = envProp.getName().toUpperCase(locale);
if ("USER".equals(prop) || "USERNAME".equals(prop)) {
userPassword[0] = envProp.getValue();
} else if ("PASSWORD".equals(prop)) {
userPassword[1] = envProp.getValue();
}
}
if (userPassword[0] != null && !"".equals(userPassword[0].trim())) {
return userPassword;
}
// else read the default username and password from the ra.xml
ManagedConnectionFactory mcf = connectorRegistry.getManagedConnectionFactory(poolInfo);
userPassword[0] = ConnectionPoolObjectsUtils.getValueFromMCF("UserName", poolInfo, mcf);
userPassword[1] = ConnectionPoolObjectsUtils.getValueFromMCF("Password", poolInfo, mcf);
return userPassword;
}
use of org.jvnet.hk2.config.types.Property in project Payara by payara.
the class WebContainerStarter method isStartNeeded.
/*
* @return true if the given HttpService contains any configuration
* that can be handled only by the web container and therefore requires
* the web container to be started, false otherwise
*/
private boolean isStartNeeded(HttpService httpService) {
if (httpService == null) {
return false;
}
if (ConfigBeansUtilities.toBoolean(httpService.getAccessLoggingEnabled()) || ConfigBeansUtilities.toBoolean(httpService.getSsoEnabled())) {
return true;
}
List<Property> props = httpService.getProperty();
if (props != null) {
for (Property prop : props) {
String propName = prop.getName();
String propValue = prop.getValue();
if (AUTH_PASSTHROUGH_ENABLED_PROP.equals(propName)) {
if (ConfigBeansUtilities.toBoolean(propValue)) {
return true;
}
} else if (PROXY_HANDLER_PROP.equals(propName)) {
return true;
} else if (TRACE_ENABLED_PROP.equals(propName)) {
if (!ConfigBeansUtilities.toBoolean(propValue)) {
return true;
}
}
}
}
List<VirtualServer> hosts = httpService.getVirtualServer();
if (hosts != null) {
for (VirtualServer host : hosts) {
if (isStartNeeded(host)) {
return true;
}
}
}
return false;
}
use of org.jvnet.hk2.config.types.Property in project Payara by payara.
the class ContextServiceManager method createConfigBean.
private ContextService createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
ContextService contextService = param.createChild(ContextService.class);
contextService.setJndiName(jndiName);
if (description != null) {
contextService.setDescription(description);
}
contextService.setContextInfoEnabled(contextInfoEnabled);
contextService.setContextInfo(contextInfo);
contextService.setEnabled(enabled);
if (properties != null) {
for (Map.Entry e : properties.entrySet()) {
Property prop = contextService.createChild(Property.class);
prop.setName((String) e.getKey());
prop.setValue((String) e.getValue());
contextService.getProperty().add(prop);
}
}
return contextService;
}
use of org.jvnet.hk2.config.types.Property in project Payara by payara.
the class ManagedExecutorServiceBaseManager method setAttributesOnConfigBean.
protected void setAttributesOnConfigBean(ManagedExecutorServiceBase managedExecutorService, Properties properties) throws PropertyVetoException, TransactionFailure {
managedExecutorService.setJndiName(jndiName);
if (description != null) {
managedExecutorService.setDescription(description);
}
managedExecutorService.setContextInfoEnabled(contextInfoEnabled);
managedExecutorService.setContextInfo(contextInfo);
managedExecutorService.setThreadPriority(threadPriority);
managedExecutorService.setHungAfterSeconds(hungAfterSeconds);
managedExecutorService.setCorePoolSize(corePoolSize);
managedExecutorService.setKeepAliveSeconds(keepAliveSeconds);
managedExecutorService.setThreadLifetimeSeconds(threadLifetimeSeconds);
managedExecutorService.setEnabled(enabled);
// Fix for GLASSFISH-21251
managedExecutorService.setLongRunningTasks(longRunningTasks);
// end of fix GLASSFISH-21251
if (properties != null) {
for (Map.Entry e : properties.entrySet()) {
Property prop = managedExecutorService.createChild(Property.class);
prop.setName((String) e.getKey());
prop.setValue((String) e.getValue());
managedExecutorService.getProperty().add(prop);
}
}
}
Aggregations