001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019 020 package org.apache.geronimo.genesis.plugins.script; 021 022 import org.apache.commons.logging.Log; 023 import org.apache.commons.logging.LogFactory; 024 import org.codehaus.plexus.component.configurator.ComponentConfigurationException; 025 import org.codehaus.plexus.component.configurator.ConfigurationListener; 026 import org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter; 027 import org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup; 028 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; 029 import org.codehaus.plexus.configuration.PlexusConfiguration; 030 031 /** 032 * Plexus converter for {@link DelayedConfiguration} objects. 033 * 034 * @version $Rev: 462757 $ $Date: 2006-10-11 03:24:37 -0700 (Wed, 11 Oct 2006) $ 035 */ 036 public class DelayedConfigurationConverter 037 extends AbstractConfigurationConverter 038 { 039 private static final Log log = LogFactory.getLog(DelayedConfigurationConverter.class); 040 041 public boolean canConvert(final Class type) { 042 return DelayedConfiguration.class.isAssignableFrom(type); 043 } 044 045 public Object fromConfiguration(final ConverterLookup converterLookup, 046 final PlexusConfiguration configuration, 047 final Class type, 048 final Class baseType, 049 final ClassLoader classLoader, 050 final ExpressionEvaluator expressionEvaluator, 051 final ConfigurationListener listener) 052 throws ComponentConfigurationException 053 { 054 if (log.isDebugEnabled()) { 055 log.debug("Capturing delayed config: " + configuration); 056 } 057 058 return new DelayedConfiguration(converterLookup, 059 configuration, 060 type, 061 baseType, 062 classLoader, 063 expressionEvaluator, 064 listener); 065 } 066 }