/** * Copyright (C) 2003-2007 Funambol * * This program is free software; you can redistribute it and/or modify * it under the terms of the Honest Public License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * Honest Public License for more details. * * You should have received a copy of the Honest Public License * along with this program; if not, write to Funambol, * 643 Bair Island Road, Suite 305 - Redwood City, CA 94063, USA */ package br.com.prognus.psync.phones.s55; import java.util.ArrayList; import com.funambol.framework.core.*; import com.funambol.framework.engine.pipeline.InputMessageProcessor; import com.funambol.framework.engine.pipeline.MessageProcessingContext; import com.funambol.framework.logging.FunambolLogger; import com.funambol.framework.logging.FunambolLoggerFactory; import com.funambol.framework.protocol.ProtocolUtil; /** * This class store the synchronization alert code into processingContext. * * @version $Id: SyncRequestStore.java,v 1.3 2007-01-11 19:20:19 nichele Exp $ */ public class SyncRequestStore implements InputMessageProcessor { // ------------------------------------------------------------ Private data private static final FunambolLogger log = FunambolLoggerFactory.getLogger("engine.pipeline"); // ---------------------------------------------------------- Public methods /** * Process input message and set MessageProcessingContext property. * * @param processingContext the message processing context * @param message the message to be processed * @throws Sync4jException */ public void preProcessMessage(MessageProcessingContext processingContext, SyncML message) throws Sync4jException { if (log.isTraceEnabled()) { log.trace("preProcessMessage: SyncRequestStore of input message"); } Put clientCapabilities = null; try { AbstractCommand[] allCmd = (AbstractCommand[])message.getSyncBody().getCommands().toArray( new AbstractCommand[0]); // //Extract only alert commands // for (int i=0; (allCmd != null) && (i0) { clientCapabilities = (Put)clientCapabilitiesList.get(0); if (log.isTraceEnabled()) { log.trace("preProcessMessage: name clientCapabilities " + clientCapabilities.getName()); } DevInfItem item = (DevInfItem)clientCapabilities.getItems().get(0); DevInf di = item.getDevInfData().getDevInf(); String man = di.getMan(); processingContext.setRequestProperty(SlowFastSyncManagement.PROPERTY_MANTYPE, man); } } catch(Exception e) { log.error("Errore preprocessing the request", e); } } }