1 /**********************************************************************
2 * ClassAndMethodArrayInvocationStrategy.java
3 * created on 09.07.2006 by netseeker
4 * $Source$
5 * $Date$
6 * $Revision$
7 *
8 * ====================================================================
9 *
10 * Copyright 2006 netseeker aka Michael Manske
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 * ====================================================================
24 *
25 * This file is part of the EJOE framework.
26 * For more information on the author, please see
27 * <http://www.manskes.de/>.
28 *
29 *********************************************************************/
30
31 package de.netseeker.ejoe.ext.crispy;
32
33 import java.util.Map;
34
35 import net.sf.crispy.InvocationException;
36 import net.sf.crispy.InvocationStrategy;
37 import de.netseeker.ejoe.request.RemotingRequest;
38
39 /***
40 * @author netseeker
41 * @since 0.3.9.1
42 */
43 public class ClassAndMethodArrayInvocationStrategy implements InvocationStrategy
44 {
45
46
47
48
49
50 public Object convert( Map pvPropertyMap )
51 {
52 String lvClass = (String) pvPropertyMap.get( InvocationStrategy.CLASS_NAME );
53 String lvMethod = (String) pvPropertyMap.get( InvocationStrategy.METHOD_NAME );
54
55 if ( (lvClass == null) || (lvMethod == null) )
56 {
57 throw new InvocationException( "Error in the InvocationStrategy " + this.getClass().getName() + ". "
58 + "The class: " + lvClass + " and the method: " + lvMethod + " must be unequal null!" );
59 }
60
61 RemotingRequest request = new RemotingRequest();
62 request.setClazz( lvClass );
63 request.setMethod( lvMethod );
64
65 return request;
66 }
67
68 }