Package com.volantis.mcs.repository

Examples of com.volantis.mcs.repository.RepositoryException


    // Add the standard set of definitions.
    DefinitionSet standardDefinitionSet = (DefinitionSet) loadZipObject(
            DeviceRepositoryConstants.STANDARD_DEFINITIONS_XML,
                        DefinitionSet.class);
    if (standardDefinitionSet == null) {
        throw new RepositoryException(EXCEPTION_LOCALIZER.format(
             "device-repository-file-missing",
                               DeviceRepositoryConstants.STANDARD_DEFINITIONS_XML));
    }
    addDefinitionSetToDefinitions(standardDefinitionSet, definitions);
View Full Code Here


            Type type = typeContainer.getType();
            if (typeName != null && type == null) {
                // this is a reference to a declared type.
                TypeDeclaration declaration = definitions.getType(typeName);
                if (declaration == null) {
                    throw new RepositoryException(EXCEPTION_LOCALIZER.format(
                            "repository-unable-to-find-type-information",
                            typeName));
                }
                type = declaration.getType();
            } else if (typeName == null && type != null) {
                // this is an anonymous type

            } else if (typeName == null && type == null) {
                // nothing specified, error.
                throw new RepositoryException(EXCEPTION_LOCALIZER.format(
                        "repository-unable-to-find-type-information",
                        policyName));
            } else if (typeName != null && type != null) {
                // both specified, error.
                throw new RepositoryException(EXCEPTION_LOCALIZER.format(
                        "repository-unable-to-find-type-information",
                        policyName));
            }

            // OK, we have the type, so create the descriptor for it.
View Full Code Here

                DeviceRepositoryConstants.STANDARD_POLICIES_PROPERTIES_PREFIX,
                allProps, locale);

        // There must be standard properties.
        if (localeFound == null) {
            throw new RepositoryException(EXCEPTION_LOCALIZER.format(
                    "device-repository-file-missing",
                    DeviceRepositoryConstants.STANDARD_POLICIES_PROPERTIES_PREFIX));
        }

        localeToLocaleFound.put(locale, localeFound);
View Full Code Here

        ZipArchive zipArchive;
        try {
            zipArchive = getZipArchive();
        } catch (IOException e) {
            throw new RepositoryException(
                EXCEPTION_LOCALIZER.format("device-repository-access-failure"));
        }

        // the language will be either a 2 character identifier or an empty
        // string
        String language = locale.getLanguage();
        // the country will be either a 2 character identifier or an empty
        // string
        String country = locale.getCountry();
        // the country will be an empty string or some other identifier
        String variant = locale.getVariant();

        String localeFound = null;
        String propertiesFile = null;
        // see if we have a properites file with the following suffix
        // _LANGUAGE_COUNTRY_VARIANT.properties
        if (language.length() != 0 &&
                country.length() != 0 &&
                variant.length() != 0) {
            String checkPath =
                    getPropertiesPath(prefix, language, country, variant);
            if (zipArchive.exists(checkPath)) {
                localeFound = language + "_" + country + "_" + variant;
                propertiesFile = checkPath;
            }
        }
        // If we haven't found the properties file then we try the less
        // specific suffix _LANGUAGE_COUNTRY.properites
        if (propertiesFile == null &&
                language.length() != 0 &&
                country.length() != 0) {
            String checkPath =
                    getPropertiesPath(prefix, language, country, null);
            if (zipArchive.exists(checkPath)) {
                localeFound = language + "_" + country + "_";
                propertiesFile = checkPath;
            }
        }
        // If we haven't found the properties file then we try the less
        // specific suffix _LANGUAGE.properites
        if (propertiesFile == null && language.length() != 0) {
            String checkPath = getPropertiesPath(prefix, language, null, null);
            if (zipArchive.exists(checkPath)) {
                localeFound = language + "__";
                propertiesFile = checkPath;
            }
        }
        // If we haven't found the properties file then we try the
        // .properties
        if (propertiesFile == null) {
            String checkPath = getPropertiesPath(prefix, null, null, null);
            if (zipArchive.exists(checkPath)) {
                localeFound = "__";
                propertiesFile = checkPath;
            }
        }
        if (propertiesFile != null) {
            // if we found a properties file the load its contents into the
            // properties instance
            try {
                properties.load(zipArchive.getInputFrom(propertiesFile));
            } catch (IOException e) {
                throw new RepositoryException(EXCEPTION_LOCALIZER.format(
                        "device-repository-file-missing", propertiesFile));
            }
        } else if (logger.isDebugEnabled()) {
            logger.debug("Could not locate the properties file for the prefix "
                    + prefix);
View Full Code Here

                        schemaValidation ? deviceSchemaValidator : null);
                object = jibxReader.read(content, filename);
            }
            return object;
        } catch (IOException e) {
            throw new RepositoryException(EXCEPTION_LOCALIZER.format(
                    "cannot-read-object", new Object[]{
                            expectedClass.getName(), filename}), e);
        }
    }
View Full Code Here

                            languageToProperties.put(language, properties);
                        }
                    }
                }
            } catch (IOException e) {
                throw new RepositoryException("Cannot read repository", e);
            }
        }
        return languageToProperties;
    }
View Full Code Here

    // javadoc inherited
    public List retrievePolicyDescriptors(final RepositoryConnection connection,
                                          final String policyName)
            throws RepositoryException {

        throw new RepositoryException(EXCEPTION_LOCALIZER.format(
                "unsupported-operation"));
    }
View Full Code Here

    // javadoc inherited
    public List retrieveCategoryDescriptors(final RepositoryConnection connection,
                                            final String categoryName)
            throws RepositoryException {

        throw new RepositoryException(EXCEPTION_LOCALIZER.format(
                "unsupported-operation"));
    }
View Full Code Here

                    devicePatternCache.mapPatternAndDevice(pattern.trim(),
                                                           deviceName.intern());
                    count++;
                } catch (IllegalArgumentException e) {
                    enumeration.close();
                    throw new RepositoryException(
                            exceptionLocalizer.format(
                                    "unexpected-illegal-argument-exception"),
                            e);
                }
            }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.repository.RepositoryException

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.