use of org.apache.catalina.deploy.ApplicationParameter in project Payara by payara.
the class StandardContext method removeApplicationParameter.
/**
* Remove the application parameter with the specified name from
* the set for this application.
*
* @param name Name of the application parameter to remove
*/
@Override
public void removeApplicationParameter(String name) {
ApplicationParameter match = null;
Iterator<ApplicationParameter> i = applicationParameters.iterator();
while (i.hasNext()) {
ApplicationParameter applicationParameter = i.next();
// Make sure this parameter is currently present
if (name.equals(applicationParameter.getName())) {
match = applicationParameter;
break;
}
}
if (match != null) {
applicationParameters.remove(match);
// Inform interested listeners
if (notifyContainerListeners) {
fireContainerEvent("removeApplicationParameter", name);
}
}
}
use of org.apache.catalina.deploy.ApplicationParameter in project Payara by payara.
the class StandardContext method addApplicationParameter.
/**
* Add a new application parameter for this application.
*
* @param parameter The new application parameter
*/
@Override
public void addApplicationParameter(ApplicationParameter parameter) {
String newName = parameter.getName();
Iterator<ApplicationParameter> i = applicationParameters.iterator();
while (i.hasNext()) {
ApplicationParameter applicationParameter = i.next();
if (newName.equals(applicationParameter.getName())) {
if (applicationParameter.getOverride()) {
applicationParameter.setValue(parameter.getValue());
}
return;
}
}
applicationParameters.add(parameter);
if (notifyContainerListeners) {
fireContainerEvent("addApplicationParameter", parameter);
}
}
use of org.apache.catalina.deploy.ApplicationParameter in project Payara by payara.
the class StandardContext method mergeParameters.
/**
* Merge the context initialization parameters specified in the application
* deployment descriptor with the application parameters described in the
* server configuration, respecting the <code>override</code> property of
* the application parameters appropriately.
*/
private void mergeParameters() {
Map<String, String> mergedParams = new HashMap<>();
for (String name : findParameters()) {
mergedParams.put(name, findParameter(name));
}
for (ApplicationParameter param : findApplicationParameters()) {
if (param.getOverride()) {
if (mergedParams.get(param.getName()) == null)
mergedParams.put(param.getName(), param.getValue());
} else {
mergedParams.put(param.getName(), param.getValue());
}
}
ServletContext sc = getServletContext();
for (Map.Entry<String, String> entry : mergedParams.entrySet()) {
sc.setInitParameter(entry.getKey(), entry.getValue());
}
}
use of org.apache.catalina.deploy.ApplicationParameter 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