Search in sources :

Example 86 with Property

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

the class ManagedThreadFactoryManager method createConfigBean.

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

Example 87 with Property

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

the class AdminObjectManager method createConfigBean.

private AdminObjectResource createConfigBean(Resources param, Properties props) throws PropertyVetoException, TransactionFailure {
    AdminObjectResource newResource = param.createChild(AdminObjectResource.class);
    newResource.setJndiName(jndiName);
    if (description != null) {
        newResource.setDescription(description);
    }
    newResource.setResAdapter(raName);
    newResource.setResType(resType);
    newResource.setClassName(className);
    newResource.setEnabled(enabled);
    if (props != null) {
        for (Map.Entry e : props.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 : AdminObjectResource(org.glassfish.connectors.config.AdminObjectResource) HashMap(java.util.HashMap) Map(java.util.Map) Property(org.jvnet.hk2.config.types.Property)

Example 88 with Property

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

the class JavaWebStartInfo method processChangeEventIfInteresting.

private void processChangeEventIfInteresting(final PropertyChangeEvent event) throws EndpointRegistrationException {
    /*
         * If the source is of type Application or Module and the newValue is of type
         * Property then this could be a change we're interested in.
         */
    final boolean isSourceApp = event.getSource() instanceof com.sun.enterprise.config.serverbeans.Application;
    final boolean isSourceModule = event.getSource() instanceof com.sun.enterprise.config.serverbeans.Module;
    if ((!isSourceApp && !isSourceModule) || !(event.getNewValue() instanceof Property)) {
        return;
    }
    /*
         * Make sure the property name is java-web-start-enabled.
         */
    Property newPropertySetting = (Property) event.getNewValue();
    if (!newPropertySetting.getName().equals(JAVA_WEB_START_ENABLED_PROPERTY_NAME)) {
        return;
    }
    String eventSourceName;
    String thisAppOrModuleName;
    if (isSourceApp) {
        eventSourceName = ((com.sun.enterprise.config.serverbeans.Application) event.getSource()).getName();
        thisAppOrModuleName = acServerApp.registrationName();
    } else {
        eventSourceName = ((com.sun.enterprise.config.serverbeans.Module) event.getSource()).getName();
        thisAppOrModuleName = acDesc.getModuleName();
    }
    if (!thisAppOrModuleName.equals(eventSourceName)) {
        return;
    }
    /*
         * At this point we know that the event applies to this app client,
         * so return a Boolean carrying the newly-assigned value.
         */
    final Boolean newEnabledValue = Boolean.valueOf(newPropertySetting.getValue());
    final Property oldPropertySetting = (Property) event.getOldValue();
    final String oldPropertyValue = (oldPropertySetting != null) ? oldPropertySetting.getValue() : null;
    final Boolean oldEnabledValue = (oldPropertyValue == null ? Boolean.TRUE : Boolean.valueOf(oldPropertyValue));
    /*
         * Record the new value of the relevant enabled setting.
         */
    if (isSourceApp) {
        isJWSEnabledAtApp = newEnabledValue;
    } else {
        isJWSEnabledAtModule = newEnabledValue;
    }
    /*
         * Now act on the change of state.
         */
    if (!newEnabledValue.equals(oldEnabledValue)) {
        if (newEnabledValue) {
            start();
        } else {
            stop();
        }
    }
}
Also used : AppClientServerApplication(org.glassfish.appclient.server.core.AppClientServerApplication) Property(org.jvnet.hk2.config.types.Property)

Example 89 with Property

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

the class JDBCResourceManager method createConfigBean.

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

Example 90 with Property

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

the class JDBCConnectionPoolManager method createConfigBean.

private JdbcConnectionPool createConfigBean(Resources param, Properties properties) throws PropertyVetoException, TransactionFailure {
    JdbcConnectionPool newResource = param.createChild(JdbcConnectionPool.class);
    newResource.setWrapJdbcObjects(wrapJDBCObjects);
    if (validationtable != null)
        newResource.setValidationTableName(validationtable);
    newResource.setValidateAtmostOncePeriodInSeconds(validateAtmostOncePeriod);
    if (isolationlevel != null) {
        newResource.setTransactionIsolationLevel(isolationlevel);
    }
    newResource.setSteadyPoolSize(steadypoolsize);
    if (statementTimeout != null) {
        newResource.setStatementTimeoutInSeconds(statementTimeout);
    }
    if (restype != null) {
        newResource.setResType(restype);
    }
    newResource.setPoolResizeQuantity(poolresize);
    newResource.setNonTransactionalConnections(nontransactionalconnections);
    newResource.setMaxWaitTimeInMillis(maxwait);
    newResource.setMaxPoolSize(maxpoolsize);
    if (maxConnectionUsageCount != null) {
        newResource.setMaxConnectionUsageCount(maxConnectionUsageCount);
    }
    if (matchConnections != null) {
        newResource.setMatchConnections(matchConnections);
    }
    if (lazyConnectionEnlistment != null) {
        newResource.setLazyConnectionEnlistment(lazyConnectionEnlistment);
    }
    if (lazyConnectionAssociation != null) {
        newResource.setLazyConnectionAssociation(lazyConnectionAssociation);
    }
    newResource.setIsIsolationLevelGuaranteed(isisolationguaranteed);
    newResource.setIsConnectionValidationRequired(isconnectvalidatereq);
    newResource.setIdleTimeoutInSeconds(idletimeout);
    newResource.setFailAllConnections(failconnection);
    if (datasourceclassname != null) {
        newResource.setDatasourceClassname(datasourceclassname);
    }
    newResource.setConnectionValidationMethod(validationmethod);
    if (connectionLeakTimeout != null) {
        newResource.setConnectionLeakTimeoutInSeconds(connectionLeakTimeout);
    }
    if (connectionLeakReclaim != null) {
        newResource.setConnectionLeakReclaim(connectionLeakReclaim);
    }
    if (connectionCreationRetryInterval != null) {
        newResource.setConnectionCreationRetryIntervalInSeconds(connectionCreationRetryInterval);
    }
    if (connectionCreationRetryAttempts != null) {
        newResource.setConnectionCreationRetryAttempts(connectionCreationRetryAttempts);
    }
    if (associateWithThread != null) {
        newResource.setAssociateWithThread(associateWithThread);
    }
    if (allownoncomponentcallers != null) {
        newResource.setAllowNonComponentCallers(allownoncomponentcallers);
    }
    if (statementcachesize != null) {
        newResource.setStatementCacheSize(statementcachesize);
    }
    if (validationclassname != null) {
        newResource.setValidationClassname(validationclassname);
    }
    if (initsql != null) {
        newResource.setInitSql(initsql);
    }
    if (sqltracelisteners != null) {
        newResource.setSqlTraceListeners(sqltracelisteners);
    }
    if (pooling != null) {
        newResource.setPooling(pooling);
    }
    if (ping != null) {
        newResource.setPing(ping);
    }
    if (driverclassname != null) {
        newResource.setDriverClassname(driverclassname);
    }
    if (description != null) {
        newResource.setDescription(description);
    }
    newResource.setName(jdbcconnectionpoolid);
    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 : JdbcConnectionPool(org.glassfish.jdbc.config.JdbcConnectionPool) 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