Search in sources :

Example 81 with Property

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

the class ConnectorConnectionPoolDeployer method deployResource.

/**
 * {@inheritDoc}
 */
public void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
    if (_logger.isLoggable(Level.FINE)) {
        _logger.fine("ConnectorConnectionPoolDeployer : deployResource ");
    }
    final org.glassfish.connectors.config.ConnectorConnectionPool domainCcp = (org.glassfish.connectors.config.ConnectorConnectionPool) resource;
    // redirect call to redeployResource
    if (ConnectionPoolObjectsUtils.isPoolSystemPool(domainCcp)) {
        this.redeployResource(resource);
        return;
    }
    PoolInfo poolInfo = new PoolInfo(domainCcp.getName(), applicationName, moduleName);
    final ConnectorConnectionPool ccp = getConnectorConnectionPool(domainCcp, poolInfo);
    String rarName = domainCcp.getResourceAdapterName();
    String connDefName = domainCcp.getConnectionDefinitionName();
    List<Property> props = domainCcp.getProperty();
    List<SecurityMap> securityMaps = domainCcp.getSecurityMap();
    populateConnectorConnectionPool(ccp, connDefName, rarName, props, securityMaps);
    final String defName = domainCcp.getConnectionDefinitionName();
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, "Calling backend to add connectorConnectionPool", domainCcp.getResourceAdapterName());
    }
    runtime.createConnectorConnectionPool(ccp, defName, domainCcp.getResourceAdapterName(), domainCcp.getProperty(), domainCcp.getSecurityMap());
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, "Added connectorConnectionPool in backend", domainCcp.getResourceAdapterName());
    }
}
Also used : ConnectorConnectionPool(com.sun.enterprise.connectors.ConnectorConnectionPool) SecurityMap(org.glassfish.connectors.config.SecurityMap) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty) Property(org.jvnet.hk2.config.types.Property)

Example 82 with Property

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

the class ConnectorsRecoveryResourceHandler method getdbUserPasswordOfConnectorConnectionPool.

private String[] getdbUserPasswordOfConnectorConnectionPool(ConnectorConnectionPool connectorConnectionPool) {
    String[] userPassword = new String[2];
    userPassword[0] = null;
    userPassword[1] = null;
    List<Property> properties = connectorConnectionPool.getProperty();
    if (properties != null) {
        boolean foundUserPassword = false;
        for (Property elementProperty : properties) {
            String prop = elementProperty.getName().toUpperCase(locale);
            if ("USERNAME".equals(prop) || "USER".equals(prop)) {
                userPassword[0] = elementProperty.getValue();
                foundUserPassword = true;
            } else if ("PASSWORD".equals(prop)) {
                userPassword[1] = elementProperty.getValue();
                foundUserPassword = true;
            }
        }
        if (foundUserPassword == true) {
            return userPassword;
        }
    }
    PoolInfo poolInfo = ConnectorsUtil.getPoolInfo(connectorConnectionPool);
    String rarName = connectorConnectionPool.getResourceAdapterName();
    String connectionDefName = connectorConnectionPool.getConnectionDefinitionName();
    ConnectorRegistry connectorRegistry = ConnectorRegistry.getInstance();
    ConnectorDescriptor connectorDescriptor = connectorRegistry.getDescriptor(rarName);
    ConnectionDefDescriptor cdd = connectorDescriptor.getConnectionDefinitionByCFType(connectionDefName);
    Set configProps = cdd.getConfigProperties();
    for (Iterator iter = configProps.iterator(); iter.hasNext(); ) {
        ConnectorConfigProperty envProp = (ConnectorConfigProperty) iter.next();
        String prop = envProp.getName().toUpperCase(locale);
        if ("USER".equals(prop) || "USERNAME".equals(prop)) {
            userPassword[0] = envProp.getValue();
        } else if ("PASSWORD".equals(prop)) {
            userPassword[1] = envProp.getValue();
        }
    }
    if (userPassword[0] != null && !"".equals(userPassword[0].trim())) {
        return userPassword;
    }
    // else read the default username and password from the ra.xml
    ManagedConnectionFactory mcf = connectorRegistry.getManagedConnectionFactory(poolInfo);
    userPassword[0] = ConnectionPoolObjectsUtils.getValueFromMCF("UserName", poolInfo, mcf);
    userPassword[1] = ConnectionPoolObjectsUtils.getValueFromMCF("Password", poolInfo, mcf);
    return userPassword;
}
Also used : ConnectionDefDescriptor(com.sun.enterprise.deployment.ConnectionDefDescriptor) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty) ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) ManagedConnectionFactory(javax.resource.spi.ManagedConnectionFactory) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) ConnectorRegistry(com.sun.enterprise.connectors.ConnectorRegistry) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty) Property(org.jvnet.hk2.config.types.Property)

Example 83 with Property

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

the class WebContainerStarter method isStartNeeded.

/*
     * @return true if the given HttpService contains any configuration
     * that can be handled only by the web container and therefore requires
     * the web container to be started, false otherwise
     */
private boolean isStartNeeded(HttpService httpService) {
    if (httpService == null) {
        return false;
    }
    if (ConfigBeansUtilities.toBoolean(httpService.getAccessLoggingEnabled()) || ConfigBeansUtilities.toBoolean(httpService.getSsoEnabled())) {
        return true;
    }
    List<Property> props = httpService.getProperty();
    if (props != null) {
        for (Property prop : props) {
            String propName = prop.getName();
            String propValue = prop.getValue();
            if (AUTH_PASSTHROUGH_ENABLED_PROP.equals(propName)) {
                if (ConfigBeansUtilities.toBoolean(propValue)) {
                    return true;
                }
            } else if (PROXY_HANDLER_PROP.equals(propName)) {
                return true;
            } else if (TRACE_ENABLED_PROP.equals(propName)) {
                if (!ConfigBeansUtilities.toBoolean(propValue)) {
                    return true;
                }
            }
        }
    }
    List<VirtualServer> hosts = httpService.getVirtualServer();
    if (hosts != null) {
        for (VirtualServer host : hosts) {
            if (isStartNeeded(host)) {
                return true;
            }
        }
    }
    return false;
}
Also used : Property(org.jvnet.hk2.config.types.Property) VirtualServer(com.sun.enterprise.config.serverbeans.VirtualServer)

Example 84 with Property

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

the class ContextServiceManager method createConfigBean.

private ContextService createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
    ContextService contextService = param.createChild(ContextService.class);
    contextService.setJndiName(jndiName);
    if (description != null) {
        contextService.setDescription(description);
    }
    contextService.setContextInfoEnabled(contextInfoEnabled);
    contextService.setContextInfo(contextInfo);
    contextService.setEnabled(enabled);
    if (properties != null) {
        for (Map.Entry e : properties.entrySet()) {
            Property prop = contextService.createChild(Property.class);
            prop.setName((String) e.getKey());
            prop.setValue((String) e.getValue());
            contextService.getProperty().add(prop);
        }
    }
    return contextService;
}
Also used : ContextService(org.glassfish.concurrent.config.ContextService) HashMap(java.util.HashMap) Map(java.util.Map) Property(org.jvnet.hk2.config.types.Property)

Example 85 with Property

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

the class ManagedExecutorServiceBaseManager method setAttributesOnConfigBean.

protected void setAttributesOnConfigBean(ManagedExecutorServiceBase managedExecutorService, Properties properties) throws PropertyVetoException, TransactionFailure {
    managedExecutorService.setJndiName(jndiName);
    if (description != null) {
        managedExecutorService.setDescription(description);
    }
    managedExecutorService.setContextInfoEnabled(contextInfoEnabled);
    managedExecutorService.setContextInfo(contextInfo);
    managedExecutorService.setThreadPriority(threadPriority);
    managedExecutorService.setHungAfterSeconds(hungAfterSeconds);
    managedExecutorService.setCorePoolSize(corePoolSize);
    managedExecutorService.setKeepAliveSeconds(keepAliveSeconds);
    managedExecutorService.setThreadLifetimeSeconds(threadLifetimeSeconds);
    managedExecutorService.setEnabled(enabled);
    // Fix for GLASSFISH-21251
    managedExecutorService.setLongRunningTasks(longRunningTasks);
    // end of fix GLASSFISH-21251
    if (properties != null) {
        for (Map.Entry e : properties.entrySet()) {
            Property prop = managedExecutorService.createChild(Property.class);
            prop.setName((String) e.getKey());
            prop.setValue((String) e.getValue());
            managedExecutorService.getProperty().add(prop);
        }
    }
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) Property(org.jvnet.hk2.config.types.Property)

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