Quantcast
Channel: SCN : Blog List - Process Integration (PI) & SOA Middleware
Viewing all articles
Browse latest Browse all 676

Creating a custom HCI Adapter - Part 2

$
0
0

Overview

 

Part 2 - Create the HCI adapter

 

In Part 1 of this series we created the Camel component.  Now we need to wrap that component in a HCI adapter project. We will create the echo adapter using the echo component created in part 1.  The outcome of this part is a HCI adapter deployed on a tenant.

 

Step - Create the adapter project

The first thing todo is to create the adapter project.  For this you will need to open Eclipse and select File > New > Other..  Expand the SAP HANA Cloud Integration section and select Adapter Project

eclipse-wiz1.png

 

click Next.

eclipse-wiz2.png

fill in required fields and clickFinish

 

Step - Generate metadata

At this step you should have a project looking similar to:

adap-1.png

The project itself contains a few empty folders and a metadata.txt file.  Next we want to copy the echo-*.jar from the echo camel component project into the component folder of the echo adapter project.  Once done your adapter project should look like:

adap-2.png

The next action is to generate the component metadata.  You can read all about what component metadata is in the online help.  But it is basically the place where you setup the info required by the editor in design time. 


Right click on the echo-adapter project and select Generate Component Metadata

 

adap-3.png

Next, right click on the echo-adapter project and select Execute Checks.  The output of this step should be:

 

adap-4.png

Step - Modify metadata.xml

 

Expand the metadata folder and you will see a newly generate file named metadata.xml.  Open this file.  Notice that the generation tool inspected our echo component and generated appropriate xml content from it.  What we will do now is modify it a bit by removing unnecessary elements.

 

There are only two parameters we want users of our adapter to specify: first part URI and delay.  We can remove the others as the adapter will use default values.  Once done your metadata.xml should look like:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ComponentMetadata ComponentId="ctype::Adapter/cname::me:echo/version::1.0.0" ComponentName="me:echo" UIElementType="Adapter" IsExtension="false" IsFinal="true" IsPreserves="true" IsDefaultGenerator="true" MetadataVersion="2.0" xmlns:gen="http://www.sap.hci.adk.com/gen">    <Variant VariantName="Echo Component Sender" gen:RuntimeComponentBaseUri="echo" VariantId="ctype::AdapterVariant/cname::me:echo/tp::echo/mp::echo/direction::Sender" MetadataVersion="2.0" AttachmentBehavior="Preserve">        <InputContent Cardinality="1" Scope="outsidepool" MessageCardinality="1" isStreaming="false">            <Content>                <ContentType>Any</ContentType>                <Schema xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></Schema>            </Content>        </InputContent>        <OutputContent Cardinality="1" Scope="outsidepool" MessageCardinality="1" isStreaming="false">            <Content>                <ContentType>Any</ContentType>                <Schema xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></Schema>            </Content>        </OutputContent>        <Tab id="connection">            <GuiLabels guid="f20e0d5e-6204-42b8-80db-7dc179641528">                <Label language="EN">Connection</Label>                <Label language="DE">Connection</Label>            </GuiLabels>            <AttributeGroup id="defaultUriParameter">                <Name xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">URI Setting</Name>                <GuiLabels guid="fef82a37-793e-45d2-9c62-261a5a2987fa">                    <Label language="EN">URI Setting</Label>                    <Label language="DE">URI Setting</Label>                </GuiLabels>                <AttributeReference>                    <ReferenceName>firstUriPart</ReferenceName>                    <description>Configure First URI Part</description>                </AttributeReference>            </AttributeGroup>            <AttributeGroup id="echoEndpoint">                <Name xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Echo Endpoint</Name>                <GuiLabels guid="7a914dcf-ab5e-4dfc-a859-d4709bd7402d">                    <Label language="EN">Echo Endpoint</Label>                    <Label language="DE">Echo Endpoint</Label>                </GuiLabels>                <AttributeReference>                    <ReferenceName>delay</ReferenceName>                    <description>Configure Delay</description>                </AttributeReference>            </AttributeGroup>               </Tab>    </Variant>    <Variant VariantName="Echo Component Receiver" gen:RuntimeComponentBaseUri="echo" VariantId="ctype::AdapterVariant/cname::me:echo/tp::echo/mp::echo/direction::Receiver" IsRequestResponse="true" MetadataVersion="2.0" AttachmentBehavior="Preserve">        <InputContent Cardinality="1" Scope="outsidepool" MessageCardinality="1" isStreaming="false">            <Content>                <ContentType>Any</ContentType>                <Schema xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></Schema>            </Content>        </InputContent>        <OutputContent Cardinality="1" Scope="outsidepool" MessageCardinality="1" isStreaming="false">            <Content>                <ContentType>Any</ContentType>                <Schema xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></Schema>            </Content>        </OutputContent>        <Tab id="connection">            <GuiLabels guid="8c1e4365-b434-486a-8ec8-2a8fd370f77f">                <Label language="EN">Connection</Label>                <Label language="DE">Connection</Label>            </GuiLabels>            <AttributeGroup id="defaultUriParameter">                <Name xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">URI Setting</Name>                <GuiLabels guid="d1004d88-8e54-4f46-a5e7-e6e4d0dca053">                    <Label language="EN">URI Setting</Label>                    <Label language="DE">URI Setting</Label>                </GuiLabels>                <AttributeReference>                    <ReferenceName>firstUriPart</ReferenceName>                    <description>Configure First URI Part</description>                </AttributeReference>            </AttributeGroup>               </Tab>    </Variant>    <AttributeMetadata>        <Name>firstUriPart</Name>        <Usage>false</Usage>        <DataType>xsd:string</DataType>        <Default></Default>        <Length></Length>        <IsParameterized>true</IsParameterized>        <GuiLabels guid="eaa8b525-3e51-4d18-81ca-16ec828567dc">            <Label language="EN">First URI Part</Label>            <Label language="DE">First URI Part</Label>        </GuiLabels>    </AttributeMetadata>    <AttributeMetadata>        <Name>delay</Name>        <Usage>false</Usage>        <DataType>xsd:long</DataType>        <Default></Default>        <Length></Length>        <IsParameterized>true</IsParameterized>        <GuiLabels guid="7630e90d-5982-403b-a217-6a9be329ee04">            <Label language="EN">Delay</Label>            <Label language="DE">Delay</Label>        </GuiLabels>    </AttributeMetadata></ComponentMetadata>

To ensure all is good run the Execute Checks again.


Step - Deploy


So at last we can deploy our adapter to a HCI tenant.  Right click on the echo-adapter project and select Deploy Adapter Project


adap-5.png

In the Deploy Integration Content dialog select the Tenant you want to deploy to and click OK


adap-6.png


Where after you should see the confirmation as below


adap-7.png


Test - Validate successful deployment


Double click on the tenant in the Node Explorer view and then open the Deployed Artifacts view.  You might need to refresh the view by clicking on the yellow arrows and if the deployment was a success the adapter will display as follows.


adap-8.png

Also, lets ensure it started on the worker node by first selecting the node in the Node Explorer and then opening the Component Status View

 

adap-9.png

 

Conclusion

 

In Part 2 we have created a HCI adapter and deployed it to a HCI tenant.  At this point the echo adapter is available for use.  In the final part we will create an integration flow to use the adapter and ensure the endpoints are working.


Viewing all articles
Browse latest Browse all 676

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>