Package org.jvnet.hk2.config.types

Examples of org.jvnet.hk2.config.types.Property


    private void createProviderConfigProperty(ProviderConfig pc) throws PropertyVetoException {
        while (!(parser.getEventType() == END_ELEMENT && parser.getLocalName().equals("provider-config"))) {
            try {
                if (parser.next() == START_ELEMENT) {
                    if (parser.getLocalName().equals("property") && pc != null) {
                        Property p = pc.createChild(Property.class);
                        pc.getProperty().add(p);
                        createProperty(p);
                    }
                }
            } catch (TransactionFailure ex) {
View Full Code Here


                    param.setDbUrl(dburl);

                    if(props != null)
                    {
                       for (Map.Entry e: props.entrySet()){
                        Property prop = param.createChild(Property.class);
                        prop.setName((String)e.getKey());
                        prop.setValue((String)e.getValue());
                        param.getProperty().add(prop);
                        }
                    }
                    return param;
                  }
View Full Code Here

            @Override
            public Object run(HttpService param) {
                final List<Property> propertyList = new ArrayList<Property>(param.getProperty());
                final Iterator<Property> it = propertyList.iterator();
                while (it.hasNext()) {
                    final Property property = it.next();
                    if ("accessLoggingEnabled".equals(property.getName())) {
                        param.setAccessLoggingEnabled(property.getValue());
                        it.remove();
                    } else if ("accessLogBufferSize".equals(property.getName())) {
                        param.getAccessLog().setBufferSizeBytes(property.getValue());
                        it.remove();
                    } else if ("accessLogWriterInterval".equals(property.getName())) {
                        param.getAccessLog().setWriteIntervalSeconds(property.getValue());
                        it.remove();
                    } else if ("sso-enabled".equals(property.getName())) {
                        param.setSsoEnabled(property.getValue());
                        it.remove();
                    }
                }
                param.getProperty().clear();
                param.getProperty().addAll(propertyList);
View Full Code Here

                    }
                    param.setHttpListeners(null);
                    final List<Property> propertyList = new ArrayList<Property>(param.getProperty());
                    final Iterator<Property> it = propertyList.iterator();
                    while (it.hasNext()) {
                        final Property property = it.next();
                        if ("docroot".equals(property.getName())) {
                            param.setDocroot(property.getValue());
                            it.remove();
                        } else if ("accesslog".equals(property.getName())) {
                            param.setAccessLog(property.getValue());
                            it.remove();
                        } else if ("sso-enabled".equals(property.getName())) {
                            param.setSsoEnabled(property.getValue());
                            it.remove();
                        }
                    }
                    param.getProperty().clear();
                    param.getProperty().addAll(propertyList);
View Full Code Here

    public boolean isValid(final AuthRealm realm,
        final ConstraintValidatorContext constraintValidatorContext) {

        if (realm.getClassname().equals(FILE_REALM)) {
            Property jaas_context = realm.getProperty("jaas-context");
            Property file = realm.getProperty("file");

            if (jaas_context == null || jaas_context.getName().equals(""))
                return false;

            if (file == null || file.getName().equals(""))
                return false;
        }
       
        return true;
    }
View Full Code Here

                    throw new TransactionFailure(localStrings.getLocalString(
                            "noSuchConfig", "Configuration {0} does not exist.", configRef));
                }
            }

            Property gmsListenerPort = instance.getProperty("GMS_LISTENER_PORT");
            boolean needToAddGmsListenerPort = false;
            if (gmsListenerPort == null) {
                needToAddGmsListenerPort = true;
                gmsListenerPort = instance.createChild(Property.class);
                gmsListenerPort.setName("GMS_LISTENER_PORT");
                gmsListenerPort.setValue(String.format("${GMS_LISTENER_PORT-%s}", instanceName));
                // do not add gmsListenerPort until know whether it needs to be fixed or symbolic.
                // for non-multicast with generate or list of ip addresses, port needs to be a fixed value
                // all members of cluster. for non-multicast with list of uri, the GMS_LISTENER_PORT is
                // set to symbolic system environment variable that is set different for each instance of cluster.
            }

            // handle generation of udp multicast and non-multicast mode for DAS managed cluster.
            // inspect cluster attribute broadcast and cluster property GMS_DISCOVERY_URI_LIST.
            String DEFAULT_BROADCAST = "udpmulticast";
            String broadcastProtocol = instance.getBroadcast();
            Property discoveryUriListProp = instance.getProperty("GMS_DISCOVERY_URI_LIST");
            String  discoveryUriList = discoveryUriListProp != null ? discoveryUriListProp.getValue() : null;
            if (discoveryUriList != null  && DEFAULT_BROADCAST.equals(broadcastProtocol)) {

                // override default broadcast protocol of udp multicast when GMS_DISCOVERY_URI_LIST has been set.
                instance.setBroadcast("tcp");
                broadcastProtocol = "tcp";
            }
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE,ConfigApiLoggerInfo.clusterGSMBroadCast, instance.getBroadcast());
                logger.log(Level.FINE, ConfigApiLoggerInfo.clusterGSMDeliveryURI , discoveryUriList);
            }
            if (DEFAULT_BROADCAST.equals(broadcastProtocol)) {

                // only generate these values when they are not set AND broadcastProtocol is set to enable UDP multicast.
                // Note: that this is the default for DAS controlled clusters.
                if (instance.getGmsMulticastAddress() == null) {
                    instance.setGmsMulticastAddress(generateHeartbeatAddress());
                }
                if (instance.getGmsMulticastPort() == null) {
                    instance.setGmsMulticastPort(generateHeartbeatPort());
                }

                if (needToAddGmsListenerPort) {
                    instance.getProperty().add(gmsListenerPort);
                }
            } else {

                final String GENERATE = "generate";

                // cover case that broadcast is set to non-multicast and no
                // cluster property GMS_DISCOVERY_URI_LIST exists.
                // create the property and set to "generate".
                // gms-adapter will handle generation of the list when needed
                if (discoveryUriListProp == null) {
                    discoveryUriListProp = instance.createChild(Property.class);
                    discoveryUriListProp.setName("GMS_DISCOVERY_URI_LIST");
                    discoveryUriListProp.setValue(GENERATE);
                    instance.getProperty().add(discoveryUriListProp);
                }

                String TCPPORT = gmsListenerPort.getValue();
                if (GENERATE.equals(discoveryUriListProp.getValue())) {

                    // TODO: implement UDP unicast.

                    // Only tcp mode is supported now.
                    // So either "udpunicast" or "tcp" for broadcast mode is treated the same.
View Full Code Here

    public boolean isValid(final AuthRealm realm,
        final ConstraintValidatorContext constraintValidatorContext) {

        if (realm.getClassname().equals(JDBC_REALM)) {
            Property jaas_context = realm.getProperty("jaas-context");
            Property ds_jndi = realm.getProperty("datasource-jndi");
            Property user_table = realm.getProperty("user-table");
            Property group_table = realm.getProperty("group-table");
            Property user_name_col = realm.getProperty("user-name-column");
            Property passwd_col = realm.getProperty("password-column");
            Property grp_name_col = realm.getProperty("group-name-column");
            Property digest_algo = realm.getProperty("digest-algorithm");

            if ((jaas_context == null) || (ds_jndi == null) ||
                (user_table == null) || (group_table == null) ||
                (user_name_col == null) || (passwd_col == null) ||
                (grp_name_col == null)) {
               
                return false;
            }
           
            if (digest_algo != null) {
                String algoName = digest_algo.getValue();

                if (!("none".equalsIgnoreCase(algoName))) {
                    try {
                        MessageDigest.getInstance(algoName);
                    } catch(NoSuchAlgorithmException e) {
View Full Code Here

    public boolean isValid(final AuthRealm realm,
        final ConstraintValidatorContext constraintValidatorContext) {

        if (realm.getClassname().equals(SOLARIS_REALM)) {
            Property jaas_context = realm.getProperty("jaas-context");
            if (jaas_context == null || jaas_context.getName().equals(""))
                return false;
        }
       
        return true;
    }
View Full Code Here

    public boolean isValid(final AuthRealm realm,
        final ConstraintValidatorContext constraintValidatorContext) {

        if (realm.getClassname().equals(LDAP_REALM)) {
            Property jaas_context = realm.getProperty("jaas-context");
            Property dn = realm.getProperty("base-dn");
            Property url = realm.getProperty("directory");

            if (jaas_context == null || jaas_context.getName().equals(""))
                return false;

            if (url == null || url.getName().equals(""))
                return false;

            if (dn == null || dn.getName().equals(""))
                return false;
        }
View Full Code Here

        }
        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;
    }
View Full Code Here

TOP

Related Classes of org.jvnet.hk2.config.types.Property

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.