templateInfo info = getTemplateInfo( reply );
if ( info == null ){
throw( new PlatformMessengerException( "Invalid reply: " + reply ));
}
String name = (String)reply.get( "name" );
String value = (String)reply.get( "value" );
String engine_type = (String)reply.get( "engine_id" );
if ( name == null || value == null || engine_type == null ){
throw( new PlatformMessengerException( "Invalid reply; field missing: " + reply ));
}
int type;
if ( engine_type.equals( "json" )){
type = templateDetails.ENGINE_TYPE_JSON;
}else if ( engine_type.equals( "regexp" )){
type = templateDetails.ENGINE_TYPE_REGEXP;
}else{
throw( new PlatformMessengerException( "Invalid type '" + engine_type + ": " + reply ));
}
return( new templateDetails( info, type, name, value ));
}