Package org.apache.avalon.framework.configuration

Examples of org.apache.avalon.framework.configuration.ConfigurationException


            String exceptionString = "Attempt to configure AvalonMailRepository as " +
                                     checkType;
            if (getLogger().isWarnEnabled()) {
                getLogger().warn(exceptionString);
            }
            throw new ConfigurationException(exceptionString);
        }
        // ignore model
    }
View Full Code Here


            StringBuffer exceptionBuffer =
                new StringBuffer(256)
                        .append("Malformed destinationURL - Must be of the format '")
                        .append("db://<data-source>[/<table>[/<repositoryName>]]'.  Was passed ")
                        .append(conf.getAttribute("destinationURL"));
            throw new ConfigurationException(exceptionBuffer.toString());
        }
        if (urlParams.size() >= 1) {
            datasourceName = (String)urlParams.get(0);
        }
        if (urlParams.size() >= 2) {
            tableName = (String)urlParams.get(1);
        }
        if (urlParams.size() >= 3) {
            repositoryName = "";
            for (int i = 2; i < urlParams.size(); i++) {
                if (i >= 3) {
                    repositoryName += '/';
                }
                repositoryName += (String)urlParams.get(i);
            }
        }

        if (getLogger().isDebugEnabled()) {
            StringBuffer logBuffer =
                new StringBuffer(128)
                        .append("Parsed URL: table = '")
                        .append(tableName)
                        .append("', repositoryName = '")
                        .append(repositoryName)
                        .append("'");
            getLogger().debug(logBuffer.toString());
        }

        filestore = conf.getChild("filestore").getValue(null);
        sqlFileName = conf.getChild("sqlFile").getValue();
        if (!sqlFileName.startsWith("file://")) {
            throw new ConfigurationException
                ("Malformed sqlFile - Must be of the format 'file://<filename>'.");
        }
        try {
            if (filestore != null) {
                Store store = (Store)componentManager.
                        lookup("org.apache.avalon.cornerstone.services.store.Store");
                //prepare Configurations for stream repositories
                DefaultConfiguration streamConfiguration
                    = new DefaultConfiguration( "repository",
                                                "generated:JDBCMailRepository.configure()" );

                streamConfiguration.setAttribute( "destinationURL", filestore );
                streamConfiguration.setAttribute( "type", "STREAM" );
                streamConfiguration.setAttribute( "model", "SYNCHRONOUS" );
                sr = (StreamRepository) store.select(streamConfiguration);

                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Got filestore for JdbcMailRepository: " + filestore);
                }
            }

            lock = new Lock();
            if (getLogger().isDebugEnabled()) {
                StringBuffer logBuffer =
                    new StringBuffer(128)
                            .append(this.getClass().getName())
                            .append(" created according to ")
                            .append(destination);
                getLogger().debug(logBuffer.toString());
            }
        } catch (Exception e) {
            final String message = "Failed to retrieve Store component:" + e.getMessage();
            getLogger().error(message, e);
            e.printStackTrace();
            throw new ConfigurationException(message, e);
        }
    }
View Full Code Here

                StringBuffer errorBuffer =
                    new StringBuffer(128)
                        .append("Spool directory is improperly configured.  The specified path ")
                        .append(spoolPathString)
                        .append(" is not a directory.");
                throw new ConfigurationException(errorBuffer.toString());
            }
        } catch (Exception e) {
            getLogger().fatalError(e.getMessage(), e);
            throw e;
        }
View Full Code Here

                }
                else if (name.equals(HISTORY_PATH)) {
                    value = ((CMSHistory) WorkflowFactory.getHistory(document)).getHistoryPath();
                }
        else {
          throw new ConfigurationException("The attribute [" + name + "] is not supported!");
        }
            }
    } catch (ConfigurationException e) {
      throw e;
        } catch (Exception e) {
            throw new ConfigurationException("Resolving attribute failed: ", e);
        }
        return value;
    }
View Full Code Here

        }

        try {
            envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
        } catch (Exception e) {
            throw new ConfigurationException("Resolving page envelope failed: ", e);
        }

        return envelope;
    }
View Full Code Here

    public Object getAttribute(String name, Configuration modeConf, Map objectModel)
        throws ConfigurationException {

        if (!Arrays.asList(DublinCoreImpl.ELEMENTS).contains(name)
            && !Arrays.asList(DublinCoreImpl.TERMS).contains(name)) {
            throw new ConfigurationException("The attribute [" + name + "] is not supported!");
        }

        Document document = getEnvelope(objectModel).getDocument();

        if (document == null) {
            throw new ConfigurationException("There is no document for this page envelope!");
        }
        Object value;
        try {
            value = document.getDublinCore().getFirstValue(name);
        } catch (DocumentException e) {
            throw new ConfigurationException(
                "Obtaining dublin core value for [" + name + "] failed: ",
                e);
        }

        return value;
View Full Code Here

                        resolver.release(source);
                    }
                }
            }
        } catch (Exception e) {
            throw new ConfigurationException("Configuring failed: ", e);
        } finally {
            if (resolver != null) {
                manager.release(resolver);
            }
        }
View Full Code Here

                }
                i++;
            }

        } catch (Exception e) {
            throw new ConfigurationException("Resolving attribute [" + path + "] failed: ", e);
        } finally {
            if (resolver != null) {
                manager.release(resolver);
            }
        }

        if (resolvedUri == null) {
            throw new ConfigurationException("Could not resolve file for path [" + path + "]."
                    + "\nChecked URIs:" + checkedUris);
        }
        else {
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Resolved URI: [" + resolvedUri + "]");
View Full Code Here

      if (getLogger().isDebugEnabled()) {
            getLogger().debug("Resolving directory path for [" + name + "]");
        }
      String[] pubidAndArea = name.split(",");
        if (pubidAndArea.length < 2) {
            throw new ConfigurationException("Invalid number of parameters: " + pubidAndArea.length
                    + ". Expected pub, area.");
        }
          
        String id = pubidAndArea[0];
        String area = pubidAndArea[1];
      String contextPath = ObjectModelHelper.getContext(objectModel).getRealPath("");
     
      try {
      Publication pub = PublicationFactory.getPublication(id, contextPath);
      return pub.getContentDirectory(area);
    } catch (PublicationException e) {
            throw new ConfigurationException("Obtaining value for [" + name + "] failed: ", e);
    }
     
    }
View Full Code Here

        String url;

        final String[] attributes = name.split(":");

        if (attributes.length < 3) {
            throw new ConfigurationException("Invalid number of parameters: " + attributes.length
                    + ". Expected 3 (area, document-id, language)");
        }

        final String area = attributes[0];
        final String documentId = attributes[1];
        final String language = attributes[2];

        try {
            DocumentHelper helper = new DocumentHelper(objectModel);
            url = helper.getDocumentUrl(documentId, area, language);
        } catch (Exception e) {
            throw new ConfigurationException("Resolving attribute [" + name + "] failed: ", e);
        }

        return url;
    }
View Full Code Here

TOP

Related Classes of org.apache.avalon.framework.configuration.ConfigurationException

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.