Search in sources :

Example 1 with ContextParameter

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;
}
Also used : ContextParameter(com.sun.enterprise.deployment.web.ContextParameter) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor)

Example 2 with ContextParameter

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);
    }
}
Also used : ContextEnvironment(org.apache.catalina.deploy.ContextEnvironment) ApplicationParameter(org.apache.catalina.deploy.ApplicationParameter) ContextParameter(com.sun.enterprise.deployment.web.ContextParameter) ContextResource(org.apache.catalina.deploy.ContextResource)

Aggregations

ContextParameter (com.sun.enterprise.deployment.web.ContextParameter)2 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)1 ApplicationParameter (org.apache.catalina.deploy.ApplicationParameter)1 ContextEnvironment (org.apache.catalina.deploy.ContextEnvironment)1 ContextResource (org.apache.catalina.deploy.ContextResource)1