View Javadoc
1   /*
2    * Copyright 2007 Joachim Grueneis
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5    * in compliance with the License. You may obtain a copy of the License at
6    *
7    * http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software distributed under the License
10   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11   * or implied. See the License for the specific language governing permissions and limitations under
12   * the License.
13   */
14  package org.exolab.castor.xml.util;
15  
16  import java.util.Map;
17  
18  import org.exolab.castor.xml.ResolverException;
19  
20  /**
21   * A command used by a resolver strategy to get class descriptors. A command may return none, a
22   * single class descriptor or multiple class descriptors and even if class descriptors are returned,
23   * is not garanteed that the requested descriptor is within. No exceptions are thrown if the class
24   * could not be resolved - this is a possible result! Commands are planned to be something like a
25   * service which might get invoked multiple times in parallel. So no resolve specific states are
26   * allowed to be stored in the class state!
27   * 
28   * @author <a href="mailto:jgrueneis AT gmail DOT com">Joachim Grueneis</a>
29   * @version $Revision$ $Date$
30   * @since 1.2
31   */
32  public interface ResolverClassCommand {
33    /**
34     * The one and only purpose resolver commands are good for ;-) . It can be called with className
35     * and clazz set, so the command decides which suites it best or at least one of the two arguments
36     * set.
37     * 
38     * @param className the name of the class to resolve
39     * @param p the Properties to be used at resolve
40     * @return a Map of className and XMLClassDescriptor
41     * @throws IllegalArgumentException if both parameters are null
42     * @throws ResolverException in case that resolving fails fatally
43     */
44    public Map resolve(String className, Map p) throws ResolverException;
45  }