Search in sources :

Example 21 with Property

use of org.jvnet.hk2.config.ConfigModel.Property in project Payara by payara.

the class CustomResourceManager method createConfigBean.

private CustomResource createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
    CustomResource newResource = param.createChild(CustomResource.class);
    newResource.setJndiName(jndiName);
    newResource.setFactoryClass(factoryClass);
    newResource.setResType(resType);
    newResource.setEnabled(enabled);
    if (description != null) {
        newResource.setDescription(description);
    }
    if (properties != null) {
        for (Map.Entry e : properties.entrySet()) {
            Property prop = newResource.createChild(Property.class);
            prop.setName((String) e.getKey());
            prop.setValue((String) e.getValue());
            newResource.getProperty().add(prop);
        }
    }
    return newResource;
}
Also used : CustomResource(org.glassfish.resources.config.CustomResource) HashMap(java.util.HashMap) Map(java.util.Map) Property(org.jvnet.hk2.config.types.Property)

Example 22 with Property

use of org.jvnet.hk2.config.ConfigModel.Property in project Payara by payara.

the class ResourceAdapterAdminServiceImpl method updateRAConfigInDescriptor.

/**
 * Updates the connector descriptor of the connector module, with the
 * contents of a resource adapter config if specified.
 *
 * This modified ConnectorDescriptor is then bound to JNDI so that ACC
 * clients while configuring a non-system RAR could get the correct merged
 * configuration. Any updates to resource-adapter config while an ACC client
 * is in use is not transmitted to the client dynamically. All such changes
 * would be visible on ACC client restart.
 */
private void updateRAConfigInDescriptor(ConnectorDescriptor connectorDescriptor, String moduleName) {
    ResourceAdapterConfig raConfig = ConnectorRegistry.getInstance().getResourceAdapterConfig(moduleName);
    List<Property> raConfigProps = null;
    if (raConfig != null) {
        raConfigProps = raConfig.getProperty();
    }
    if (_logger.isLoggable(Level.FINE)) {
        _logger.fine("current RAConfig In Descriptor " + connectorDescriptor.getConfigProperties());
    }
    if (raConfigProps != null) {
        Set mergedProps = ConnectorDDTransformUtils.mergeProps(raConfigProps, connectorDescriptor.getConfigProperties());
        Set actualProps = connectorDescriptor.getConfigProperties();
        actualProps.clear();
        actualProps.addAll(mergedProps);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("updated RAConfig In Descriptor " + connectorDescriptor.getConfigProperties());
        }
    }
}
Also used : ResourceAdapterConfig(org.glassfish.connectors.config.ResourceAdapterConfig) Property(org.jvnet.hk2.config.types.Property)

Example 23 with Property

use of org.jvnet.hk2.config.ConfigModel.Property in project Payara by payara.

the class ConnectionPoolObjectsUtils method setLazyEnlistAndLazyAssocProperties.

/**
 * Validates and sets the values for LazyConnectionEnlistment and LazyConnectionAssociation.
 * @param lazyAssocString Property value
 * @param adminPool  Config Bean
 * @param conConnPool Connector Connection Pool
 */
public static void setLazyEnlistAndLazyAssocProperties(String lazyAssocString, List<Property> properties, ConnectorConnectionPool conConnPool) {
    if (properties == null)
        return;
    Property lazyEnlistElement = null;
    for (Property property : properties) {
        if (property.getName().equalsIgnoreCase("LAZYCONNECTIONENLISTMENT")) {
            lazyEnlistElement = property;
        }
    }
    boolean lazyAssoc = toBoolean(lazyAssocString, false);
    if (lazyEnlistElement != null) {
        boolean lazyEnlist = toBoolean(lazyEnlistElement.getValue(), false);
        if (lazyAssoc) {
            if (lazyEnlist) {
                conConnPool.setLazyConnectionAssoc(true);
                conConnPool.setLazyConnectionEnlist(true);
            } else {
                _logger.log(Level.SEVERE, "conn_pool_obj_utils.lazy_enlist-lazy_assoc-invalid-combination", conConnPool.getName());
                String i18nMsg = localStrings.getString("cpou.lazy_enlist-lazy_assoc-invalid-combination");
                throw new RuntimeException(i18nMsg + conConnPool.getName());
            }
        } else {
            conConnPool.setLazyConnectionAssoc(false);
        }
    } else {
        if (lazyAssoc) {
            conConnPool.setLazyConnectionAssoc(true);
            conConnPool.setLazyConnectionEnlist(true);
        } else {
            conConnPool.setLazyConnectionAssoc(false);
        }
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) Property(org.jvnet.hk2.config.types.Property)

Example 24 with Property

use of org.jvnet.hk2.config.ConfigModel.Property in project Payara by payara.

the class ResourceAdapterConfigManager method createConfigBean.

private ResourceAdapterConfig createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
    ResourceAdapterConfig newResource = param.createChild(ResourceAdapterConfig.class);
    newResource.setResourceAdapterName(raName);
    if (threadPoolIds != null) {
        newResource.setThreadPoolIds(threadPoolIds);
    }
    newResource.setObjectType(objectType);
    if (name != null) {
        newResource.setName(name);
    }
    if (properties != null) {
        for (Map.Entry e : properties.entrySet()) {
            Property prop = newResource.createChild(Property.class);
            prop.setName((String) e.getKey());
            prop.setValue((String) e.getValue());
            newResource.getProperty().add(prop);
        }
    }
    return newResource;
}
Also used : ResourceAdapterConfig(org.glassfish.connectors.config.ResourceAdapterConfig) HashMap(java.util.HashMap) Map(java.util.Map) Property(org.jvnet.hk2.config.types.Property)

Example 25 with Property

use of org.jvnet.hk2.config.ConfigModel.Property in project Payara by payara.

the class ConnectorsUtil method isDynamicReconfigurationEnabled.

public static boolean isDynamicReconfigurationEnabled(ResourcePool pool) {
    boolean enabled = false;
    if (pool instanceof PropertyBag) {
        PropertyBag properties = (PropertyBag) pool;
        Property property = properties.getProperty(ConnectorConstants.DYNAMIC_RECONFIGURATION_FLAG);
        if (property != null) {
            try {
                if (Long.parseLong(property.getValue()) > 0) {
                    enabled = true;
                }
            } catch (NumberFormatException nfe) {
                _logger.log(Level.WARNING, "invalid.dynamic-reconfig.value", property.getValue());
            }
        }
    }
    return enabled;
}
Also used : PropertyBag(org.jvnet.hk2.config.types.PropertyBag) Property(org.jvnet.hk2.config.types.Property) EnvironmentProperty(com.sun.enterprise.deployment.EnvironmentProperty)

Aggregations

Property (org.jvnet.hk2.config.types.Property)149 PropertyVetoException (java.beans.PropertyVetoException)30 HashMap (java.util.HashMap)27 Properties (java.util.Properties)22 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)22 ArrayList (java.util.ArrayList)18 ActionReport (org.glassfish.api.ActionReport)17 Map (java.util.Map)15 File (java.io.File)13 ConnectorConfigProperty (com.sun.enterprise.deployment.ConnectorConfigProperty)12 Config (com.sun.enterprise.config.serverbeans.Config)11 List (java.util.List)11 AuthRealm (com.sun.enterprise.config.serverbeans.AuthRealm)10 HttpService (com.sun.enterprise.config.serverbeans.HttpService)9 NoSuchRealmException (com.sun.enterprise.security.auth.realm.NoSuchRealmException)9 Server (com.sun.enterprise.config.serverbeans.Server)8 SystemProperty (com.sun.enterprise.config.serverbeans.SystemProperty)8 VirtualServer (com.sun.enterprise.config.serverbeans.VirtualServer)8 Application (com.sun.enterprise.config.serverbeans.Application)7 EnvironmentProperty (com.sun.enterprise.deployment.EnvironmentProperty)7