1. /*
  2. * Copyright 2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.apache.commons.betwixt.strategy;
  17. import org.apache.commons.betwixt.io.read.MappingAction;
  18. import org.apache.commons.betwixt.io.read.ReadContext;
  19. import org.xml.sax.Attributes;
  20. /**
  21. * <p>
  22. * Pluggable strategy interface used for free mappings.
  23. * </p>
  24. * <p>
  25. * Free mappings (ones where the current mapping )
  26. * are executed by calling a <code>ActionMappingStrategy</code>
  27. * implementation.
  28. * So, using a custom strategy is an easy way to
  29. * customize the mapping.
  30. * </p>
  31. * @author <a href='http://jakarta.apache.org/'>Jakarta Commons Team</a>
  32. * @version $Revision: 1.2 $
  33. */
  34. public abstract class ActionMappingStrategy {
  35. /**
  36. * Default <code>ActionMappingStrategy</code>
  37. * used by betwixt
  38. */
  39. public static final ActionMappingStrategy DEFAULT
  40. = new DefaultActionMappingStrategy();
  41. /**
  42. * Gets the mapping action to map the given element.
  43. * @param namespace not null
  44. * @param name not null
  45. * @param attributes <code>Attributes</code>, not null
  46. * @param context <code>ReadContext</code>, not null
  47. * @return <code>MappingAction</code>, not null
  48. * @throws Exception
  49. */
  50. public abstract MappingAction getMappingAction(
  51. String namespace,
  52. String name,
  53. Attributes attributes,
  54. ReadContext context)
  55. throws Exception;
  56. }