HoRequest.java :  » J2EE » WiSerFramework » de » ug2t » channel » ho » Java Open Source

Java Open Source » J2EE » WiSerFramework 
WiSerFramework » de » ug2t » channel » ho » HoRequest.java
// @@
// @@
/*
 * Wi.Ser Framework
 *
 * LGPL Version: 1.8.1, 20-September-2007  
 * Copyright (C) 2005-2006 Dirk von der Weiden <dvdw@imail.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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 GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library located in LGPL.txt in the 
 * license directory; if not, write to the 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA  02111-1307, USA.
 * 
 * If this agreement does not cover your requirements, please contact us
 * via email to get detailed information about the commercial license 
 * or our service offerings!
 *
 */
// @@

package de.ug2t.channel.ho;

import java.io.*;
import java.util.*;

import javax.swing.*;

import de.ug2t.channel.ho.session.*;
import de.ug2t.kernel.*;
import de.ug2t.unifiedGui.interfaces.*;
import de.ug2t.xmlScript.*;

public class HoRequest implements IHoRequest, Serializable
{
  private Map                  pem_submitValues = new HashMap();
  private transient IHoSession pem_session      = null;
  private IUnApplication       pem_appl         = null;
  // @@

  public HoRequest(IHoSession xSession, IUnApplication xAppl)
  {
    this.pem_session = xSession;
    this.pem_appl = xAppl;
  }

  /*
   * (non-Javadoc)
   * 
   * @see de.ug2t.channel.ho.session.IHoRequest#pcmf_setSubmitValue(java.lang.String,
   *      java.lang.String)
   */
  public synchronized Object pcmf_setSubmitValue(String xKey, String xValue)
  {
    return (this.pem_submitValues.put(xKey, xValue));
  };

  /*
   * (non-Javadoc)
   * 
   * @see de.ug2t.channel.ho.session.IHoRequest#pcmf_clearSubmitValues()
   */
  public synchronized void pcmf_clearSubmitValues()
  {
    this.pem_submitValues.clear();

    return;
  };

  /*
   * (non-Javadoc)
   * 
   * @see de.ug2t.channel.ho.session.IHoRequest#pcmf_submit()
   */
  public synchronized void pcmf_submit()
  {
    // @@

    Iterator l_it = this.pem_submitValues.keySet().iterator();
    KeStringTemplateWrapper l_remCall = new KeStringTemplateWrapper("");
    Object l_key = null;
    Object l_val = null;

    if (this.pem_session.pcmf_isAlive() == false)
    {
      JOptionPane.showMessageDialog(null, "Server connection lost! Client will be closed");
      System.exit(-1);
    }

    if (this.pem_session.pcmf_isInTransaction())
    {
      ScXmlScript.pcmf_createPBody(l_remCall);
    }
    else
    {
      ScXmlScript.pcmf_createxScriptString(l_remCall, null);
      ScXmlScript.pcmf_addProc(l_remCall, null);
    };

    Map l_values = this.pem_submitValues;
    
    String l_appl = KeRegisteredObject.pcmf_getObjName(this.pem_appl);
    if (l_appl == null)
      l_appl = IUnApplication.MY_APPL;
    
    while (l_it.hasNext())
    {
      l_key = l_it.next();
      l_val = l_values.get(l_key);
      ScXmlScript.pcmf_addCall(l_remCall, null, l_appl, "pcmf_setSubmitVal");
      ScXmlScript.pcmf_addCallPar(l_remCall, (String) l_key, "false", "java.lang.String");
      ScXmlScript.pcmf_addCallPar(l_remCall, (String) l_val, "false", "java.lang.String");
      ScXmlScript.pcmf_endCallPar(l_remCall);
    };

    pcmf_clearSubmitValues();

    ScXmlScript.pcmf_addCall(l_remCall, null, l_appl, "pcmf_work");
    ScXmlScript.pcmf_addCallPar(l_remCall, "null", "false", "java.lang.Object");
    ScXmlScript.pcmf_addCallPar(l_remCall, "null", "false", "java.lang.Object");
    ScXmlScript.pcmf_addCallPar(l_remCall, "true", "false", "boolean");

    ScXmlScript.pcmf_endAll(l_remCall);

    this.pem_session.pcmf_call(l_remCall.toString(), null);
    
    if (this.pem_session.pcmf_isAlive() == false)
    {
      JOptionPane.showMessageDialog(null, "Server connection lost! Client will be closed");
      System.exit(-1);
    }
  };

  public void pcmf_setInPlayBack(boolean xIn)
  {
    // @@
  }
}

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.