Package it.freedomotic.exceptions

Examples of it.freedomotic.exceptions.FreedomoticException


        String envFilePath = config.getProperty("KEY_ROOM_XML_PATH");
        File envFile = new File(Info.PATH_WORKDIR + "/data/furn/" + envFilePath);
        File folder = envFile.getParentFile();

        if (!folder.exists()) {
            throw new FreedomoticException(
                    "Folder " + folder + " do not exists. Cannot load default "
                    + "environment from " + envFile.getAbsolutePath().toString());
        } else if (!folder.isDirectory()) {
            throw new FreedomoticException(
                    "Environment folder " + folder.getAbsolutePath()
                    + " is supposed to be a directory");
        }

        try {
            //EnvironmentPersistence.loadEnvironmentsFromDir(folder, false);
            EnvironmentDAO loader = environmentDaoFactory.create(folder);
            Collection<Environment> loaded = loader.load();

            if (loaded == null) {
                throw new IllegalStateException("Object data cannot be null at this stage");
            }
            for (Environment env : loaded) {
                EnvironmentLogic logic = INJECTOR.getInstance(EnvironmentLogic.class);
                logic.setPojo(env);
                logic.setSource(new File(folder + "/" + env.getUUID() + ".xenv"));
                EnvironmentPersistence.add(logic, false);
            }

            //now load related objects
            EnvObjectPersistence.loadObjects(new File(folder + "/data/obj"), false);
        } catch (DaoLayerException e) {
            throw new FreedomoticException(e.getMessage(), e);
        }
    }
View Full Code Here

TOP

Related Classes of it.freedomotic.exceptions.FreedomoticException

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.