Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EDT:Resource Binding Services

Revision as of 17:45, 19 January 2012 by Unnamed Poltroon (Talk) (Binding service @DedicatedService)

How to binding a service in EDT

There are two type of service binding in EDT current.

  • @Resource
  • @DedicatedService

In this section. You can learn how to binding a service in your project by these two types of binding.
Firstly, we should assume that we have already defined a service named: myService.

Binding service @Resource

In order to binding the service via @Resource, you should add the service into the Services Deployment.
Open the egldd file and switch to “Service Deployment” tab. Then click the Add button.

Bind Img6.JPG

You can add the service myService into your Services Deployment setting up.

Bind Img7.JPG


Then switch to Resource Bindings tab to add the REST service binding. Click Add button and select “Rest Service Binding” to add the service binding.

Bind Img8.JPG

You should give a name for your service binding. For the Base URI you can use two types of URI as the instruction in the dialog.

  • Deployed URI.

              Myhostname:8080 is your project server’s host and port number.

              “myTargetWebProject” is the project name which you want to deploy into. You can find the name in “Overview” tab of the elgdd file

              “restservices”. Fixed string. Please do NOT modify it

              “myService” : your service’s name.

  • Workspace URI

              “myServiceProject” : your project’s name.
              “myPackage.myservice”: your service’s name and its project’s name

Click Finish to complete the binding.

Use the service binding in code

In source code you can use the service binding your defined in section 3.1 as below:



mysrv  mysrv ?{@Resource {}};
or
mysrv mysrv?{ @Resource { propertyFileName = “egldd file name” , bindingkey = “ REST service name”}}

Then you can call the methods in myService


Binding service @DedicatedService

This type of service binding is simple and did not need to setup in elgdd file. You can just code in your source as below:
mySrv myService?{@DedicatedService {}};
or
mySrv myService?{@DedicatedService { serviceName = “service name” }};


Then you can use the methods you defined in service: myService.



Next:  Database bindings

Previous:  [1] Resource binding introduction

Back to the top