/*********************************************************************
* ClassAndMethodArrayInvocationStrategy.java
* created on 09.07.2006 by netseeker
* $Source$
* $Date$
* $Revision$
*
* ====================================================================
*
* Copyright 2006 netseeker aka Michael Manske
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*
* This file is part of the EJOE framework.
* For more information on the author, please see
* <http://www.manskes.de/>.
*
*********************************************************************/
package de.netseeker.ejoe.ext.crispy;
import java.util.Map;
import net.sf.crispy.InvocationException;
import net.sf.crispy.InvocationStrategy;
import de.netseeker.ejoe.request.RemotingRequest;
/**
* @author netseeker
* @since 0.3.9.1
*/
public class ClassAndMethodArrayInvocationStrategy implements InvocationStrategy
{
/*
* (non-Javadoc)
*
* @see net.sf.crispy.InvocationStrategy#convert(java.util.Map)
*/
public Object convert( Map pvPropertyMap )
{
String lvClass = (String) pvPropertyMap.get( InvocationStrategy.CLASS_NAME );
String lvMethod = (String) pvPropertyMap.get( InvocationStrategy.METHOD_NAME );
if ( (lvClass == null) || (lvMethod == null) )
{
throw new InvocationException( "Error in the InvocationStrategy " + this.getClass().getName() + ". "
+ "The class: " + lvClass + " and the method: " + lvMethod + " must be unequal null!" );
}
RemotingRequest request = new RemotingRequest();
request.setClazz( lvClass );
request.setMethod( lvMethod );
return request;
}
}