Package org.openengsb.core.api.persistence

Examples of org.openengsb.core.api.persistence.PersistenceException


        File targetFile = getPathForMetaData(config.getMetaData());
        try {
            FileUtils.writeStringToFile(targetFile, config.getContent().getCode());
        } catch (IOException e) {
            throw new PersistenceException(e);
        }

    }
View Full Code Here


        try {
            type = encoder.encode(metaData.get(RuleBaseElement.META_RULE_TYPE));
            name = encoder.encode(metaData.get(RuleBaseElement.META_RULE_NAME));
            pack = encoder.encode(metaData.get(RuleBaseElement.META_RULE_PACKAGE));
        } catch (EncoderException e) {
            throw new PersistenceException(e);
        }

        String filename = type + SEPARATOR + name + SEPARATOR + pack;
        return new File(storageFolder, filename);
    }
View Full Code Here

        try {
            element.setName(encoder.decode(parts[1]));
            element.setPackageName(encoder.decode(parts[2]));
            element.setCode(FileUtils.readFileToString(file));
        } catch (IOException e) {
            throw new PersistenceException(e);
        } catch (DecoderException e) {
            throw new PersistenceException(e);
        }
        return new RuleBaseConfiguration(element.toMetadata(), element);
    }
View Full Code Here

        for (File file : files) {
            try {
                FileUtils.forceDelete(file);
            } catch (IOException e) {
                LOGGER.warn("\"{}\" couldn't be deleted!", file);
                throw new PersistenceException(e);
            }

        }
    }
View Full Code Here

        encoder = new URLCodec();
        if (!storageFolder.exists()) {
            try {
                FileUtils.forceMkdir(storageFolder);
            } catch (IOException e) {
                throw new PersistenceException(e);
            }
        }
    }
View Full Code Here

        String contextFileName = getFileNameForMetaData(config.getMetaData());
        File contextPersistenceFile = new File(storageFolder, contextFileName);
        try {
            FileUtils.touch(contextPersistenceFile);
        } catch (IOException e) {
            throw new PersistenceException(String.format("Could not persist context configuration file %s",
                contextFileName), e);
        }
        LOGGER.info("Created context configuration file %s", contextFileName);
    }
View Full Code Here

    public void remove(Map<String, String> metadata) throws PersistenceException {
        String contextFileName = getFileNameForMetaData(metadata);
        File contextPersistenceFile = new File(storageFolder, contextFileName);
        Boolean fileSuccessFullyDeleted = FileUtils.deleteQuietly(contextPersistenceFile);
        if (!fileSuccessFullyDeleted) {
            throw new PersistenceException(String.format("Could not delete context configuration file %s",
                contextFileName));
        }
        LOGGER.info("Deleted context configuration file %s", contextFileName);
    }
View Full Code Here

                out.writeObject(obj);
            } catch (NotSerializableException e) {
                new SerializableChecker(e).writeObject(obj);
            }
        } catch (IOException e) {
            throw new PersistenceException(format("Could not write object %s to file %s", obj.getClass().getName(),
                file.toString()), e);
        } finally {
            try {
                if (out != null) {
                    out.close();
View Full Code Here

                    return super.resolveClass(desc);
                }
            };
            return in.readObject();
        } catch (IOException e) {
            throw new PersistenceException(format("Could not read file %s", file.toString()), e);
        } catch (ClassNotFoundException e) {
            throw new PersistenceException(format("Could not load required classes for file %s", file.toString()), e);
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
View Full Code Here

                LOGGER.info("Found object matching all equals of old bean {}", oldBean.getClass());
                toRemove.add(info);
            }
        }
        if (toRemove.size() != 1) {
            throw new PersistenceException("No unique object to remove available.");
        }
        for (ObjectInfo info : toRemove) {
            index.removeIndexObject(info);
            new File(info.getLocation()).delete();
            indexBean(newBean);
View Full Code Here

TOP

Related Classes of org.openengsb.core.api.persistence.PersistenceException

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.