use of org.jvnet.hk2.config.ConfigModel.Property in project Payara by payara.
the class ManagedThreadFactoryManager method createConfigBean.
private ManagedThreadFactory createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
ManagedThreadFactory managedThreadFactory = param.createChild(ManagedThreadFactory.class);
managedThreadFactory.setJndiName(jndiName);
if (description != null) {
managedThreadFactory.setDescription(description);
}
managedThreadFactory.setContextInfoEnabled(contextInfoEnabled);
managedThreadFactory.setContextInfo(contextInfo);
managedThreadFactory.setThreadPriority(threadPriority);
managedThreadFactory.setEnabled(enabled);
if (properties != null) {
for (Map.Entry e : properties.entrySet()) {
Property prop = managedThreadFactory.createChild(Property.class);
prop.setName((String) e.getKey());
prop.setValue((String) e.getValue());
managedThreadFactory.getProperty().add(prop);
}
}
return managedThreadFactory;
}
use of org.jvnet.hk2.config.ConfigModel.Property in project Payara by payara.
the class AdminObjectManager method createConfigBean.
private AdminObjectResource createConfigBean(Resources param, Properties props) throws PropertyVetoException, TransactionFailure {
AdminObjectResource newResource = param.createChild(AdminObjectResource.class);
newResource.setJndiName(jndiName);
if (description != null) {
newResource.setDescription(description);
}
newResource.setResAdapter(raName);
newResource.setResType(resType);
newResource.setClassName(className);
newResource.setEnabled(enabled);
if (props != null) {
for (Map.Entry e : props.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.ConfigModel.Property in project Payara by payara.
the class JavaWebStartInfo method processChangeEventIfInteresting.
private void processChangeEventIfInteresting(final PropertyChangeEvent event) throws EndpointRegistrationException {
/*
* If the source is of type Application or Module and the newValue is of type
* Property then this could be a change we're interested in.
*/
final boolean isSourceApp = event.getSource() instanceof com.sun.enterprise.config.serverbeans.Application;
final boolean isSourceModule = event.getSource() instanceof com.sun.enterprise.config.serverbeans.Module;
if ((!isSourceApp && !isSourceModule) || !(event.getNewValue() instanceof Property)) {
return;
}
/*
* Make sure the property name is java-web-start-enabled.
*/
Property newPropertySetting = (Property) event.getNewValue();
if (!newPropertySetting.getName().equals(JAVA_WEB_START_ENABLED_PROPERTY_NAME)) {
return;
}
String eventSourceName;
String thisAppOrModuleName;
if (isSourceApp) {
eventSourceName = ((com.sun.enterprise.config.serverbeans.Application) event.getSource()).getName();
thisAppOrModuleName = acServerApp.registrationName();
} else {
eventSourceName = ((com.sun.enterprise.config.serverbeans.Module) event.getSource()).getName();
thisAppOrModuleName = acDesc.getModuleName();
}
if (!thisAppOrModuleName.equals(eventSourceName)) {
return;
}
/*
* At this point we know that the event applies to this app client,
* so return a Boolean carrying the newly-assigned value.
*/
final Boolean newEnabledValue = Boolean.valueOf(newPropertySetting.getValue());
final Property oldPropertySetting = (Property) event.getOldValue();
final String oldPropertyValue = (oldPropertySetting != null) ? oldPropertySetting.getValue() : null;
final Boolean oldEnabledValue = (oldPropertyValue == null ? Boolean.TRUE : Boolean.valueOf(oldPropertyValue));
/*
* Record the new value of the relevant enabled setting.
*/
if (isSourceApp) {
isJWSEnabledAtApp = newEnabledValue;
} else {
isJWSEnabledAtModule = newEnabledValue;
}
/*
* Now act on the change of state.
*/
if (!newEnabledValue.equals(oldEnabledValue)) {
if (newEnabledValue) {
start();
} else {
stop();
}
}
}
use of org.jvnet.hk2.config.ConfigModel.Property in project Payara by payara.
the class JDBCResourceManager method createConfigBean.
private JdbcResource createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
JdbcResource jdbcResource = param.createChild(JdbcResource.class);
jdbcResource.setJndiName(jndiName);
if (description != null) {
jdbcResource.setDescription(description);
}
jdbcResource.setPoolName(poolName);
jdbcResource.setEnabled(enabled);
if (properties != null) {
for (Map.Entry e : properties.entrySet()) {
Property prop = jdbcResource.createChild(Property.class);
prop.setName((String) e.getKey());
prop.setValue((String) e.getValue());
jdbcResource.getProperty().add(prop);
}
}
return jdbcResource;
}
use of org.jvnet.hk2.config.ConfigModel.Property in project Payara by payara.
the class JDBCConnectionPoolManager method createConfigBean.
private JdbcConnectionPool createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
JdbcConnectionPool newResource = param.createChild(JdbcConnectionPool.class);
newResource.setWrapJdbcObjects(wrapJDBCObjects);
if (validationtable != null)
newResource.setValidationTableName(validationtable);
newResource.setValidateAtmostOncePeriodInSeconds(validateAtmostOncePeriod);
if (isolationlevel != null) {
newResource.setTransactionIsolationLevel(isolationlevel);
}
newResource.setSteadyPoolSize(steadypoolsize);
if (statementTimeout != null) {
newResource.setStatementTimeoutInSeconds(statementTimeout);
}
if (restype != null) {
newResource.setResType(restype);
}
newResource.setPoolResizeQuantity(poolresize);
newResource.setNonTransactionalConnections(nontransactionalconnections);
newResource.setMaxWaitTimeInMillis(maxwait);
newResource.setMaxPoolSize(maxpoolsize);
if (maxConnectionUsageCount != null) {
newResource.setMaxConnectionUsageCount(maxConnectionUsageCount);
}
if (matchConnections != null) {
newResource.setMatchConnections(matchConnections);
}
if (lazyConnectionEnlistment != null) {
newResource.setLazyConnectionEnlistment(lazyConnectionEnlistment);
}
if (lazyConnectionAssociation != null) {
newResource.setLazyConnectionAssociation(lazyConnectionAssociation);
}
newResource.setIsIsolationLevelGuaranteed(isisolationguaranteed);
newResource.setIsConnectionValidationRequired(isconnectvalidatereq);
newResource.setIdleTimeoutInSeconds(idletimeout);
newResource.setFailAllConnections(failconnection);
if (datasourceclassname != null) {
newResource.setDatasourceClassname(datasourceclassname);
}
newResource.setConnectionValidationMethod(validationmethod);
if (connectionLeakTimeout != null) {
newResource.setConnectionLeakTimeoutInSeconds(connectionLeakTimeout);
}
if (connectionLeakReclaim != null) {
newResource.setConnectionLeakReclaim(connectionLeakReclaim);
}
if (connectionCreationRetryInterval != null) {
newResource.setConnectionCreationRetryIntervalInSeconds(connectionCreationRetryInterval);
}
if (connectionCreationRetryAttempts != null) {
newResource.setConnectionCreationRetryAttempts(connectionCreationRetryAttempts);
}
if (associateWithThread != null) {
newResource.setAssociateWithThread(associateWithThread);
}
if (allownoncomponentcallers != null) {
newResource.setAllowNonComponentCallers(allownoncomponentcallers);
}
if (statementcachesize != null) {
newResource.setStatementCacheSize(statementcachesize);
}
if (validationclassname != null) {
newResource.setValidationClassname(validationclassname);
}
if (initsql != null) {
newResource.setInitSql(initsql);
}
if (sqltracelisteners != null) {
newResource.setSqlTraceListeners(sqltracelisteners);
}
if (pooling != null) {
newResource.setPooling(pooling);
}
if (ping != null) {
newResource.setPing(ping);
}
if (driverclassname != null) {
newResource.setDriverClassname(driverclassname);
}
if (description != null) {
newResource.setDescription(description);
}
newResource.setName(jdbcconnectionpoolid);
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;
}
Aggregations