/*====================================================================
Tnis file was produced by the OpenCCM ir3_jimpl generator.
OpenCCM: The Open CORBA Component Model Platform
Copyright (C) 2000-2002 USTL - LIFL - GOAL
Contact: openccm-team@objectweb.org
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.1 of the License, or 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; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
USA
Initial developer(s): Philippe Merle, Mathieu Vadet.
Contributor(s): ______________________________________.
====================================================================*/
package cadena.mediumsp;
import cadena.common.CCM_ReadData;
import cadena.common.CCM_DataAvailableConsumer;
import cadena.common.CCM_ReadWriteData;
import cadena.common.ReadData;
/**
 **  Implementation skeleton class for the ::mediumsp::BMOpenED4 component.
 **  Business operations MUST be completed !!!
 **/
public class BMOpenED4MonolithicImpl
       extends org.omg.CORBA.LocalObject
    implements CCM_BMOpenED4,
	       CCM_ReadData, CCM_DataAvailableConsumer, CCM_ReadWriteData,
	       org.omg.Components.SessionComponent
{
    // ==================================================================
    //
    // Internal State.
    //
    // ===================================================================
    private String data;
    /**
     **  Context reference.
     **/
    private CCM_BMOpenED4_Context the_context_;
    // ==================================================================
    //
    // Constructor.
    //
    // ===================================================================
    /**
     **  The default constructor.
     **/
    public
    BMOpenED4MonolithicImpl()
    {
        the_context_ = null;
    }
    // ==================================================================
    //
    // Internal methods.
    //
    // ===================================================================
    // ==================================================================
    //
    // Public methods.
    //
    // ===================================================================
    /**
     **  To obtain the context.
     **
     **  @return The context that has been previously set by
     **          the set_session_context operation.
     **/
    public CCM_BMOpenED4_Context
    getContext()
    {
        return the_context_;
    }
    // ==================================================================
    //
    // Methods for the OMG IDL Components::EnterpriseComponent local interface.
    //
    // ==================================================================
    //
    //  IDL:omg.org/Components/EnterpriseComponent/configuration_complete:1.0
    //
    /**
     **  Completes the component configuration.
     **
     **  @throws org.omg.Components.InvalidConfiguration
     **          Thrown if the configuration is invalid.
     **/
    public void
    configuration_complete()
    throws org.omg.Components.InvalidConfiguration
    {
        //
        //  TODO : implement !!!
        //
    }
    // ==================================================================
    //
    // Methods for the OMG IDL Components::SessionComponent local interface.
    //
    // ==================================================================
    //
    //  IDL:omg.org/Components/SessionComponent/set_session_context:1.0
    //
    /**
     *  Called by the container when the component session context will be fixed.
     *
     *  @param context The session context.
     *
     *  @throws org.omg.Components.CCMException
     *          Thrown if a system level error occured.
     */
    public void
    set_session_context(org.omg.Components.SessionContext context)
    throws org.omg.Components.CCMException
    {
        the_context_ = (CCM_BMOpenED4_Context)context;
    }
    //
    //  IDL:omg.org/Components/SessionComponent/ccm_activate:1.0
    //
    /**
     *
     * Called by the container when the component will be activated.
     *
     *  @throws org.omg.Components.CCMException
     *          Thrown if a system level error occured.
     */
    public void 
    ccm_activate()
    throws org.omg.Components.CCMException
    {
        //
        // Unused by actual OpenCCM containers
        //
    }
    //
    //  IDL:omg.org/Components/SessionComponent/ccm_passivate:1.0
    //
    /**
     *
     * Called by the container when the component will be passivated.
     *
     *  @throws org.omg.Components.CCMException
     *          Thrown if a system level error occured.
     */
    public void 
    ccm_passivate()
    throws org.omg.Components.CCMException
    {
        //
        // Unused by actual OpenCCM containers
        //
    }
    //
    //  IDL:omg.org/Components/SessionComponent/ccm_remove:1.0
    //
    /**
     *
     * Called by the container when the component will be removed.
     *
     *  @throws org.omg.Components.CCMException
     *          Thrown if a system level error occured.
     */
    public void 
    ccm_remove()
    throws org.omg.Components.CCMException
    {
        //
        // TO DO: implement !!!
        //
    }
    // ==================================================================
    //
    // Public methods for the CCM_BMOpenED4 local interface.
    //
    // ==================================================================
    //
    //  IDL:cadena/mediumsp/CCM_BMOpenED4/get_dataOut:1.0
    //
    /**
     **  Implementation of the ::mediumsp::CCM_BMOpenED4::get_dataOut operation.
     **/
    public cadena.common.CCM_ReadData
    get_dataOut()
    {
        return this;
    }
    //
    //  IDL:cadena/mediumsp/CCM_BMOpenED4/get_dataWriteIn:1.0
    //
    /**
     **  Implementation of the ::mediumsp::CCM_BMOpenED4::get_dataWriteIn operation.
     **/
    public cadena.common.CCM_ReadWriteData
    get_dataWriteIn()
    {
        return this;
    }
    public String data(){
        return data;
    }
    public void data(String d){
        data = d;
    }

    //
    //  IDL:cadena/mediumsp/CCM_BMOpenED4/push_inDataAvailable1:1.0
    //
    /**
     **  Implementation of the ::mediumsp::CCM_BMOpenED4::push_inDataAvailable1 operation.
     **/
    int leg=0;
    public void
    push_inDataAvailable1(cadena.common.DataAvailable event)
    {
	leg=1;
	push(event);
    }
    //
    //  IDL:cadena/mediumsp/CCM_BMOpenED4/push_inDataAvailable2:1.0
    //
    /**
     **  Implementation of the ::mediumsp::CCM_BMOpenED4::push_inDataAvailable2 operation.
     **/
    public void
    push_inDataAvailable2(cadena.common.DataAvailable event)
    {
	leg=2;
	push(event);
    }
    //
    //  IDL:cadena/mediumsp/CCM_BMOpenED4/push_inDataAvailable3:1.0
    //
    /**
     **  Implementation of the ::mediumsp::CCM_BMOpenED4::push_inDataAvailable3 operation.
     **/
    public void
    push_inDataAvailable3(cadena.common.DataAvailable event)
    {
	leg=3;
	push(event);
    }
    //
    //  IDL:cadena/mediumsp/CCM_BMOpenED4/push_inDataAvailable4:1.0
    //
    /**
     **  Implementation of the ::mediumsp::CCM_BMOpenED4::push_inDataAvailable4 operation.
     **/
    public void
    push_inDataAvailable4(cadena.common.DataAvailable event)
    {
	leg=4;
	push(event);
    }
    //
    //  IDL:cadena/mediumsp/CCM_BMOpenED4/push_inDataAvailable5:1.0
    //
    /**
     **  Implementation of the ::mediumsp::CCM_BMOpenED4::push_inDataAvailable5 operation.
     **/
    public void
    push_inDataAvailable5(cadena.common.DataAvailable event)
    {
	leg=5;
	push(event);
    }
    public void push(cadena.common.DataAvailable event){
	if(leg==1) {
	    ReadData dataIn = the_context_.get_connection_dataIn1();
	    if(dataIn == null){
		System.err.println("The mediumsp::BMOpenED4::dataIn1 receptacle is not set!");
	    }
	    data="BMOpenED4 "+dataIn.data();
	    the_context_.push_outDataAvailable(new cadena.common.DataAvailableImpl( ));
	}else if(leg==2) {
	    ReadData dataIn = the_context_.get_connection_dataIn2();
	    if(dataIn == null){
		System.err.println("The mediumsp::BMOpenED4::dataIn2 receptacle is not set!");
	    }
	    data="BMOpenED4 "+dataIn.data();
	    the_context_.push_outDataAvailable(new cadena.common.DataAvailableImpl( ));
	}else if(leg==3) {
	    ReadData dataIn = the_context_.get_connection_dataIn3();
	    if(dataIn == null){
		System.err.println("The mediumsp::BMOpenED4::dataIn3 receptacle is not set!");
	    }
	    data="BMOpenED4 "+dataIn.data();
	    the_context_.push_outDataAvailable(new cadena.common.DataAvailableImpl( ));
	}else if(leg==4) {
	    ReadData dataIn = the_context_.get_connection_dataIn4();
	    if(dataIn == null){
		System.err.println("The mediumsp::BMOpenED4::dataIn4 receptacle is not set!");
	    }
	    data="BMOpenED4 "+dataIn.data();
	    the_context_.push_outDataAvailable(new cadena.common.DataAvailableImpl( ));
	}else if(leg==5) {
	    ReadData dataIn = the_context_.get_connection_dataIn5();
	    if(dataIn == null){
		System.err.println("The mediumsp::BMOpenED4::dataIn5 receptacle is not set!");
	    }
	    data="BMOpenED4 "+dataIn.data();
	    the_context_.push_outDataAvailable(new cadena.common.DataAvailableImpl( ));
	}else {
	    System.err.println("Error in mediumsp.BMOpenED4MonolithicImpl: leg="+leg);
	}
    }

}


syntax highlighted by Code2HTML, v. 0.9.1