private void psersistDimensions() throws IOException {
        Set<Dimension> persistedDimensions = new HashSet<Dimension>();
        Document dimensionXml = DocumentHelper.createDocument();
        Element dimensionRoot = dimensionXml.addElement("dimensions");
        Element dimensionElement;
        Element levelElement;
        Set<Level> levels;
        Set<Dimension> dimensions;
        Element rangeElement;
        for (Schema schema : schemas) {
            dimensions = schema.getDimensions();
            for (Dimension dimension : dimensions) {
                if (persistedDimensions.contains(dimension)) {
                    continue;
                } else {
                    persistedDimensions.add(dimension);
                }
                dimensionElement = dimensionRoot.addElement("dimension");
                // persist name
                dimensionElement.addElement("name")
                        .addText(dimension.getName());
                // persist levels
                levels = dimension.getLevels();
                for (Level level : levels) {
                    levelElement = dimensionElement.addElement("level");
                    levelElement.addElement("name").addText(level.getName());
                    levelElement.addElement("length").addText(
                            String.valueOf(level.getLength()));
                    levelElement.addElement("begin").addText(
                            String.valueOf(level.getBegin()));
                    levelElement.addElement("orderNumber").addText(
                            String.valueOf(level.getOrderNumber()));
                }
                // persist orderNumber
                dimensionElement.addElement("orderNumber").addText(
                        String.valueOf(dimension.getOrderNumber()));
                // persist dimensionRange
                DimensionRange dimensionRange = dimension.getRange();
                rangeElement = dimensionElement.addElement("range");
                rangeElement.addElement("start").addText(
                        String.valueOf(dimensionRange.getStart()));
                rangeElement.addElement("end").addText(
                        String.valueOf(dimensionRange.getEnd()));
            }
        }
        if (DebugConf.isHadoopDebug()) {

            FileWriter dimensionFileWriter = new FileWriter(
                    PathConf.getDimensionXmlFilePath());
            dimensionXml.write(dimensionFileWriter);
            dimensionFileWriter.close();
        } else {
            Path hdfsFile = new Path(PathConf.getDimensionXmlFilePath());
            FileSystem hdfs = FileSystem.get(CubeConfiguration
                    .getConfiguration());
            FSDataOutputStream out = hdfs.create(hdfsFile);
            out.write(dimensionXml.asXML().getBytes());
            out.close();
            hdfs.close();
        }
    }