Search in sources :

Example 31 with Module

use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.

the class ModuleConfigSource method getProperties.

@Override
public Map<String, String> getProperties() {
    Application config = domainConfiguration.getApplications().getApplication(configurationName);
    HashMap<String, String> result = new HashMap<>();
    if (config != null) {
        Module module = config.getModule(moduleName);
        if (module != null) {
            List<Property> properties = module.getProperty();
            for (Property property : properties) {
                if (property.getName().startsWith(PROPERTY_PREFIX)) {
                    result.put(property.getName().substring(PROPERTY_PREFIX.length()), property.getValue());
                }
            }
        }
    }
    return result;
}
Also used : HashMap(java.util.HashMap) Module(com.sun.enterprise.config.serverbeans.Module) Application(com.sun.enterprise.config.serverbeans.Application) Property(org.jvnet.hk2.config.types.Property)

Example 32 with Module

use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.

the class ModuleConfigSource method getValue.

@Override
public String getValue(String propertyName) {
    String result = null;
    Application app = domainConfiguration.getApplications().getApplication(configurationName);
    if (app != null) {
        Module m = app.getModule(moduleName);
        if (m != null) {
            result = m.getPropertyValue(PROPERTY_PREFIX + propertyName);
        }
    }
    return result;
}
Also used : Module(com.sun.enterprise.config.serverbeans.Module) Application(com.sun.enterprise.config.serverbeans.Application)

Example 33 with Module

use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.

the class ModuleConfigSource method setValue.

public boolean setValue(final String propertyName, final String propertyValue) throws TransactionFailure {
    boolean result = false;
    Application app = domainConfiguration.getApplications().getApplication(configurationName);
    if (app != null) {
        Module m = app.getModule(moduleName);
        if (m != null) {
            Property p = m.getProperty(PROPERTY_PREFIX + propertyName);
            if (p == null) {
                ConfigSupport.apply(new SingleConfigCode<Module>() {

                    @Override
                    public Object run(Module config) throws TransactionFailure, PropertyVetoException {
                        Property prop = config.createChild(Property.class);
                        prop.setName(PROPERTY_PREFIX + propertyName);
                        prop.setValue(propertyValue);
                        config.getProperty().add(prop);
                        return null;
                    }
                }, m);
            } else {
                ConfigSupport.apply(new SingleConfigCode<Property>() {

                    @Override
                    public Object run(Property config) throws TransactionFailure, PropertyVetoException {
                        config.setValue(propertyValue);
                        return null;
                    }
                }, p);
            }
            result = true;
        }
    }
    return result;
}
Also used : TransactionFailure(org.jvnet.hk2.config.TransactionFailure) PropertyVetoException(java.beans.PropertyVetoException) Module(com.sun.enterprise.config.serverbeans.Module) Application(com.sun.enterprise.config.serverbeans.Application) Property(org.jvnet.hk2.config.types.Property)

Example 34 with Module

use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.

the class ModuleConfigSource method deleteValue.

public boolean deleteValue(String propertyName) throws TransactionFailure {
    boolean result = false;
    Application app = domainConfiguration.getApplications().getApplication(configurationName);
    if (app != null) {
        Module m = app.getModule(moduleName);
        for (Property object : m.getProperty()) {
            if ((PROPERTY_PREFIX + propertyName).equals(object.getName())) {
                ConfigSupport.deleteChild((ConfigBean) ConfigBean.unwrap(m), (ConfigBean) ConfigBean.unwrap(object));
                result = true;
            }
        }
    }
    return result;
}
Also used : Module(com.sun.enterprise.config.serverbeans.Module) Application(com.sun.enterprise.config.serverbeans.Application) Property(org.jvnet.hk2.config.types.Property)

Example 35 with Module

use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.

the class ListComponentsCommand method getAppEngines.

private List<Engine> getAppEngines(final Application app) {
    final List<Engine> engineList = new ArrayList<Engine>();
    // first add application level engines
    engineList.addAll(app.getEngine());
    // now add module level engines
    for (Module module : app.getModule()) {
        engineList.addAll(module.getEngines());
    }
    return engineList;
}
Also used : Module(com.sun.enterprise.config.serverbeans.Module)

Aggregations

Module (com.sun.enterprise.config.serverbeans.Module)42 Application (com.sun.enterprise.config.serverbeans.Application)11 ActionReport (org.glassfish.api.ActionReport)9 PropertyVetoException (java.beans.PropertyVetoException)5 Engine (com.sun.enterprise.config.serverbeans.Engine)3 Resource (com.sun.enterprise.config.serverbeans.Resource)3 Resources (com.sun.enterprise.config.serverbeans.Resources)3 ArrayList (java.util.ArrayList)3 Property (org.jvnet.hk2.config.types.Property)3 Server (com.sun.enterprise.config.serverbeans.Server)2 ConnectorApplication (com.sun.enterprise.connectors.module.ConnectorApplication)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 ConnectorResource (org.glassfish.connectors.config.ConnectorResource)2 WorkSecurityMap (org.glassfish.connectors.config.WorkSecurityMap)2 ApplicationInfo (org.glassfish.internal.data.ApplicationInfo)2 Resource (org.glassfish.resources.api.Resource)2 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)1 RemoteRestAdminCommand (com.sun.enterprise.admin.remote.RemoteRestAdminCommand)1 ServerRemoteRestAdminCommand (com.sun.enterprise.admin.remote.ServerRemoteRestAdminCommand)1