/* * This class comes as is, no warranties whatsoever. * Copyright Comerge AG 2009. All Rights Reserved." * * http://comerge.net */ package sudoku.internal; import javax.jms.JMSException; import javax.jms.TextMessage; import javax.jms.Message; import net.comerge.aranea.core.messages.AraneaMessage; import net.comerge.aranea.core.messages.AraneaMessageCreationException; import net.comerge.aranea.core.messages.AraneaMessageFactory; import org.json.JSONException; import org.json.JSONObject; import sudoku.core.*; /** * Factory for messages defined in the sudoku.core namespace. *

Generates messages for following types:

* * GENERATED DO NOT MODIFY * @author Comerge AG http://www.comerge.net */ public class SudokuCoreMessageFactory extends AraneaMessageFactory { private final SudokuCoreMessageJSONDeserializer fDeserializer; public SudokuCoreMessageFactory() { fDeserializer= new SudokuCoreMessageJSONDeserializer(); } /** * @inheritDoc */ @Override public AraneaMessage createMessage(Message message) throws AraneaMessageCreationException { String type= getType(message); if (SudokuCoreMessageConstants .MESSAGE_TYPE_NAME_SOLVE_SUDOKU_REQUEST.equals(type)) { return fDeserializer.deserializeSolveSudokuRequestMessage(message); } else if (SudokuCoreMessageConstants .MESSAGE_TYPE_NAME_SOLVED_SUDOKU_REPLY.equals(type)) { return fDeserializer.deserializeSolvedSudokuReplyMessage(message); } else { throw new AraneaMessageCreationException("Unknown message type <" + type + "> can not create a aranea message for the message <" + message + ">"); } } }