Skip to content
Siminov Framework edited this page Jan 17, 2016 · 3 revisions

Hybrid Applications biggest challange is to communicate between different technologies.

To overcome communication gap, Siminov has provided a layer know as Siminov Adapter Layer which is included in Siminov Hybrid Framework. It helps to remove communication barriers by providing a unique communication channel which talks to different technologies. Using this you can write any language code which communicate to different languages.

Siminov Adapter Layer depends on communication channel provided by native platform, it does not depend on 3rd party framework such as Phonegap Plugins to communicate between different technologies. Using this you can later use Siminov Hybrid Framework with other Open Source Project also like Appcelerator Titanium, etc.

Using Siminov Adapter

It provides easy configuration to use Siminov Adapter Layer. Siminov Hybrid Framework have provided Adapter Descriptor where you can define your adapter configuration.

Adapter Descriptor is one which describes properties required to map Hybrid to Native and vice-versa. It is optional descriptor.

                 <!-- Adapter Descriptor -->
    <adapter-descriptor>
    
        <!-- General Adapter Properties -->
            <!-- Mandatory Field -->
        <property name="name">adapter_name</property>
    	
            <!-- Optional Field -->
        <property name="description">adapter_description</property>
    
            <!-- Mandatory Field -->
        <property name="type">HYBRID-TO-NATIVE|NATIVE-TO-HYBRID</property>
    
            <!-- Optional Field -->
        <property name="map_to">name_of_adapter_class</property>

            <!-- Optional Field (DEFAULT: FALSE)-->
        <property name="cache">true/false</property>
    
        <!-- Handlers -->
            <!-- Handler -->
        <handlers>        
            <handler>
         
                <!-- General Handler Properties -->
                    <!-- Mandatory Field -->
                <property name="name">handler_name</property>
         
                    <!-- Optional Field -->
                <property name="description">handler_description</property>	            
          	            
                    <!-- Mandatory Field -->
                <property name="map_to">name_of_handler_method</property>	            
         	            	            	           
                <!-- Parameters -->
                <parameters>
             
                    <!-- Parameter -->
                    <parameter>
                 
                            <!-- Mandatory Field -->
                        <property name="name">name_of_parameter</property>
                 
                            <!-- Mandatory Field -->
                        <property name="type">parameter_type</property>
                 
                            <!-- Optional Field -->
                        <property name="description">description_of_parameter</property>
                 
                    </parameter>
                </parameters>
         
                <return>
             
                        <!-- Mandatory Field -->
                    <property name="type">return_type</property>
             
                        <!-- Optional Field -->
                    <property name="description">return_data_description</property>
             
                </return>

            </handler>

        </handlers>
    </adapter-descriptor>
  
    <adapter-descriptor>
    
        <property name="name">SIMINOV</property>
        <property name="description">Siminov Hybrid Handler</property>
        <property name="type">HYBRID-TO-NATIVE</property>
        <property name="map_to">siminov.hybrid.adapter.handlers.SiminovHandler</property>
    		
        <handlers>
        
            <handler>
            
                <property name="name">INITIALIZE-SIMINOV</property>
                <property name="map_to">initializeSiminov</property>
                <property name="description">Initialize Siminov</property>
                <property name="type">SYNC</property>
            	            
            </handler>
            <handler>
            
                <property name="name">SHUTDOWN-SIMINOV</property>
                <property name="map_to">shutdownSiminov</property>
                <property name="description">Shutdown Siminov</property>
                <property name="type">SYNC</property>
            	            
            </handler>
        
        </handlers>
    	    
    </adapter-descriptor>

Adapter Descriptor Elements

1. Adapter Tag

Adapter allows Hybrid and Native to work together that is normally not possible because of incompatible Technologies. Adapter basically maps JavaScript to Native and vice-versa.

  • name*: Name of Adapter. It is mandatory field.

  • description*: Description about Adapter. It is optional field.

  • type*: Type Of Adapter. It is mandatory field.

    - _**HYBRID-TO-NATIVE**_: It says this adapter maps JavaScript functions to Native functions.
    - _**NATIVE-TO-HYBRID**_: It says this adapter maps Native functions to JavaScript functions.
    
  • map_to*: Name of Class (Hybrid/Native) mapped to this adapter. It is not mandatory field.

  • cache*: TRUE/FALSE: It says that adapter mapped to Class needs to be cached or not. It is optional field. Default is false.

2. Handler Tag

Handler is one which handle request from HYBRID-TO-NATIVE or NATIVE-TO-HYBRID.

  • name*: Name of Handler. It is mandatory field.
  • description*: Description about Handler. It is optional field.
  • map_to*: Name of Handler function which handles request from HYBRID-TO-NATIVE or NATIVE-TO-HYBRID.
3. Parameter

Parameters are bacially arguments passed to handler.

  • name*: Name of Parameter. It is mandatory field.
  • description*: Description about Parameter. It is optional field.
  • type*: Type of Parameter. It is mandatory field.

######4. Return Return defines about data returned from handler.

  • type*: Type of Returned Data. It is mandatory field.
  • description*: Description about Return Data. It is optional field.

Note

  • If you define Adapter in AdapterDescriptor.xml file then define it in adapters TAG.

  • If you Adapter in seprate xml file then specify Adapter file path in AdapterDescriptor.xml file.