Skip to content

Request Definition Develop

Nikos Kefalakis edited this page Nov 22, 2013 · 3 revisions

Download

To download Request Definition’s source code use your favourite git client and retrieve the code from one of the following URLs:

  • HTTPS: https://github.com/OpenIotOrg/openiot.git
  • SSH: [email protected]:OpenIotOrg/openiot.git

The Request Definition is available under the openiot/ui/ui.requestDefinition/ folder and the Request common files under openiot/ui/ui.requestCommons/.

Deploy from source

Start JBoss Enterprise Application Platform 6 or JBoss AS 7.1 with the Web Profile:

  • Open a command line and navigate to the root of the JBoss server directory.
  • The following shows the command line to start the server with the web profile:
    • For Linux: JBOSS_HOME/bin/standalone.sh
    • For Windows: JBOSS_HOME\bin\standalone.bat

Download and install/deploy dependencies

NOTE: The following build commands assume that you have configured your Maven user settings. If you have not, you must include Maven setting arguments on the command line.

  • Download and deploy the Scheduler
  • Download and install ui.requestCommons
    • Open a command line and navigate to the root directory of the request commons Project.
    • Type the following command to build and install: mvn clean package install

Build and Deploy the request definition web application

NOTE: The following build command assumes you have configured your Maven user settings. If you have not, you must include Maven setting arguments on the command line.

  • Make sure you have started the JBoss Server as described above.
  • Open a command line and navigate to the root directory of the request definition Project.
  • Type this command to build and deploy the archive: mvn clean package jboss-as:deploy

This will deploy target/ui.requestDefinition.war to the running instance of the server.

Access the application

The application will be running at the following URL: http://servername:8080/ui.requestDefinition/

Undeploy the Archive

  • Make sure you have started the JBoss Server as described above.
  • Open a command line and navigate to the root directory of the request definition Project.
  • When you are finished testing, type this command to undeploy the archive: mvn jboss-as:undeploy

Run in Eclipse

Integrating and Starting JBoss server

You can start JBoss Application Server and deploy the Request Definition from Eclipse using JBoss tools. Detailed instructions on how to integrate and start JBoss AS from Eclipse with JBoss Tools are available here .

Integrating and deploying Request Definition

To integrate and deploy the Request Definition in Eclipse one should follow the steps below:

  1. Import Existing maven project File>Import>Maven>Existing Maven Projects

  2. Click the “Browse” button and navigate to the ui.requestDefinition’s source code directory that has been previously downloaded.

  3. Choose the ui.requestDefinition and click the Finish button.

  4. Right click on the ui.requestDefinition project and choose Run As>Maven Build…

  5. Insert the following to:

  • Goals: clean package jboss-as:deploy
  • Profiles: arq-jbossas-remote
  • Name: ui.requestDefinition package-deploy (or your preferred name)

Click the Run button (the JBoss Server should be already running). The project will automatically build itself, get deployed and run at the JBoss AS running instance. From now on this configuration should be available at the Eclipse Run Configurations under Maven Build.

To Undeploy the ui.requestDefinition from the running instance of the JBoss AS follow the steps below:

  1. Right click on the “ui.requestDefinition” project and choose Run As>Maven Build…

  2. Insert the following to:

  • Goals: jboss-as:undeploy
  • Profiles: arq-jbossas-remote
  • Name: ui.requestDefinition undeploy (or your preferred name)

Click the Run button (the JBoss Server should be already running). The project will automatically be undeployed from the JBoss AS running instance. From now on this configuration should be available at the Eclipse Run Configurations under Maven Build.

Programming

Defining new nodes

With the exception of the sensor nodes which are populated dynamically from a sensor discovery query, all other nodes are specially annotated POJOs that extend the DefaultGraphNode class. All node implementations should be placed under the org.openiot.ui.request.definition.web.model.nodes.impl package. The system will automatically scan for the annotated POJOs during deployment and populate the node toolbox. The most important annotations are:

  • @GraphNodeClass. This annotation marks a POJO as a node that can be used for a service graph. The annotation expects the following attributes:

    • label: the name of the node (localizable).
    • type: the type (group) of the node. Should be one of SOURCE, AGGREGATOR, COMPARATOR, SINK or FILTER.
  • scanProperties: if set to true, then the annotation scanner will automatically initialize the node's properties and endpoints from the @NodeProperty and @Endpoint annotations.

  • @NodeProperties. This annotation defines a list of @NodeProperty annotations.

  • @NodeProperty. This annotation defines a node property. The annotation expects the following attributes:

    • type: one of the PropertyType enumerations. Specify if the property is readable, writeable or both.
    • javaType: The fully qualified name of the java type that stores this property's value.
    • name: the name of the property (localizable).
    • required: set to true if the property is required, false otherwise
    • allowedValues: an optional attribute that specifies an array of allowed variables to be selected by a drop-down menu. In this case, the java type attribute should be java.lang.String.
  • @Endpoints: This annotation defines a list of @Endpoint annotations.

  • @Endpoint: This annotation defines a node's endpoint. It expects the following attributes:

    • type: one of the EndpointType enumerations. Specify if the endpoint serves as an input or an output.
    • anchorType: one of the AnchorType enumerations. Specify the location of the endpoint on the rendered node.
    • scope: specifies the types of endpoints that can connect to this endpoint (if this is an input) or the types of endpoints to which this endpoint can connect (if this is an output).
    • maxConnections: the maximum number of connections that can originate from this node (if this is an output) or end to this node (if this is an input).
    • label: the label of the endpoint (localizable).
    • required: set to true if this endpoint requires a connection, false otherwise

Localization support

The request definition application has full i18n localization support via property files. These files are placed under the org.openiot.ui.request.definition.web.i18n package. The following rules are used for localizing node elements:

  • All node localization entry labels are defined as the concatenation of the prefix UI_NODE_ and the endpoint label's name as defined in the POJO annotations. For example, an endpoint with label TEST has the localization label UI_NODE_ENDPOINT_TEST.
  • All node localization entry labels are defined as the concatenation of the prefix UI_NODE_ENDPOINT_ and the endpoint label's name as defined in the POJO annotations. For example, an endpoint with label TEST has the localization label UI_NODE_ENDPOINT_TEST.
  • All node localization entry labels are defined as the concatenation of the prefix UI_NODE_PROPERTY_ and the property label's name as defined in the POJO annotations. For example, a property with label TEST has the localization label UI_NODE_PROPERTY_TEST.
Clone this wiki locally