use of com.sun.enterprise.deployment.web.ContextParameter in project Payara by payara.
the class WeldDeployer method isDevelopmentMode.
private boolean isDevelopmentMode(DeploymentContext context) {
boolean devMode = WeldUtils.isCDIDevModeEnabled(context) || Boolean.getBoolean(DEV_MODE_PROPERTY);
WebBundleDescriptor wDesc = context.getModuleMetaData(WebBundleDescriptor.class);
if (!devMode && wDesc != null) {
Enumeration<ContextParameter> cpEnumeration = wDesc.getContextParameters();
while (cpEnumeration.hasMoreElements()) {
ContextParameter param = cpEnumeration.nextElement();
if (DEV_MODE_PROPERTY.equals(param.getName()) && Boolean.valueOf(param.getValue())) {
devMode = true;
WeldUtils.setCDIDevMode(context, devMode);
break;
}
}
}
return devMode;
}
use of com.sun.enterprise.deployment.web.ContextParameter in project Payara by payara.
the class WebModuleContextConfig method configureResource.
protected synchronized void configureResource() throws LifecycleException {
List<ApplicationParameter> appParams = context.findApplicationParameters();
ContextParameter contextParam;
synchronized (appParams) {
Iterator<ApplicationParameter> i = appParams.iterator();
while (i.hasNext()) {
ApplicationParameter appParam = i.next();
contextParam = new EnvironmentProperty(appParam.getName(), appParam.getValue(), appParam.getDescription());
webBundleDescriptor.addContextParameter(contextParam);
}
}
ContextEnvironment[] envs = context.findEnvironments();
EnvironmentProperty envEntry;
for (int i = 0; i < envs.length; i++) {
envEntry = new EnvironmentProperty(envs[i].getName(), envs[i].getValue(), envs[i].getDescription(), envs[i].getType());
if (envs[i].getValue() != null) {
envEntry.setValue(envs[i].getValue());
}
webBundleDescriptor.addEnvironmentProperty(envEntry);
envProps.add(envEntry);
}
ContextResource[] resources = context.findResources();
ResourceReferenceDescriptor resourceReference;
Set<ResourceReferenceDescriptor> rrs = webBundleDescriptor.getResourceReferenceDescriptors();
ResourcePrincipal rp;
for (int i = 0; i < resources.length; i++) {
resourceReference = new ResourceReferenceDescriptor(resources[i].getName(), resources[i].getDescription(), resources[i].getType());
resourceReference.setJndiName(resources[i].getName());
for (ResourceReferenceDescriptor rr : rrs) {
if (resources[i].getName().equals(rr.getName())) {
resourceReference.setJndiName(rr.getJndiName());
rp = rr.getResourcePrincipal();
if (rp != null) {
resourceReference.setResourcePrincipal(new ResourcePrincipal(rp.getName(), rp.getPassword()));
}
}
}
resourceReference.setAuthorization(resources[i].getAuth());
webBundleDescriptor.addResourceReferenceDescriptor(resourceReference);
resRefs.add(resourceReference);
}
}
Aggregations