Package org.apache.felix.utils.properties

Examples of org.apache.felix.utils.properties.Properties.load()


            String karafBase = bundleContext.getProperty("karaf.base");
            File etcDir = new File(karafBase, "etc");
            File syspropsFile = new File(etcDir, "system.properties");
            FileInputStream fis = new FileInputStream(syspropsFile);
            Properties props = new Properties();
            props.load(fis);
            fis.close();
            props.setProperty("karaf.name", name);
            FileOutputStream fos = new FileOutputStream(syspropsFile);
            props.store(fos, "");
            fos.close();
View Full Code Here


                getLog().info("Adding feature repository to system: " + uri);
                if (featuresCfgFile.exists()) {
                    Properties properties = new Properties();
                    InputStream in = new FileInputStream(featuresCfgFile);
                    try {
                        properties.load(in);
                    } finally {
                        in.close();
                    }
                    String existingFeatureRepos = retrieveProperty(properties, FEATURES_REPOSITORIES);
                    if (!existingFeatureRepos.contains(uri.toString())) {
View Full Code Here

     */
    static void loadSystemProperties(File file) throws IOException {
        Properties props = new Properties(false);
        try {
            InputStream is = new FileInputStream(file);
            props.load(is);
            is.close();
        } catch (Exception e1) {
            // Ignore
        }

View Full Code Here

    static Properties loadPropertiesFile(URL configPropURL, boolean failIfNotFound) throws Exception {
        Properties configProps = new Properties(null, false);
        InputStream is = null;
        try {
            is = configPropURL.openConnection().getInputStream();
            configProps.load(is);
            is.close();
        } catch (FileNotFoundException ex) {
            if (failIfNotFound) {
                throw ex;
            } else {
View Full Code Here

        Properties configuration = new Properties();
        File configFile = new File(System.getProperty("karaf.etc"), FEATURES_SERVICE_CONFIG_FILE);
        if (configFile.isFile() && configFile.canRead()) {
            try {
                configuration.load(new FileReader(configFile));
            } catch (IOException e) {
                logger.warn("Error reading configuration file " + configFile.toString(), e);
            }
        }
        Dictionary<String, String> props = new Hashtable<>();
View Full Code Here

                    if (featuresCfgFile.exists()) {
                        getLog().info("= Updating " + featuresCfgFile.getPath());
                        Properties featuresProperties = new Properties();
                        InputStream in = new FileInputStream(featuresCfgFile);
                        try {
                            featuresProperties.load(in);
                        } finally {
                            in.close();
                        }
                        String featuresBoot = featuresProperties.getProperty(FEATURES_BOOT);
                        featuresBoot = featuresBoot != null && featuresBoot.length() > 0 ? featuresBoot + "," : "";
View Full Code Here

        // update etc/org.apache.karaf.features.cfg file
        if (updateFeaturesCfgFile && featuresCfgFile.exists()) {
            Properties featuresProperties = new Properties();
            InputStream in = new FileInputStream(featuresCfgFile);
            try {
                featuresProperties.load(in);
            } finally {
                in.close();
            }
            String featureRepos = featuresProperties.getProperty(FEATURES_REPOSITORIES);
            featureRepos = featureRepos != null && featureRepos.length() > 0 ? featureRepos + "," : "";
View Full Code Here

        execute(file, new Runnable() {
            public void run(RandomAccessFile file) throws IOException {
                byte[] buffer = new byte[(int) file.length()];
                file.readFully(buffer);
                Properties props = new Properties();
                props.load(new ByteArrayInputStream(buffer));
                callback.run(props);
                if (writeToFile) {
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    props.store(baos, null);
                    file.setLength(0);
View Full Code Here

        return execute(file, new Callable<T>() {
            public T call(RandomAccessFile file) throws IOException {
                byte[] buffer = new byte[(int) file.length()];
                file.readFully(buffer);
                Properties props = new Properties();
                props.load(new ByteArrayInputStream(buffer));
                T result = callback.call(props);
                if (writeToFile) {
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    props.store(baos, null);
                    file.setLength(0);
View Full Code Here

    protected Object doExecute() throws Exception {
        if (!bare) {
            Properties configuration = new Properties();
            File configFile = new File(System.getProperty("karaf.etc"), FEATURES_SERVICE_CONFIG_FILE);
            configuration.load(configFile);
            String featuresRepositories = configuration.getProperty("featuresRepositories", "");
            String featuresBoot = configuration.getProperty("featuresBoot", "");
            if (featureURLs == null) {
                featureURLs = new ArrayList<>();
            }
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.