Skip to content

Resources

stockiNail edited this page Oct 12, 2015 · 4 revisions

Resources User Guide

Introduction

JEM supports resources, which represents a list of possible connectors and other and reachable by JNDI from java code.

This kind of resources are developed by users, in order to increase the capability of JEM to handle resource types.

Resources belongs to JNDI Java service and, thanks to it, a resource instance is usable inside any JEM job (according to user rights). One of the benefit to use the resources is the developer doesn't know anything about how the connection or the resource is configured.

To have more details how to define a resource forour job and how to be able to use it inside of your code, see the following:

To create new instance of defined resource you can access to web user interface or you can define them by jobs utility in ANT.

Resources Content

Every resource is a set of properties necessary to create a resource. Usually a resource is a client part to connect to antoher system, like a JDBC or FTP connection. A resource is composed 2 kind of properties:

  • Well-known properties which are identified as mandatory to define a resource. For instance, could be URL of JDBC connection of JDBC driver or useri and password to use.
  • Custom proprties which are not well-defined and they depend on specific resource implementation. For instance, the properties used for a JDBC connection. Both keys and values depend on the database that you want to connect.

The custom properties are completely free, without any content check. Both kinds of properties values can use variables to change the value at runtime. To use a variable, you should use the format ${variable-name} inside the property value. the job, during the execution, will change the value using the environment variables, JAVA system properties and job properties.

Resources Out-Of-The-Box

JEM provides, out of the box, the following resources:

Resource type Returned object
JDBC javax.sql.DataSource
FTP org.pepstock.jem.node.resources.impl.ftp.Ftp, java.io.OutputStream, java.io.InputStream
HTTP java.io.InputStream
JEM org.pepstock.jem.rest.ResourceRestClient
JMS javax.naming.InitialContext
JNDI javax.naming.InitialContext
JPPF org.jppf.utils.TypedProperties
REST org.pepstock.jem.rest.RestClient
RMI java.rmi.registry.Registry

JDBC

Java database connectivity technology is an API for the Java programming language that defines how a client may access a database. It provides methods for querying and updating data in a database. JDBC is oriented towards relational databases.

A JDBC resource provides a javax.sql.DataSource to access to a database.

Here are the list of attributes to define a JDBC resource:

Attribute Description Mandatory Default
driverClassName The fully qualified Java class name of the JDBC driver to be use. Yes
url The database url of the form jdbc:subprotocol:subname. Yes
userid The database user on whose behalf the connection is being made. Yes
password The user's password. Yes
defaultAutoCommit If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. No False
defaultReadOnly If connections are readOnly by default. No False

Furthermore, for JDBC resources, it's possible to add all connections properties necessary to have a right database connection. The list of connection properties depends on data base that you have to configure (see the documentation of database to have the complete list of properties and their values and meaning).

FTP

The File Transfer Protocol is a standard network protocol used to transfer computer files from one host to another host over a TCP-based network.

A FTP resource can provide different objects on depending of where you use the resources. If you use FTP resources in data descriptions, the resource factory will provide a java.io.OutputStream or java.io.InputStream. This is not programmatically addressable because it's just configuration of JCL. If you need a FTP client, and then calling the resource programmatically, you can receive org.pepstock.jem.node.resources.impl.ftp.Ftp which has got a FTPClient and wraps it.

Here are the list of attributes to define a FTP resource:

Attribute Description Mandatory Default
url The FTP server URL of the form scheme://authority. Yes
userid The FTP server user on whose behalf the connection is being made. Yes
password The user's password Yes
binary Sets the file type to be transferred to BINARY, otherwise is ASCII. No False

Some optional attributes can be set at runtime, to help the computation of the batch:

Attribute Description
restartOffset The offset into the remote file at which to start the next file transfer. This must be a value greater than or equal to zero.
bufferSize The size of the buffer. Use a non-positive value to use the default.

HTTP

The Hypertext Transfer Protocol (is an application protocol for distributed, collaborative, hypermedia information systems. Hypertext is structured text that uses logical links (hyperlinks) between nodes containing text. HTTP is the protocol to exchange or transfer hypertext.

An HTTP resource must be used in data descriptions and the resource factory will provide a java.io.InputStream. This is not programmatically addressable because it's just configuration of JCL.

Here are the list of attributes to define a HTTP resource:

Attribute Description Mandatory Default
requestHostName The Host Name of the Request URL true
requestPort The optional Port of the Request URL true
protocolType The Protocol Type. Could be HTTP or HTTPS true HTTP
proxyUrl The URL of the optional proxy false
proxyPort The optional Proxy Port of the Request URL false 80
proxyProtocol The Proxy Protocol Type. Could be HTTP or HTTPS false HTTP
userid The Proxy User Id if proxy authorization is need false
password The Proxy Password if proxy authorization is need false
requestLoginQueryString The Query String of the optional Login Request false
requestLoginUserId The Login User Id if different from proxy User Id false
requestLoginPassword The Login Password if different from proxy Password false
requestLoginParamUserId The Parameter name of the User Id for Login Request false
requestLoginParamPassword The Parameter name of the Password for Login Request false
requestLogoutQueryString The Query String of the optional Logout Request false

JEM

JEM rest resource allows you to access to JEM entities (jobs, nodes, statistics, global file systems.

A JEM resource can provide a JEM REST client, org.pepstock.jem.rest.ResourceRestClient, to access to all JEM entities, only if the userid, used for the client, is authorized.

Here are the list of attributes to define a JEM resource:

Attribute Description Mandatory Default
url The JEM server URL (REST context) on format scheme://host:port/[jemcontext]/[restcontext] true
userid The JEM user on whose behalf the connection is being made true
password The user's password true

JMS

The Java Message Service API is a Java Message Oriented Middleware (MOM) API for sending messages between two or more clients. It is a messaging standard that allows application components to create, send, receive, and read messages. It allows the communication between different components of a distributed application to be loosely coupled, reliable, and asynchronous.

A JMS resource can provide an javax.naming.InitialContext, use to get queues and sessions.

Here are the list of attributes to define a JMS resource:

Attribute Description Mandatory Default
java.naming.provider.url The JMS provider URL in the form: scheme://host:port true
java.naming.factory.initial The JMS Initial Context Factory to create the connection to use JMS true
userid The JMS security principal on whose behalf the connection is being made true
password The user's password true

JNDI

The Java Naming and Directory Interface is a Java API for a directory service that allows Java software clients to discover and look up data and objects via a name. Like all Java APIs that interface with host systems, JNDI is independent of the underlying implementation.

A JNDI resource can provide a javax.naming.InitialContext. It can be used to access to remote resources by JNDI, as EJB or LDAP.

Here are the list of attributes to define a JNDI resource:

Attribute Description Mandatory Default
java.naming.factory.initial It is the service provider as the initial context true
readOnly if set to true, the user can't bind, unbind, rebind, rename objects or perform destroySubContext, createSubContext, addToEnv, removeFromEnv actions of InitialContext true false

Furthermore, for JNDI resources, it's possible to add all properties necessary to have a right JNDI configuration. The list of properties depends on the purpose of JNDI (see the documentation of backend you want to connect to have the complete list of properties and their values and meaning). For LDAP, see here the list of the properties. For EJB deployed on JBoss AS, see here.

JPPF

JPPF enables applications with large processing power requirements to be run on any number of computers, in order to dramatically reduce their processing time. This is done by splitting an application into smaller parts that can be executed simultaneously on different machines.

A JPPF resource can provide a org.jppf.utils.TypedProperties. It's used to create a JPPF client to access to JPPF server, entry point of the grid environment.

Here are the list of attributes to define a JPPF resource:

Attribute Description Mandatory Default
addresses List of JPPF servers, on the following format: [host1:port],[host2:port],...[hostn:port] true

REST

Representational state transfer is an abstraction of the architecture of the World Wide Web; more precisely, REST is an architectural style consisting of a coordinated set of architectural constraints applied to components, connectors, and data elements, within a distributed hypermedia system.

A REST resource provides a org.pepstock.jem.rest.RestClient, based on Jersey framework. A REST client is able to manage SSL and userid and password of REST calls if basic HTTP authentication is defined on server.

Here are the list of attributes to define a REST resource:

Attribute Description Mandatory Default
url The base url of the REST server true
basicAuthentication If must be used a http basic authentication to the server false false
userid The user on whose behalf the connection is being made false
password The user's password false

RMI

The Java Remote Method Invocation is a Java API that performs the object-oriented equivalent of remote procedure calls (RPC), with support for direct transfer of serialized Java classes.

A RMI resource provides a java.rmi.registry.Registry which can be used to lookup a remote object. Often used to call EJB remotely.

Here are the list of attributes to define a RMI resource:

Attribute Description Mandatory Default
hostname The RMI registry host name or ip address true
port The TCP port where RMI registry is listening true 1099
ssl If a connection must be implemented using SSL false false
readOnly if set to true, the user can't bind, unbind, rebind, rename objects by Registry false false

Developing a new custom resource

The Out-Of-The-Box resources, previously described, are defined as any iother resource that must be customized.

All you need to know about creating your own custom resource will be described in this section.

Implementation

Each new resource type have to implement the interface org.pepstock.jem.node.resources.definition.ResourceDefinition which defines:

	/**
	 * This method returns the {@link Reference} associated to the new type of Resource.
	 * @return the {@link Reference} associated to the new type of Resource.
	 */
	Reference getReference();

	/**
	 * This method returns the {@link ResourceDescriptor} associated to the new type of Resource.
	 * @return the {@link ResourceDescriptor} associated to the new type of Resource.
	 */
	ResourceDescriptor getDescriptor();
	
	/**
	 * This method is called when a resource is added, to enrich with the hidden properties
	 * @param resource resource to be enriched
	 */
	void completeResource(Resource resource);

	/**
	 * Validates a resource, when both a new resource is added and an existing one is changed.
	 * This method should check if all necessary properties are set and if unnecessary properties are set as well.
	 * @param resource resource to be checked
	 * @throws ResourceDefinitionException if any errors occurs during check
	 */
	void validateResource(Resource resource) throws ResourceDefinitionException;

The main methods are :

  • Reference getReference(); returns a JNDI Reference of this resource type.
  • ResourceDescriptor getDescriptor(); returns a ResourceDescriptor, an object that contains information on how the resource is built.

The implementing class can contains other fields and/or methods you need.

Reference

The Reference is a JNDI entity which has a factory and an object class. The factory is used to create the object of type identified by object class, can be self-developed or can be an existing one.

Descriptor

The descriptor contains a field list that define the attributes of custom resource. These fields are used to know how to load and save custom resource instances and are also used to render the web interface for configuration. Descriptor can be hardcoded inside the ResourceDefinition implementation or can be externally defined in a template XML file (see below). As a facility, the XmlConfigurationResourceDefinition abstract class is provided: it's intended to be extended (instead of implementing ResourceDefinition) for the custom resource that use a template XML file to define it's descriptor.

Template XML file

This file or stream is used to define a Resource Descriptor in XML format. The allowed nodes are:

resource-template

This is the root node of a template file. See the annotation section how to configure the resorce type.

It can contain the following attributes:

Attribute Description Mandatory Default
type identify in a unique manner this type of resource inside JEM environment false

section

This node is child of resource-template and identify a group of properties. There may be one or more of this node in a template, if more than one is found each section is rendered as a tab of a Tab Panel, otherwhise as a simple page. If you have more than one section you may want to identify the rendered tab with a name with it's name attribute (optional).

Attribute Description Mandatory Default
name identify the rendered tab with a name false
propertyEditor adds in tab panel a table editor to manage key-value properties false false

http://www.pepstock.org/wiki/custom-resources/TabPanel.png

Each section can contains one or more fields. The custom resource engine can offer different field types. Descriptions of them start with their common attributes, and then with the specific ones.

text-field and password-field elements

This is a simple text input. It's value can optionally be validated by a regular expression and a warning message is displayed if the inserted value does not match.

It can contain the following attributes:

Attribute Description Mandatory Default
key the main attribute, is the name that identify the property and must be unique inside the same resource type true
label short text which explains this attribute, showed on user interface true
description is a long text which exaplains in details what this attribute does false
mandatory If true, means that the user must type or select a value for this attribute; false if the user can ignore it false false
defaultValue useful for pre-select a value for this attribute false
override means that the attribute value can be overridden inside JCL false true
visible the content of this attribute is visible on the web user interface, otherwhise the content is hidden and not editable false true
regExValidator attribute can contains a regular expression that will be used to validate the typed value false
check-box-field element

This is a simple check box.

It can contain the following attributes:

Attribute Description Mandatory Default
key the main attribute, is the name that identify the property and must be unique inside the same resource type true
label short text which explains this attribute, showed on user interface true
description is a long text which exaplains in details what this attribute does false
mandatory If true, means that the user must type or select a value for this attribute; false if the user can ignore it false false
defaultValue useful for pre-select a value for this attribute false
override means that the attribute value can be overridden inside JCL false true
visible the content of this attribute is visible on the web user interface, otherwhise the content is hidden and not editable false true
single-selectable-list-field element

An attribute that can be have only a value, choosed from a finite set. Rendered as a radio button group.

It can contain the following attributes:

Attribute Description Mandatory Default
key the main attribute, is the name that identify the property and must be unique inside the same resource type true
label short text which explains this attribute, showed on user interface true
description is a long text which exaplains in details what this attribute does false
mandatory If true, means that the user must type or select a value for this attribute; false if the user can ignore it false false
value sub-node(s) contains possible values that this attribute can assume true
defaultValue is used to pre-select a value false
override means that the attribute value can be overridden inside JCL false true
visible the content of this attribute is visible on the web user interface, otherwhise the content is hidden and not editable false true
renderAsRadio boolean attribute. If set to true, the list of values are represented by a radioButton otherwise as comboBox false false
multi-selectable-list-field element

An attribute that can be have more than one value, choosed from a finite set. Rendered as check boxes.

It can contain the following attributes:

Attribute Description Mandatory Default
key the main attribute, is the name that identify the property and must be unique inside the same resource type true
label short text which explains this attribute, showed on user interface true
description is a long text which exaplains in details what this attribute does false
mandatory If true, means that the user must type or select a value for this attribute; false if the user can ignore it false false
value sub-node(s) contains possible values that this attribute can assume. This value can be set selected (or deselected) by default specifying true (or false) as the value for it's selected attribute true
defaultValue is used to pre-select a value false
override means that the attribute value can be overridden inside JCL false true
visible the content of this attribute is visible on the web user interface, otherwhise the content is hidden and not editable false true
list-field element

This is a special field that needs to be defined alone in it's own section. Is rendered as a text input and a list. The user can set multiple text values for the property, can be free-typed (and optionally validated) and there isn't a maximum size.

  1. new value area: simple type the value you want add to list and then click Add button (or hit Enter key)
  2. current values area: here you can see the current values of this field
  3. Remove button: if you entered a wrong value, you can select it from the list and then click on Remove button

This field does not allow duplicate values.

http://www.pepstock.org/wiki/webui/warning.png WARNING: if a list field is defined in a section with any other fields, JEM node will throw an error at startup!

It can contain the following attributes:

Attribute Description Mandatory Default
key the main attribute, is the name that identify the property and must be unique inside the same resource type true
label short text which explains this attribute, showed on user interface true
description is a long text which exaplains in details what this attribute does false
mandatory If true, means that the user must type or select a value for this attribute; false if the user can ignore it false false
override means that the attribute value can be overridden inside JCL false true
visible the content of this attribute is visible on the web user interface, otherwhise the content is hidden and not editable false true

Here is a simple showcase how the UI could be:

http://www.pepstock.org/wiki/custom-resources/SinglePage.png

Add custom resource definition to JEM

First of all, you need to add your custom resource to JEM configuration (jem-env.xml) inside resource-definitions node:

<resource-definitions>
	<resource-definition className="org.pepstock.jem.node.resources.impl.jdbc.JdbcResourceDefinition"/>
	<resource-definition className="org.pepstock.jem.node.resources.impl.ftp.FtpResourceDefinition"/>
	<resource-definition className="org.pepstock.jem.node.resources.impl.jem.JemResourceDefinition"/>
	<resource-definition className="org.pepstock.jem.node.resources.impl.jms.JmsResourceDefinition"/>
	<resource-definition className="org.pepstock.jem.node.resources.impl.jppf.JppfResourceDefinition"/>
	<resource-definition className="org.pepstock.jem.node.resources.impl.http.HttpResourceDefinition"/>
	<resource-definition className="org.pepstock.jem.node.resources.impl.rmi.RmiResourceDefinition"/>
	<resource-definition className="org.pepstock.jem.node.resources.impl.jndi.JndiResourceDefinition"/>
	<resource-definition className="org.pepstock.jem.node.resources.impl.rest.RestResourceDefinition"/>
	
	<!--
	*----------------------------------------*
	! Single resource with custom properties !
	*----------------------------------------*
	<resource-definition className="my.resource.single.1">
		<properties>
			<property name="name" value="value" />
	    </properties>
	</resource-definition>	
	
	*--------------------------------------------------------*
	! Single resource contained in JARs not in JEM classpath !
	*--------------------------------------------------------*
	<resource-definition className="my.resource.single.2">
		<classpath>
			<pathElement>${jem.library}/addons/addons.jar</pathElement>
		</classpath>
	</resource-definition>
	
	*-------------------------------------------------------------------------------*
	! Single resource contained in JARs not in JEM classpath with custom properties !
	*-------------------------------------------------------------------------------*
	<resource-definition className="my.resource.single.3">
		<properties>
			<property name="name" value="value" />
	    </properties>
		<classpath>
			<pathElement>${jem.library}/addons/addons.jar</pathElement>
		</classpath>
	</resource-definition>	

	*--------------------------------------------------------------------------*
	! Group of resources from the same list of JARs and with custom properties !
	*--------------------------------------------------------------------------*
	<resources-definition>
		<resource-definition className="my.resource.group.1"/>
		<resource-definition className="my.resource.group.2">
			<properties>
			     <property name="name" value="value" />
		    </properties>
		</resource-definition>
		<classpath>
			<pathElement>${jem.library}/addons/addons.jar</pathElement>
		</classpath>
	</resources-definition>
    -->
</resource-definitions>

resource-definition element

The element defines the custom java class, which implements org.pepstock.jem.node.resources.definition.ResourceDefinition. It has got a mandatory attribute, className, which provides fully-qualified class name implementing the resource.

A resource-definition element can also contain:

Element Description Mandatory
properties Element which must contain all properties to configure the resource false
classpath Element which must contain all path element with all folders and jars where the resource has been implemented false

The properties element can contain property elements, with following attributes:

Attributes Description Mandatory
name name of property to be passed to the resource definition true
value value of property to be passed to the resource definitiond true

The classpath element can contain pathElement elements. The content of pathElement elements represents a list of JARs or folder used to store the code to implement the resource. The content of pathElement can be:

  • folder, which contains all java classes
  • JAR, which contains all java classes, compressed in a java archive file
  • folder/*, used to read all JARs files of the folder and defined ad part of custom classpath
  • folder/**, used to read all JARs files of the folder and subfolders (recursively) and defined ad part of custom classpath

All previous definitions can be st in a single or more pathElement element, semi-colon (;) separated, as following example:

<classpath>
	<pathElement>${jem.library}/classes</pathElement>
	<pathElement>${jem.library}/addons/addons.jar</pathElement>
	<pathElement>${jem.library}/addons/*</pathElement>
	<pathElement>${jem.library}/addons/**</pathElement>
	<pathElement>${jem.library}/addons/addons.jar;${jem.library}/addons/**;${jem.library}/classes</pathElement>
</classpath>

resources-definition element

The element is a container of resource-definition elements (and then resources) which are implemented using the same classpath. Therefore all resources defined inside this element must be coded on the unique classpath element, in resources-definition element.

Annotations

To help a developer to implement a custom resources, some special annotation are provided by JEM to define well the resource.

@ResourceMetaData

This annotation, at class level, is used to provide information about the resource definition. It must be used inside of org.pepstock.jem.node.resources.definition.ResourceDefinition implementation.

Here are the attributes to use:

Attributes Description Mandatory
type identify in a unique manner this type of resource inside JEM environment true
description long description about the resource. It uses on user interface when the user choose the resource to create. true

Here is an example, of JDBC resource:

@ResourceMetaData(type = "jdbc", description = "Java database connectivity technology is an API....")
public class JdbcResourceDefinition extends XmlConfigurationResourceDefinition {
...
}

@ResourceTemplate

This annotation, at class level, is used to provide information what and where is the template defintion, in XML. It must be used inside of org.pepstock.jem.node.resources.definition.ResourceDefinition implementation.

Here are the attributes to use:

Attributes Description Mandatory
value is the link to the XML template definition. In according with mode attribute, it could be a file (both on file system or in classpath) or a URL true
mode defines how to read the XML template definition. It can assume the following values, using org.pepstock.jem.annotations.Mode class: true
Mode.FROM_CLASSPATH: if the definition path will be searched inside the classpath
Mode.FROM_FILESYSTEM: if the definition path will be read from file system. The value is the file system absolute path
Mode.FROM_URL: if the definition path will bew read remotely. The value is the URL to use

Here is an example, of JDBC resource:

@ResourceTemplate(value="org/pepstock/jem/node/resources/impl/jdbc/JdbcResourcesConfiguration.xml",
		mode = Mode.FROM_CLASSPATH)
public class JdbcResourceDefinition extends XmlConfigurationResourceDefinition {
...
}

Example

We are about to create a custom resource, with descriptor based on template XML file.

  • Write a class that do what you need, defining the type, description and the XML template link:
@ResourceMetaData(type = "MyCustomResource", description = "My resource description")
@ResourceTemplate(value="my/custom/resource/package/MyCustomResource.xml",
		mode = Mode.FROM_CLASSPATH)
public class MyCustomResource extends XmlConfigurationResourceDefinition {
  @Override
  public Reference getResourceReference() {
      return new Reference("myCustomReference");
  }
  public void doSomething() {
      // businness logic
  }
  public void doSomething2() {
      // businness logic (again)
  }
}
  • Package the class on a JAR file and put it into JEM libraries directory (see ConfiguringJEMCluster section).

  • Add the new custom resource to JEM configuration jem-env.xml:

<!-- cut -->
<resource-definitions>
  <!-- cut -->
  <resource-definition className="my.custom.resource.package.MyCustomResource">
	<classpath>
		<pathElement>${jem.library}/addons/addons.jar</pathElement>
	</classpath>
  </resource-definition>
  <!-- cut -->
</resource-definitions>
  • Write the XML template in order to let user define instance property values, adding it into your jar (in the sample, addons.jar):
<resource-template type="MyCustomResource">
	<section name="Section 1">
		<text-field key="text" 
				label="Text Property" 
				description="Description" 
				regExValidator="protocol://.*"
				mandatory="true" />
		<password-field key="password"
				label="Password"
				description="Type the password"
				mandatory="true" />
		<check-box-field key="check"
				label="Autocommit?"
				description="Check the box if you want Autocommit feature enabled" 
				defaultValue="true" />
		<single-selectable-list-field key="radio"
				label="Single Property"
				description="Description"
				mandatory="false" 
				defaultValue="comboValue2"
				renderAsRadio="true">
			<value>comboValue1</value>
			<value>comboValue2</value>
			<value>comboValue3</value>
		</single-selectable-list-field>
		<multi-selectable-list-field key="checks" 
				label="Multi Property"
				description="Description"
				mandatory="false">
			<value>checkValue1</value>
			<value>checkValue2</value>
			<value>checkValue3</value>
			<value selected="true">checkValue4</value>
		</multi-selectable-list-field>
	</section>
	<section name="Section 2">
		<list-field key="list" regExValidator=".*" label="Free values" />
	</section>
</resource-template>

In this template example a new custom resource with type MyCustomResource is defined. It contains 4 attributes, 3 in section Section 1 and the last one in the Section 2. The first section contains 3 different attribute types:

Text field

<text-field key="text" 
		label="Text Property" 
		description="Description" 
		regExValidator="protocol://.*"
		mandatory="true" />

http://www.pepstock.org/wiki/custom-resources/Ex-Text.png

The attributes is almost self-explaining: it's value will be saved under text key, label and description are used to render web interface, cannot be empty - in this example - and also must match the regular expression pattern protocol://..

If you try save the resource with attributes that doesn't match the validator, the following warning message is displayed:

http://www.pepstock.org/wiki/custom-resources/Ex-ValidationError.png

Password field

<password-field key="password"
		label="Password"
		description="Type the password"
		mandatory="true" />

http://www.pepstock.org/wiki/custom-resources/Ex-Password.png

Very similar to Text field, this one is rendered hiding the typed charachters.

Check box field

<check-box-field key="check"
		label="Autocommit?"
		description="Check the box if you want Autocommit feature enabled" 
		defaultValue="true" />

http://www.pepstock.org/wiki/custom-resources/Ex-Checkbox.png

A simple true/false (enabled/disabled) field, rendered as a checkbox.

Radio field

<single-selectable-list-field key="radio"
		label="Single Property"
		description="Description"
		mandatory="false" 
		defaultValue="comboValue2"
		renderAsRadio="true">
	<value>comboValue1</value>
	<value>comboValue2</value>
	<value>comboValue3</value>
</single-selectable-list-field>

http://www.pepstock.org/wiki/custom-resources/Ex-Radio.png

This field is composed by 3 radio buttons (comboValue1, comboValue2 and comboValue3), with comboValue2 selected by default as the defaultValue attribute says. It's optional.

Checks Field

<multi-selectable-list-field key="checks" 
		label="Multi Property"
		description="Description"
		mandatory="false">
	<value>checkValue1</value>
	<value>checkValue2</value>
	<value>checkValue3</value>
	<value selected="true">checkValue4</value>
</multi-selectable-list-field>

http://www.pepstock.org/wiki/custom-resources/Ex-Check.png

This attribute is composed by 4 checkboxes, with the last one checkValue4 selected by default. It's optional.

List field

<list-field key="list" regExValidator=".*" label="Free values" />

http://www.pepstock.org/wiki/custom-resources/Ex-List.png

section with properties editor

<section  propertyEditor="true" />

http://www.pepstock.org/wiki/custom-resources/CustomProperties.png

You need to restart JEM node to make changes effective!

From JEM, select Resources tab then click ok Add new Resource button then the following dialog appears and select your new custom type from lsit:

http://www.pepstock.org/wiki/custom-resources/InstanceNameAndType.png

You'll see the dinamically rendered user interface based on template file,which ask the user for instance attribute values:

http://www.pepstock.org/wiki/custom-resources/Ex-Section1.png http://www.pepstock.org/wiki/custom-resources/Ex-Section2.png

Now you can fill the values :) When you finish, click on Save button and the instance will be created!

http://www.pepstock.org/wiki/custom-resources/Ex-Instance.png

Now this resource can be referenced and used inside jobs!

Clone this wiki locally