Package org.apache.camel

Examples of org.apache.camel.TypeConverterLoaderException


            // must be synchronized to ensure we don't load type converters concurrently
            // which cause Camel apps to fails in OSGi thereafter
            try {
                loader.load(registry);
            } catch (Exception e) {
                throw new TypeConverterLoaderException("Cannot load type converters using OSGi bundle: " + bundle.getBundleId(), e);
            }
        }
View Full Code Here


        LOG.trace("Searching for {} services", META_INF_SERVICES);
        try {
            packageNames = findPackageNames();
            if (packageNames == null || packageNames.length == 0) {
                throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.");
            }
        } catch (Exception e) {
            throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.", e);
        }

        // if we only have camel-core on the classpath then we have already pre-loaded all its type converters
        // but we exposed the "org.apache.camel.core" package in camel-core. This ensures there is at least one
        // packageName to scan, which triggers the scanning process. That allows us to ensure that we look for
        // META-INF/services in all the JARs.
        if (packageNames.length == 1 && "org.apache.camel.core".equals(packageNames[0])) {
            LOG.debug("No additional package names found in classpath for annotated type converters.");
            // no additional package names found to load type converters so break out
            return;
        }

        // now filter out org.apache.camel.core as its not needed anymore (it was just a dummy)
        packageNames = filterUnwantedPackage("org.apache.camel.core", packageNames);

        // filter out package names which can be loaded as a class directly so we avoid package scanning which
        // is much slower and does not work 100% in all runtime containers
        Set<Class<?>> classes = new HashSet<Class<?>>();
        packageNames = filterPackageNamesOnly(resolver, packageNames, classes);
        if (!classes.isEmpty()) {
            LOG.debug("Loaded " + classes.size() + " @Converter classes");
        }

        // if there is any packages to scan and load @Converter classes, then do it
        if (packageNames != null && packageNames.length > 0) {
            LOG.trace("Found converter packages to scan: {}", packageNames);
            Set<Class<?>> scannedClasses = resolver.findAnnotated(Converter.class, packageNames);
            if (scannedClasses.isEmpty()) {
                throw new TypeConverterLoaderException("Cannot find any type converter classes from the following packages: " + Arrays.asList(packageNames));
            }
            LOG.debug("Found " + packageNames.length + " packages with " + scannedClasses.size() + " @Converter classes to load");
            classes.addAll(scannedClasses);
        }
View Full Code Here

        LOG.trace("Searching for {} services", META_INF_SERVICES);
        try {
            packageNames = findPackageNames();
            if (packageNames == null || packageNames.length == 0) {
                throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.");
            }
        } catch (Exception e) {
            throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.", e);
        }

        // if we only have camel-core on the classpath then we have already pre-loaded all its type converters
        // but we exposed the "org.apache.camel.core" package in camel-core. This ensures there is at least one
        // packageName to scan, which triggers the scanning process. That allows us to ensure that we look for
        // META-INF/services in all the JARs.
        if (packageNames.length == 1 && "org.apache.camel.core".equals(packageNames[0])) {
            LOG.debug("No additional package names found in classpath for annotated type converters.");
            // no additional package names found to load type converters so break out
            return;
        }

        // now filter out org.apache.camel.core as its not needed anymore (it was just a dummy)
        packageNames = filterUnwantedPackage("org.apache.camel.core", packageNames);

        // filter out package names which can be loaded as a class directly so we avoid package scanning which
        // is much slower and does not work 100% in all runtime containers
        Set<Class<?>> classes = new HashSet<Class<?>>();
        packageNames = filterPackageNamesOnly(resolver, packageNames, classes);
        if (!classes.isEmpty()) {
            LOG.info("Loaded " + classes.size() + " @Converter classes");
        }

        // if there is any packages to scan and load @Converter classes, then do it
        if (packageNames != null && packageNames.length > 0) {
            LOG.trace("Found converter packages to scan: {}", packageNames);
            Set<Class<?>> scannedClasses = resolver.findAnnotated(Converter.class, packageNames);
            if (scannedClasses.isEmpty()) {
                throw new TypeConverterLoaderException("Cannot find any type converter classes from the following packages: " + Arrays.asList(packageNames));
            }
            LOG.info("Found " + packageNames.length + " packages with " + scannedClasses.size() + " @Converter classes to load");
            classes.addAll(scannedClasses);
        }
View Full Code Here

            // must be synchronized to ensure we don't load type converters concurrently
            // which cause Camel apps to fails in OSGi thereafter
            try {
                loader.load(registry);
            } catch (Exception e) {
                throw new TypeConverterLoaderException("Cannot load type converters using OSGi bundle: " + bundle.getBundleId(), e);
            }
        }
View Full Code Here

    public void load(TypeConverterRegistry registry) throws TypeConverterLoaderException {
        String[] packageNames;
        try {
            packageNames = findPackageNames();
            if (packageNames == null || packageNames.length == 0) {
                throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.");
            }
        } catch (Exception e) {
            throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.", e);
        }

        Set<Class<?>> classes = resolver.findAnnotated(Converter.class, packageNames);
        if (classes == null || classes.isEmpty()) {
            throw new TypeConverterLoaderException("Cannot find any type converter classes from the following packages: " + Arrays.asList(packageNames));
        }

        LOG.info("Found " + packageNames.length + " packages with " + classes.size() + " @Converter classes to load");

        for (Class type : classes) {
View Full Code Here

        LOG.trace("Searching for {} services", META_INF_SERVICES);
        try {
            packageNames = findPackageNames();
            if (packageNames == null || packageNames.length == 0) {
                throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.");
            }
        } catch (Exception e) {
            throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.", e);
        }

        // if we only have camel-core on the classpath then we have already pre-loaded all its type converters
        // but we exposed the "org.apache.camel.core" package in camel-core. This ensures there is at least one
        // packageName to scan, which triggers the scanning process. That allows us to ensure that we look for
        // META-INF/services in all the JARs.
        if (packageNames.length == 1 && "org.apache.camel.core".equals(packageNames[0])) {
            LOG.debug("No additional package names found in classpath for annotated type converters.");
            // no additional package names found to load type converters so break out
            return;
        }

        // now filter out org.apache.camel.core as its not needed anymore (it was just a dummy)
        packageNames = filterUnwantedPackage("org.apache.camel.core", packageNames);

        // filter out package names which can be loaded as a class directly so we avoid package scanning which
        // is much slower and does not work 100% in all runtime containers
        Set<Class<?>> classes = new HashSet<Class<?>>();
        packageNames = filterPackageNamesOnly(resolver, packageNames, classes);
        if (!classes.isEmpty()) {
            LOG.debug("Loaded " + classes.size() + " @Converter classes");
        }

        // if there is any packages to scan and load @Converter classes, then do it
        if (packageNames != null && packageNames.length > 0) {
            LOG.trace("Found converter packages to scan: {}", packageNames);
            Set<Class<?>> scannedClasses = resolver.findAnnotated(Converter.class, packageNames);
            if (scannedClasses.isEmpty()) {
                throw new TypeConverterLoaderException("Cannot find any type converter classes from the following packages: " + Arrays.asList(packageNames));
            }
            LOG.debug("Found " + packageNames.length + " packages with " + scannedClasses.size() + " @Converter classes to load");
            classes.addAll(scannedClasses);
        }
View Full Code Here

            // must be synchronized to ensure we don't load type converters concurrently
            // which cause Camel apps to fails in OSGi thereafter
            try {
                loader.load(registry);
            } catch (Exception e) {
                throw new TypeConverterLoaderException("Cannot load type converters using OSGi bundle: " + bundle.getBundleId(), e);
            }
        }
View Full Code Here

        LOG.trace("Searching for {} services", META_INF_SERVICES);
        try {
            packageNames = findPackageNames();
            if (packageNames == null || packageNames.length == 0) {
                throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.");
            }
        } catch (Exception e) {
            throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.", e);
        }

        // if we only have camel-core on the classpath then we have already pre-loaded all its type converters
        // but we exposed the "org.apache.camel.core" package in camel-core. This ensures there is at least one
        // packageName to scan, which triggers the scanning process. That allows us to ensure that we look for
        // META-INF/services in all the JARs.
        if (packageNames.length == 1 && "org.apache.camel.core".equals(packageNames[0])) {
            LOG.debug("No additional package names found in classpath for annotated type converters.");
            // no additional package names found to load type converters so break out
            return;
        }

        // now filter out org.apache.camel.core as its not needed anymore (it was just a dummy)
        packageNames = filterUnwantedPackage("org.apache.camel.core", packageNames);

        // filter out package names which can be loaded as a class directly so we avoid package scanning which
        // is much slower and does not work 100% in all runtime containers
        Set<Class<?>> classes = new HashSet<Class<?>>();
        packageNames = filterPackageNamesOnly(resolver, packageNames, classes);
        if (!classes.isEmpty()) {
            LOG.info("Loaded " + classes.size() + " @Converter classes");
        }

        // if there is any packages to scan and load @Converter classes, then do it
        if (packageNames != null && packageNames.length > 0) {
            LOG.trace("Found converter packages to scan: {}", packageNames);
            Set<Class<?>> scannedClasses = resolver.findAnnotated(Converter.class, packageNames);
            if (scannedClasses.isEmpty()) {
                throw new TypeConverterLoaderException("Cannot find any type converter classes from the following packages: " + Arrays.asList(packageNames));
            }
            LOG.info("Found " + packageNames.length + " packages with " + scannedClasses.size() + " @Converter classes to load");
            classes.addAll(scannedClasses);
        }
View Full Code Here

    public void load(TypeConverterRegistry registry) throws TypeConverterLoaderException {
        String[] packageNames;
        try {
            packageNames = findPackageNames();
            if (packageNames == null || packageNames.length == 0) {
                throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.");
            }
        } catch (Exception e) {
            throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.", e);
        }

        Set<Class<?>> classes = resolver.findAnnotated(Converter.class, packageNames);
        if (classes == null || classes.isEmpty()) {
            throw new TypeConverterLoaderException("Cannot find any type converter classes from the following packages: " + Arrays.asList(packageNames));
        }

        LOG.info("Found " + packageNames.length + " packages with " + classes.size() + " @Converter classes to load");

        for (Class type : classes) {
View Full Code Here

        LOG.trace("Searching for {} services", META_INF_SERVICES);
        try {
            packageNames = findPackageNames();
            if (packageNames == null || packageNames.length == 0) {
                throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.");
            }
        } catch (Exception e) {
            throw new TypeConverterLoaderException("Cannot find package names to be used for classpath scanning for annotated type converters.", e);
        }

        // if we only have camel-core on the classpath then we have already pre-loaded all its type converters
        // but we exposed the "org.apache.camel.core" package in camel-core. This ensures there is at least one
        // packageName to scan, which triggers the scanning process. That allows us to ensure that we look for
        // META-INF/services in all the JARs.
        if (packageNames.length == 1 && "org.apache.camel.core".equals(packageNames[0])) {
            LOG.debug("No additional package names found in classpath for annotated type converters.");
            // no additional package names found to load type converters so break out
            return;
        }

        // now filter out org.apache.camel.core as its not needed anymore (it was just a dummy)
        packageNames = filterUnwantedPackage("org.apache.camel.core", packageNames);

        // filter out package names which can be loaded as a class directly so we avoid package scanning which
        // is much slower and does not work 100% in all runtime containers
        Set<Class<?>> classes = new HashSet<Class<?>>();
        packageNames = filterPackageNamesOnly(resolver, packageNames, classes);
        if (!classes.isEmpty()) {
            LOG.info("Loaded " + classes.size() + " @Converter classes");
        }

        // if there is any packages to scan and load @Converter classes, then do it
        if (packageNames != null && packageNames.length > 0) {
            LOG.trace("Found converter packages to scan: {}", packageNames);
            Set<Class<?>> scannedClasses = resolver.findAnnotated(Converter.class, packageNames);
            if (scannedClasses.isEmpty()) {
                throw new TypeConverterLoaderException("Cannot find any type converter classes from the following packages: " + Arrays.asList(packageNames));
            }
            LOG.info("Found " + packageNames.length + " packages with " + scannedClasses.size() + " @Converter classes to load");
            classes.addAll(scannedClasses);
        }
View Full Code Here

TOP

Related Classes of org.apache.camel.TypeConverterLoaderException

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.