Apache Rest Client



To automate the interaction with ACE, you can use its REST client API. Typical use cases include the tight integration of ACE into your development or automated build process, or the creation of a custom user interface or integration.

This is still a work in progress which you can track in ACE-151.

  • This library leverages the Restlet library, so keep its documentation nearby as well. This library expects the client code to build up handlers on how to react to resources and errors.
  • Restful services with Jersey and Apache HTTP client. Create a new Maven Web project in eclipse (Refer Rest service Hello World project for the same) Project structure.
  • Apache Camel offers a REST styled DSL which can be used with Java or XML. The intention is to allow end users to define REST services using a REST style with verbs such as get, post, delete etc.

The RestClient is the entry point for all rest service operations. The RestClient is used to create instances of Resource classes that are used to make the actual invocations to the service. The client can be initialized with a user supplied configuration to specify custom Provider classes, in addition to other configuration options. HttpComponents Client. HttpClient is a HTTP/1.1 compliant HTTP agent implementation based on HttpCore. It also provides reusable components for client-side authentication, HTTP state management, and HTTP connection management. HttpComponents Client is a successor of and replacement for Commons HttpClient 3.x. Users of Commons HttpClient are.

Before we dive into the various REST endpoints, let's start with an overview of how all of this works. Everything in ACE is an entity. For example, an artifact or a feature is an entity, but also the association between an artifact and a feature is. Entities have properties and tags. Properties are the 'fixed' attributes that make up a specific type of entity. For example a feature has a name and a description. If you know the type of entity, its properties are also known. Tags on the other hand are attributes that a user can freely add and refer to.

The following diagram shows the different entities that ACE knows:

For each entity we will now list and explain the properties:

Artifacts contain the metadata for the different types of artifacts that can be provisioned to targets. Drivers usb com board evolution driver ( umdf ). Artifacts can be bundles, configuration data or any other type you've defined yourself.

  • artifactName
  • artifactDescription
  • url
  • mimetype
  • processorPid

Since there are different types of artifacts, some properties depend on the actual type.

For bundles:

Apache wink rest client
  • Bundle-Name
  • Bundle-SymbolicName
  • Bundle-Version

For configuration:

  • filename

For other types, please consult the documentation about these types (specifically the classes that implement the interfaces in the org.apache.ace.client.repository.helper package).

Associates artifacts to features. Associations have a left and right hand side. Both can be expressed as filter conditions, and both have a cardinality.

Client
  • leftEndpoint
  • rightEndpoint
  • leftCardinality — defaults to 1
  • rightCardinality — defaults to 1

A feature is a grouping mechanism for artifacts. It is commonly used to group together a set of artifacts that together represent some kind of feature to the application.

  • name
  • description

Associates features to distributions. Associations have a left and right hand side. Both can be expressed as filter conditions, and both have a cardinality.

  • leftEndpoint
  • rightEndpoint
  • leftCardinality — defaults to 1
  • rightCardinality — defaults to 1

A feature is a grouping mechanism for features. It is commonly used to group together a set of features that together represent some kind of distribution. Distributions are the things you can associate with targets, so you can look at them as the licensable configurations of your software.

  • name
  • description

Associates distributions to targets. Associations have a left and right hand side. Both can be expressed as filter conditions, and both have a cardinality.

  • leftEndpoint
  • rightEndpoint
  • leftCardinality — defaults to 1
  • rightCardinality — defaults to 1

A target receives the artifacts you provision to it. Most of the time, a target is an OSGi container and provisioning means you'll actually install the artifacts in the container, but there can be other types of targets (non-OSGi containers, or something completely different).

  • id
  • autoapprove

A target also has specific state (see below for how that is returned):

  • registrationState — Unregistered, Registered
  • provisioningState — Idle, InProgress, OK, Failed
  • storeState — New, Unapproved, Approved
  • currentVersion
  • isRegistered
  • needsApproval
  • autoApprove
  • artifactsFromShop
  • artifactsFromDeployment
  • lastInstallSuccess
Client

Similar to the web based UI, this API also works with the concept of checking out a copy to a local working area, altering it in that working area and then committing it back to the server.

POST /work

Creates a working copy for you, with its own ID, and redirects you to it. (For the contents of this working copy, see below.)

Response:

  • 302 /work/ID

DELETE /work/ID

Apache Wink Rest Client

Apache rest client

Deletes the working copy. Signals you're done with it, without transferring the data back to the server.

POST /work/ID

Sets the working copy to be the current version. We keep track of whether you have based your copy on, and will reject the update if it is no longer the latest.

Response:

  • 200
  • 409

Now you have a working copy, you can start working with it.

GET /work/ID

Gets you a list of all repositories you can use. Should return: ['artifact', 'feature', 'distribution', 'target', 'artifact2feature', 'feature2distribution', 'distribution2target']

GET /work/ID/feature

Lists all feature IDs in the feature repository.

POST /work/ID/feature

Creates a new feature. In the post body, you can specify attributes and tags, for example: {attributes: {key: 'value'}, tags: {key: 'value'}}.

Response:

  • 302 /work/ID/feature/FID
  • 400

GET /work/ID/feature/FID

Returns a representation of the object, for example: {attributes: {key: 'value'}, tags: {key: 'value'}}. If you ask for a target, you will also get its state, so the result will be in the form: {attributes: {key: 'value'}, tags: {key: 'value'}, state: {key: 'value'}}.

PUT /work/ID/feature/FID

Updates the object with the JSON data you supply.

Response:

Apache Cxf Rest Client Example

  • 200
  • 400
  • 404

DELETE /work/ID/feature/FID

Advance at-7831 driver. Deletes the object.

Apache Cxf Rest Client Example Mkyong

Response:

Apache Camel Rest Client

  • 200
  • 404




Comments are closed.