use of org.jvnet.hk2.config.ConfigBean in project Payara by payara.
the class ConfigConfigSource method deleteValue.
public boolean deleteValue(String propertyName) throws TransactionFailure {
boolean result = false;
Config config = domainConfiguration.getConfigs().getConfigByName(configurationName);
if (config != null) {
for (Property object : config.getProperty()) {
if ((PROPERTY_PREFIX + propertyName).equals(object.getName())) {
ConfigSupport.deleteChild((ConfigBean) ConfigBean.unwrap(config), (ConfigBean) ConfigBean.unwrap(object));
result = true;
}
}
}
return result;
}
use of org.jvnet.hk2.config.ConfigBean in project Payara by payara.
the class SimpleDocument method make.
@Override
public ConfigBean make(final ServiceLocator habitat, XMLStreamReader xmlStreamReader, ConfigBean dom, ConfigModel configModel) {
ConfigBean configBean = new ConfigBean(habitat, this, dom, configModel, xmlStreamReader);
configBean.addInterceptor(Object.class, new OnDeleteCascade());
return configBean;
}
use of org.jvnet.hk2.config.ConfigBean in project Payara by payara.
the class ReferenceConstrainTest method doChangeToInValidPool.
@Test
public void doChangeToInValidPool() throws TransactionFailure {
Domain domain = habitat.getService(Domain.class);
// Find JdbcResource to chenge its values
Iterator<JdbcResource> iterator = domain.getResources().getResources(JdbcResource.class).iterator();
JdbcResource jdbc = null;
while (iterator.hasNext()) {
JdbcResource res = iterator.next();
if ("H2Pool".equals(res.getPoolName())) {
jdbc = res;
break;
}
}
assertNotNull(jdbc);
ConfigBean poolConfig = (ConfigBean) ConfigBean.unwrap(jdbc);
Map<ConfigBean, Map<String, String>> changes = new HashMap<ConfigBean, Map<String, String>>();
Map<String, String> configChanges = new HashMap<String, String>();
configChanges.put("pool-name", "WrongPointer");
changes.put(poolConfig, configChanges);
try {
ConfigSupport cs = getHabitat().getService(ConfigSupport.class);
cs.apply(changes);
fail("Can not reach this point");
} catch (TransactionFailure tf) {
ConstraintViolationException cv = findConstrViolation(tf);
// cv.printStackTrace(System.out);
assertNotNull(cv);
}
}
use of org.jvnet.hk2.config.ConfigBean in project Payara by payara.
the class DynamicWebServletRegistrationImpl method configureMiscSettings.
/**
* Configure miscellaneous settings such as the pool size for
* single threaded servlets, specifying a temporary directory other
* than the default etc.
*
* Since the work directory is used when configuring the session manager
* persistence settings, this method must be invoked prior to
* <code>configureSessionSettings</code>.
*
* Properties are inherited from VirtualServer and may be overridden by configuration from sun-web.xml
*/
void configureMiscSettings(final VirtualServer vs, final String contextPath) {
for (final Property prop : vs.getProperties()) {
final String name = prop.getName();
final String value = prop.getValue();
configureProperty(vs, contextPath, name, value);
}
// sen-web.xml preserved for backward compatibility
final SunWebAppImpl configBean = getIasWebAppConfigBean();
if (configBean != null && configBean.sizeWebProperty() > 0) {
for (final WebProperty webProperty : configBean.getWebProperty()) {
final String name = webProperty.getAttributeValue("name");
final String value = webProperty.getAttributeValue("value");
configureProperty(vs, contextPath, name, value);
}
}
}
use of org.jvnet.hk2.config.ConfigBean in project Payara by payara.
the class ReferenceConstrainTest method doChangeToValidPool.
// @Ignore
@Test
public void doChangeToValidPool() throws TransactionFailure {
Domain domain = habitat.getService(Domain.class);
// Find JdbcResource to chenge its values
Iterator<JdbcResource> iterator = domain.getResources().getResources(JdbcResource.class).iterator();
JdbcResource jdbc = null;
while (iterator.hasNext()) {
JdbcResource res = iterator.next();
if ("__TimerPool".equals(res.getPoolName())) {
jdbc = res;
break;
}
}
assertNotNull(jdbc);
ConfigBean poolConfig = (ConfigBean) ConfigBean.unwrap(jdbc);
Map<ConfigBean, Map<String, String>> changes = new HashMap<ConfigBean, Map<String, String>>();
Map<String, String> configChanges = new HashMap<String, String>();
configChanges.put("pool-name", "H2Pool");
changes.put(poolConfig, configChanges);
try {
ConfigSupport cs = getHabitat().getService(ConfigSupport.class);
cs.apply(changes);
} catch (TransactionFailure tf) {
fail();
}
}
Aggregations