001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 019 package org.apache.commons.betwixt.strategy; 020 021 import org.apache.commons.betwixt.io.read.MappingAction; 022 import org.apache.commons.betwixt.io.read.ReadContext; 023 import org.xml.sax.Attributes; 024 025 /** 026 * <p> 027 * Pluggable strategy interface used for free mappings. 028 * </p> 029 * <p> 030 * Free mappings (ones where the current mapping ) 031 * are executed by calling a <code>ActionMappingStrategy</code> 032 * implementation. 033 * So, using a custom strategy is an easy way to 034 * customize the mapping. 035 * </p> 036 * @author <a href='http://commons.apache.org/'>Apache Commons Team</a> 037 * @version $Revision: 561314 $ 038 */ 039 public abstract class ActionMappingStrategy { 040 041 /** 042 * Default <code>ActionMappingStrategy</code> 043 * used by betwixt 044 */ 045 public static final ActionMappingStrategy DEFAULT 046 = new DefaultActionMappingStrategy(); 047 048 /** 049 * Gets the mapping action to map the given element. 050 * @param namespace not null 051 * @param name not null 052 * @param attributes <code>Attributes</code>, not null 053 * @param context <code>ReadContext</code>, not null 054 * @return <code>MappingAction</code>, not null 055 * @throws Exception 056 */ 057 public abstract MappingAction getMappingAction( 058 String namespace, 059 String name, 060 Attributes attributes, 061 ReadContext context) 062 throws Exception; 063 }