Examples of SuperProperties


Examples of org.apache.openejb.util.SuperProperties

            comment(out, cr, info.service + "(id=" + info.id + ")");
            comment(out, cr, "className: " + info.className);
            // TODO: the codebase value usually isn't filled in, we should do that.
            // comment("codebase: " + info.codebase);
            comment(out, cr, "");
            final SuperProperties p = new SuperProperties();
            p.setSpaceBetweenProperties(false);
            p.setKeyValueSeparator(" = ");
            p.setLineSeparator(cr);

            String uri = "new://" + info.service;
            if (info.service.matches("Container|Resource|Connector")) {
                try {
                    final Map query = new HashMap();
                    query.put("type", info.types.get(0));
                    uri += "?" + URISupport.createQueryString(query);
                } catch (final Exception e) {
                    // no-op
                }
            }

            p.put(info.id, uri);

            for (final Map.Entry<Object, Object> entry : info.properties.entrySet()) {
                if (!(entry.getKey() instanceof String)) {
                    continue;
                }
                if (!(entry.getValue() instanceof String)) {
                    continue;
                }

                // If property name is 'password' replace value with 'xxxx' to protect it
                if ("password".equalsIgnoreCase((String) entry.getKey())) {
                    p.put(info.id + "." + entry.getKey(), "xxxx");
                } else {
                    p.put(info.id + "." + entry.getKey(), entry.getValue());
                }
            }
            p.store(out, null);

        } catch (final IOException e) {
            out.println("# Printing service(id=" + info.id + ") failed.");
            e.printStackTrace(new PrintWriter(new CommentsFilter(out)));
        }
View Full Code Here

Examples of org.apache.openejb.util.SuperProperties

                    logger.debug("Override [" + key + "=" + value+"]");
                }
            }

            Properties props = new SuperProperties();
            props.putAll(provider.getProperties());
            props.putAll(service.getProperties());
            props.putAll(overrides);

            if (providerType != null && !provider.getService().equals(providerType)) {
                throw new OpenEJBException(messages.format("configureService.wrongProviderType", service.getId(), providerType));
            }
View Full Code Here

Examples of org.apache.openejb.util.SuperProperties

     * <p/>
     * <p/>
     */
    public Properties getProperties() {
        if (properties == null) {
            properties = new SuperProperties();
        }
        return properties;
    }
View Full Code Here

Examples of org.apache.openejb.util.SuperProperties

/**
* Converts a java.util.Properties object to a String in the XML file.
*/
public class PropertiesAdapter extends XmlAdapter<String, Properties> {
    public Properties unmarshal(String s) throws Exception {
        Properties properties = new SuperProperties();
        ByteArrayInputStream in = new ByteArrayInputStream(s.getBytes());
        properties.load(in);
        return properties;
    }
View Full Code Here

Examples of org.apache.openejb.util.SuperProperties

    }

    private static void printSystemProperties(final PrintStream out, final String cr) {

        try {
            final SuperProperties p = new SuperProperties();
            p.setSpaceBetweenProperties(false);
            p.setKeyValueSeparator(" = ");
            p.setLineSeparator(cr);
            copyOpenEjbProperties(System.getProperties(), p);
            copyOpenEjbProperties(SystemInstance.get().getProperties(), p);
            p.store(out, null);


            final Properties p2 = System.getProperties();
            final String[] misc = {"os.version", "os.name", "os.arch", "java.version", "java.vendor"};
            for (final String prop : misc) {
View Full Code Here

Examples of org.apache.openejb.util.SuperProperties

            comment(out, cr, info.service + "(id=" + info.id + ")");
            comment(out, cr, "className: " + info.className);
            // TODO: the codebase value usually isn't filled in, we should do that.
            // comment("codebase: " + info.codebase);
            comment(out, cr, "");
            final SuperProperties p = new SuperProperties();
            p.setSpaceBetweenProperties(false);
            p.setKeyValueSeparator(" = ");
            p.setLineSeparator(cr);

            String uri = "new://" + info.service;
            if (info.service.matches("Container|Resource|Connector")) {
                try {
                    final Map query = new HashMap();
                    query.put("type", info.types.get(0));
                    uri += "?" + URISupport.createQueryString(query);
                } catch (final Exception e) {
                    // no-op
                }
            }

            p.put(info.id, uri);

            for (final Map.Entry<Object, Object> entry : info.properties.entrySet()) {
                if (!(entry.getKey() instanceof String)) {
                    continue;
                }
                if (!(entry.getValue() instanceof String)) {
                    continue;
                }

                // If property name is 'password' replace value with 'xxxx' to protect it
                if ("password".equalsIgnoreCase((String) entry.getKey())) {
                    p.put(info.id + "." + entry.getKey(), "xxxx");
                } else {
                    p.put(info.id + "." + entry.getKey(), entry.getValue());
                }
            }
            p.store(out, null);

        } catch (final IOException e) {
            out.println("# Printing service(id=" + info.id + ") failed.");
            e.printStackTrace(new PrintWriter(new CommentsFilter(out)));
        }
View Full Code Here

Examples of org.apache.openejb.util.SuperProperties

        }
        return "true".equalsIgnoreCase(property) || null == property;
    }

    private static Properties asProperties(final String definition) throws IOException {
        final SuperProperties properties = new SuperProperties();
        properties.caseInsensitive(true);
        properties.putAll(IO.readProperties(IO.read(definition), new Properties()));
        return properties;
    }
View Full Code Here

Examples of org.apache.openejb.util.SuperProperties

        out.println();
        out.println("Declarable in properties via");
        out.println();
        out.println("    Foo = new://" + provider.getService() + "?type=" + type);
        out.println();
        final SuperProperties properties = (SuperProperties) provider.getProperties();

        final Map<String, String> defaults = new LinkedHashMap<String, String>();

        if (properties.size() > 0) {
            out.println("## Properties");
            out.println();
            for (final Object key : properties.keySet()) {
                if (key instanceof String) {
                    final String name = (String) key;

                    final Map<String, String> attributes = properties.getAttributes(name);

                    if (attributes.containsKey("hidden")) {
                        continue;
                    }

                    out.println("### " + key);
                    out.println();

                    final String value = properties.getProperty(name);

                    String comment = properties.getComment(name);

                    comment = scrubText(comment);

                    defaults.put(name, String.valueOf(value));
View Full Code Here

Examples of org.apache.openejb.util.SuperProperties

                    logger.debug("Override [" + key + "=" + value + "]");
                }
            }

            final Properties props = new SuperProperties().caseInsensitive(true);

            // weird hack but sometimes we don't want default values when we want null for instance
            if (serviceProperties == null || "false".equals(serviceProperties.getProperty(IGNORE_DEFAULT_VALUES_PROP, "false"))) {
                props.putAll(provider.getProperties());
            }
View Full Code Here

Examples of org.apache.openejb.util.SuperProperties

        final Properties props = PropertyPlaceHolderHelper.holds(serviceInfo.properties);
        if (serviceInfo.properties.containsKey("Definition")) {
            try { // we catch classcast etc..., if it fails it is not important
                final InputStream is = new ByteArrayInputStream(serviceInfo.properties.getProperty("Definition").getBytes());
                final Properties p = new SuperProperties();
                IO.readProperties(is, p);
                for (final Map.Entry<Object, Object> entry : p.entrySet()) {
                    final String key = entry.getKey().toString();
                    if (!props.containsKey(key)
                        // never override from Definition, just use it to complete the properties set
                        &&
                        !(key.equalsIgnoreCase("url") &&
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.