One-liners
Introduction
The term 'one-liners' is used to refer to the collection of utility classes that are shipped with and exposed to the TORO Integrate development environment out-of-the-box, typically via extension modules1. They provide methods intended to solve common integration problems with literally one line of code, hence the name 'one-liners'.
Most one-liner classes are located in the io.toro.integrate
package. They can all be used in
Groovy services, but some one-liners are intended for use in Gloop
only. These Gloop-specific one-liners are alternatively called 'Gloop core services' and are the set of one-liners shown
in the Coder Navigator view. To see them, open up the services
directory of the core
package:
Not all one-liners are displayed in Coder
The one-liners shown in the Coder Navigator view are those that are for use in Gloop services. One-liners for Groovy are not displayed entirely.
Coder makes these core services easier and quicker to use by allowing them to be dragged and dropped into opened services:
Additionally, you can also view a one-liner's Javadoc by right-clicking on it in the Coder Navigator view and selecting Open Javadoc:
Collection of One-liners
Most one-liners are made and maintained by TORO and are specifically for use in TORO Integrate. These one-liners are listed and described in the following table:
Name | For Groovy | For Gloop | Description |
---|---|---|---|
io.toro.integrate.ArrayMethods |
No | Yes | Contains extension methods for performing operations on iterables. |
io.toro.integrate.CacheMethods |
Yes | Yes | Contains extension methods for managing caches. |
io.toro.integrate.CoreMethods |
Yes | No | Contains extension methods for invoking services and getting objects from TORO Integrate's application context. |
io.toro.integrate.CsvMethods |
Yes | No | Contains extension methods for CSV-related operations. |
io.toro.integrate.EmailMethods |
No | Yes | Contains utility methods for reading and sending emails. |
io.toro.integrate.FileMethods |
Yes | Yes | Contains extension methods for reading and writing to files. |
io.toro.integrate.FlatFileMethods |
No | Yes | Contains utility methods for reading and writing to flat files. |
io.toro.integrate.FluxMethods |
Yes | Yes | Contains extension methods for executing, terminating, sending events, adding and removing tags, and getting the contexts of Flux services. |
io.toro.integrate.GloopMethods |
No | Yes | Contains a variety of handy methods for use inside Gloop services. |
io.toro.integrate.GroovyMethods |
Yes | Yes | Contains extension methods that help manage packages, package properties, instance properties, and others. |
io.toro.integrate.HttpClientMethods |
Yes | No | Contains extension methods for HTTP operations. |
io.toro.integrate.HttpMethods |
No | Yes | Contains utility methods for mapping HTTP-based operations in Gloop. |
io.toro.integrate.IntegrateMethods |
No | Yes | Contains utility methods for managing Integrate packages and endpoints in Gloop. |
io.toro.integrate.JabberMethods |
Yes | Yes | Contains extension methods for sending and receiving instant messages from Jabber endpoints. |
io.toro.integrate.JDBCConnectionPoolMethods |
No | Yes | Contains extension methods for managing the lifecycle of database connection pools. |
io.toro.integrate.JmsMethods |
Yes | Yes | Contains extension methods for publishing and responding to JMS messages. |
io.toro.integrate.JsonMethods |
No | Yes | Contains utility methods for creating a Gloop object from a JSON string and vice versa. |
io.toro.integrate.KafkaClientsMethods |
Yes | Yes | Contains extension methods for interacting with Kafka. |
io.toro.integrate.LoggerMethods |
Yes | Yes | Contains extension methods for logging messages. |
io.toro.integrate.MarshallerMethods |
Yes | No | Contains extension methods for converting objects to and from JSON or XML. |
io.toro.integrate.MonitorMethods |
Yes | Yes | Contains extension methods for searching the Monitor search index, managing Monitor rules, and checking and setting API costs. |
io.toro.integrate.NumberMethods |
Yes | Yes | Exposes Apache Commons Lang's NumberUtils class as a one-liner. |
io.toro.integrate.ProxyRequestMethods |
Yes | Yes | Contains extension methods used to proxy incoming HTTP requests to another server; helpful when dealing with legacy APIs. |
io.toro.integrate.RestMethods |
Yes | No | Contains extension methods for executing requests against REST endpoints. |
io.toro.integrate.RssMethods |
Yes | Yes | Contains extension methods for fetching RSS feeds. |
io.toro.integrate.SolrMethods |
Yes | Yes | Contains extension methods for querying and writing to Solr cores and creating Solr schemas. |
io.toro.integrate.SqlMethods |
Yes | Yes | Contains extension methods for connecting to JDBC databases. |
io.toro.integrate.StreamMethods |
No | Yes | Contains utility methods for mapping Streams in Gloop. |
io.toro.integrate.StringMethods |
Yes | Yes | Contains extension methods for manipulating streams; exposes Apache Commons Lang's StringUtils class as a one-liner. |
io.toro.integrate.TrackerMethods |
Yes | Yes | Contains extension methods for adding, searching, updating, and deleting documents in the Tracker search index. |
io.toro.integrate.UrlMethods |
Yes | Yes | Contains extension methods for manipulating URLs. |
io.toro.integrate.UserGroupMethods |
No | Yes | Contains extension methods for managing access control. |
io.toro.integrate.UtilMethods |
Yes | Yes | Contains extension methods for formatting and converting double and long values to string values. |
io.toro.integrate.VelocityMethods |
Yes | Yes | Contains extension methods for parsing Velocity templates. |
io.toro.integrate.VfsMethods |
Yes | Yes | Contains extension methods for sending and fetching files, especially files from remote servers. |
io.toro.integrate.WebSocketMethods |
Yes | Yes | Contains extension methods for sending web socket messages. |
io.toro.integrate.WidgetPageMethods |
Yes | Yes | Contains extension methods for fetching pages and widgets made from the Report Builder. |
io.toro.integrate.XmlMethods |
No | Yes | Contains utility methods for creating a Gloop object from an XML string and vice versa. |
Why are some classes not meant for use in Gloop or Groovy?
All one-liners are written in Groovy and thus, can be used in Groovy code2. As a consequence, they can also be used in Gloop invoke and Gloovy steps. There are no restrictions in where or when to use one-liners but TORO recommends using Gloop or Groovy's built-in features when they provide more or less the same benefit as using a one-liner.
Some one-liners are not needed in Groovy because Groovy already provides the means to perform their operations inherently using a single line of code; likewise, some one-liners are not recommended for use in Gloop because Gloop already has the constructs necessary to perform those functions natively.
The following helper classes from Apache Commons are also exposed, for use in both Gloop and Groovy:
org.apache.commons.codec.digest.DigestUtils
org.apache.commons.lang3.BooleanUtils
org.apache.commons.lang3.RandomStringUtils
org.apache.commons.lang3.StringEscapeUtils
org.apache.commons.lang3.time.DateFormatUtils
org.apache.commons.lang3.time.DateUtils
Additionally, TORO Integrate exposes the Groovy class
org.codehaus.groovy.runtime.DefaultGroovyMethods
which is
comprised of a variety of methods that one can use to modify strings, perform operations on collections, read and write
to files, and more.
Create your own one-liners!
TORO Integrate allows you to register your own custom extension modules.
-
Gloop-specific one-liners are actually just regular
public
static
methods available for use for all classes. One-liners usable in Groovy are those that are exposed via extension modules as instance extension methods. ↩ -
When using Gloop-specific one-liners in Groovy, call the one-liner services as static methods as they are technically not extension methods. ↩