private synchronized static void loadInstalledDecoders() throws DataDecodeException { if (installedDecoders == null) { // Attempt to find configured decoders. final List<Class<DataDecoder>> decoders = ClassUtil.getClasses("META-INF/data-decoders.inf", DataDecoder.class); if (decoders.isEmpty()) { throw new DataDecodeException("Failed to find installed DataDecoders on classpath."); } // Prepare to initialize decoders. final Map<Class, Class<? extends DataDecoder>> loadedDecoders = new HashMap<Class, Class<? extends DataDecoder>>(); for (final Class<DataDecoder> decoder : decoders) { final DecodeType decodeType = decoder.getAnnotation(DecodeType.class); if (decodeType != null) { for (final Class type : decodeType.value()) { if (loadedDecoders.containsKey(type)) { logger.warn("More than one DataDecoder for type '" + type.getName() + "' is installed on the classpath. You must manually configure decoding of this type, where required."); loadedDecoders.put(type, null); // We don't remove, because we need to maintain a record of this! } else { loadedDecoders.put(type, decoder); } } } } // Save the loaded decoders so that they can be reused. installedDecoders = loadedDecoders; } }
private synchronized static void loadInstalledDecoders() throws DataDecodeException { if (installedDecoders == null) { // Attempt to find configured decoders. final List<Class<DataDecoder>> decoders = ClassUtil.getClasses("META-INF/data-decoders.inf", DataDecoder.class); if (decoders.isEmpty()) { throw new DataDecodeException("Failed to find installed DataDecoders on classpath."); } // Prepare to initialize decoders. final Map<Class, Class<? extends DataDecoder>> loadedDecoders = new HashMap<Class, Class<? extends DataDecoder>>(); for (final Class<DataDecoder> decoder : decoders) { final DecodeType decodeType = decoder.getAnnotation(DecodeType.class); if (decodeType != null) { for (final Class type : decodeType.value()) { if (loadedDecoders.containsKey(type)) { logger.warn("More than one DataDecoder for type '" + type.getName() + "' is installed on the classpath. You must manually configure decoding of this type, where required."); loadedDecoders.put(type, null); // We don't remove, because we need to maintain a record of this! } else { loadedDecoders.put(type, decoder); } } } } // Save the loaded decoders so that they can be reused. installedDecoders = loadedDecoders; } }
private synchronized static void loadInstalledDecoders() throws DataDecodeException { if (installedDecoders == null) { // Attempt to find configured decoders. final List<Class<DataDecoder>> decoders = ClassUtil.getClasses("META-INF/data-decoders.inf", DataDecoder.class); if (decoders.isEmpty()) { throw new DataDecodeException("Failed to find installed DataDecoders on classpath."); } // Prepare to initialize decoders. final Map<Class, Class<? extends DataDecoder>> loadedDecoders = new HashMap<Class, Class<? extends DataDecoder>>(); for (final Class<DataDecoder> decoder : decoders) { final DecodeType decodeType = decoder.getAnnotation(DecodeType.class); if (decodeType != null) { for (final Class type : decodeType.value()) { if (loadedDecoders.containsKey(type)) { logger.warn("More than one DataDecoder for type '" + type.getName() + "' is installed on the classpath. You must manually configure decoding of this type, where required."); loadedDecoders.put(type, null); // We don't remove, because we need to maintain a record of this! } else { loadedDecoders.put(type, decoder); } } } } // Save the loaded decoders so that they can be reused. installedDecoders = loadedDecoders; } }
synchronized (FactoryDefinitionParserFactory.class) { if(aliasToClassMap == null) { List<Class<FactoryDefinitionParser>> factories = ClassUtil.getClasses("META-INF/smooks-javabean-factory-definition-parsers.inf", FactoryDefinitionParser.class);
synchronized (FactoryDefinitionParserFactory.class) { if(aliasToClassMap == null) { List<Class<FactoryDefinitionParser>> factories = ClassUtil.getClasses("META-INF/smooks-javabean-factory-definition-parsers.inf", FactoryDefinitionParser.class);
synchronized (FactoryDefinitionParserFactory.class) { if(aliasToClassMap == null) { List<Class<FactoryDefinitionParser>> factories = ClassUtil.getClasses("META-INF/smooks-javabean-factory-definition-parsers.inf", FactoryDefinitionParser.class);