package ebxml.oneway.binary.advanced; 

import com.bea.control.ServiceBrokerControl;
import com.bea.jpd.JpdContext;
import com.bea.data.RawData;
import com.bea.wli.control.broker.MessageBroker;
import com.bea.wli.jpd.Callback;
import com.bea.wli.jpd.CallbackInterface;
import com.bea.xml.XmlObjectList;
import org.apache.beehive.controls.api.bean.Control;
import org.apache.beehive.controls.api.events.EventHandler;
import org.apache.xmlbeans.XmlObject;
import com.bea.data.MessageAttachment;
import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;

/**
 * Code in this area is generated automatically.
 *
 * 2-way editing is fully supported in the Process Language.
 * Changes you make here will appear in the Design View.
 *
 * @jpd:process process::
 * <process name="BinarySeller">
 *   <clientRequest name="Receive request" method="request"/>
 *   <controlSend name="setProperties" method="fileSetProperties"/>
 *   <controlSend name="write" method="fileWrite"/>
 * </process>::
 *
 * binding="ebxml"
 *
 * @jpd:ebxml protocol-name="ebxml" ebxml-service-name="DynamicBinarySeller" ebxml-action-mode="non-default"
 */
@com.bea.wli.jpd.EbXML(protocolName = com.bea.wli.jpd.EbXML.PROTOCOL.ebXML, 
                       ebxmlServiceName = "DynamicBinarySeller", 
                       ebxmlActionMode = "non-default")
@com.bea.wli.jpd.Process(process = "<process name=\"BinarySeller\"> " +
                                   "  <clientRequest name=\"Receive request\" method=\"request\"/> " +
                                   "  <controlSend name=\"setProperties\" method=\"fileSetProperties\"/> " +
                                   "  <controlSend name=\"write\" method=\"fileWrite\"/> " +
                                   "</process>",
                         binding = com.bea.wli.jpd.Process.Binding.EBXML)
public class DynamicBinarySeller implements com.bea.jpd.ProcessDefinition
{
    public com.bea.wli.control.dynamicProperties.FileControlPropertiesDocument fileControlProps;

    public EnvelopeDocument envelope;

    public static final java.lang.String baseDirectory = "C:/tptutorial/binary-in/dynamic/";

    public com.bea.data.RawData data;
    @com.bea.wli.jpd.Callback()
    public Callback callback; // (..variable insertion marker - do not modify this line)
    
    /*
     * The area above this comment contains Variable Declarations created from the Design View.
     * The area below this comment contains Control Declarations created from the Design View.
     * 
     * Code in these areas is generated automatically.
     * 
     * 2-Way editing is fully supported in these areas of code.
     * Warning: changing Process Variables and Control Declarations already in use by your application
     * may generate errors in your application if you do not update these declarations
     * in all locations where they are used.
     */
    
    /**
     * @common:control
     */
    @Control()
    private ebxml.oneway.binary.File file;

    /**
     * This is a control instance, which will be instantiated automatically at runtime.
     * @jpd:transform
     */
    @com.bea.wli.jpd.Transform()
    private ebxml.oneway.binary.advanced.DynamicBinarySellerTransformation transformations;

    /**
     * @common:context
     */
    @com.bea.wli.jpd.Context()
    JpdContext context; //(..control insertion marker - do not modify this line)
    
    /*
     * The area below this comment contains java methods referenced by communication nodes in the Process Language.
     *
     * Code in this area is generated automatically.
     *
     * 2-Way editing is partially supported in this area of code.
     * Warning: you can safely add code inside a method body but it must be outside of any PROTECTED SECTION
     * block comments. Modifications to code within these comments will prevent you from viewing information
     * in the Design View builder that generated this code.
     */
    
    /*
     * Code inserted below this comment is for methods corresponding to Perform or Condition nodes
     * created in the Design View.
     *
     * Feel free to make modifications or add new code here.
     */
    
    /**
     * @jpd:ebxml-method envelope="{env}"
     */
    @com.bea.wli.jpd.EbXMLMethod(envelope = "{env}")
    public void request(com.bea.data.RawData data, EnvelopeDocument env)
    {
        //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
        // input transform
        // parameter assignment
        this.data = data;
        this.envelope = env;
        //#END  : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
    }


    
    public void fileWrite() throws Exception
    {
        //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
        // input transform
        // return method call
        file.write(this.data);
        // output transform
        // output assignments
        //#END  : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
    }

    public void fileSetProperties() throws Exception
    {
        //#START: CODE GENERATED - PROTECTED SECTION - you can safely add code above this comment in this method. #//
        // input transform
        com.bea.wli.control.dynamicProperties.FileControlPropertiesDocument obj = transformations.fileSetProperties(this.baseDirectory, this.envelope);
        // method call
        file.setProperties(obj);
        // output transform
        // output assignments
        //#END  : CODE GENERATED - PROTECTED SECTION - you can safely add code below this comment in this method. #//
    }

	@CallbackInterface()
    public interface Callback extends ServiceBrokerControl
    {
        /**
         * @common:message-buffer enable="false"
         */
		@com.bea.wli.common.MessageBuffer(enable = false)
        public void sendReply(XmlObject response);
    }
    

} 
