Reputation: 23
Is there any way to deploy a worklight adapter using a command line instead of using the worklight console? (As my worklight server is installed on WAS, a wsadmin command or something like that ...).
Upvotes: 2
Views: 367
Reputation: 700
if you don't want to install Ant or copy extra Worklight build tools jars use the unix curl utility:
sometimes using cURL will cause an java.lang.StringIndexOutOfBoundsException in deployment but this due to bad form upload. the correct format is here: lets assume the binaries are located on /tmp/workspace6.3/proj1/bin/ and the Worklight admin username and password is 'admin' (on a local worklight server) using the curl unix utility we can deploy
curl -v -X POST -H "Content-Type: multipart/form-data" -F "file=@/tmp/workspace6.3/proj1/bin/sampleAdapter.adapter" --user admin:admin -H "Accept: application/json" http://localhost:10080/worklightadmin/management-apis/1.0/runtimes/proj1/adapters
curl -v -X POST -H "Content-Type: multipart/form-data" -F "file=@/tmp/workspace6.3/proj1/bin/app1-all.wlapp" --user admin:admin -H "Accept: application/json" http://localhost:10080/worklightadmin/management-apis/1.0/runtimes/proj1/applications
the only problem here is that these POST URLs are compatible with Worklight v6.3-v7 and they might change across future major versions, so read the documentation for release admin REST API to get the correct URLs .
Upvotes: 0
Reputation: 5111
You can use the ANT Tasks described in the documentation. Note that the Ant tasks are supplied with the Enterprise and Consumer editions. Not the free developer edition.
The Ant task for deploying an adapter has the following structure:
<?xml version="1.0" encoding="UTF-8"?>
<project base="." default="target-name">
<target name="target-name">
<taskdef resource="com/worklight/ant/defaults.properties">
<classpath>
<pathelement location="path_to_worklight-ant-platform.version>.jar" />
</classpath>
</taskdef>
<adapter-deployer worklightserverhost="http://server-address:port" deployable="myAdapter.adapter" />
</target>
</project>
The element has the following attributes:
The worklightserverhost attribute specifies the full URL of your Worklight server.
The deployable attribute specifies the .adapter file to deploy. If you must deploy more than one .adapter file, add an element for each file.
Upvotes: 5