Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

We

...

have

...

an

...

integration

...

with

...

Apache

...

Ant

...

which

...

is

...

“a

...

Java-based

...

build

...

tool”.

...

It

...

is

...

now

...

possible

...

to

...

send

...

messages

...

to

...

Apache

...

ESME

...

that

...

describe

...

the

...

progress

...

of

...

your

...

build

...

steps.

...

This

...

is

...

especially

...

useful

...

when

...

Apache

...

ESME

...

is

...

being

...

in

...

development

...

projects

...

where

...

individual

...

developers

...

can

...

be

...

made

...

aware

...

of

...

the

...

status

...

of

...

various-build

...

related

...

actions.

...

For

...

example,

...

a

...

development

...

team

...

could

...

be

...

informed

...

that

...

a

...

build

...

is

...

broken

...

or

...

if

...

it

...

is

...

successful.

...

Directory

...

Structure

...

-

...

Setup

...

  1. Install

...

  1. the

...

  1. apache

...

  1. tool

...

  1. "ant"

...

  1. Create

...

  1. lib

...

  1. directory

...

  1. and

...

  1. copy

...

  1. "rest-api-0.1-SNAPSHOT.jar",

...

  1. "commons-codec-1.2.jar",

...

  1. "commons-httpclient-3.1.jar"

...

  1. into

...

  1. this

...

  1. directory.

...

  1. Note:

...

  1. You

...

  1. can

...

  1. get

...

  1. these

...

  1. libraries

...

  1. via

...

  1. the

...

  1. Google

...

  1. Code

...

  1. archive

...

  1. Create

...

  1. src

...

  1. directory

...

  1. and

...

  1. copy

...

  1. the

...

  1. "EsmeAntTask?.java"

...

  1. file

...

  1. to

...

  1. this

...

  1. directory

...

  1. Change

...

  1. the

...

  1. build.xml

...

  1. file

...

  1. to

...

  1. point

...

  1. to

...

  1. the

...

  1. appropriate

...

  1. directories

...

  1. Change

...

  1. the

...

  1. token

...

  1. in

...

  1. the

...

  1. "esme"

...

  1. target

...

  1. in

...

  1. the

...

  1. build.xml

...

  1. file

...

  1. to

...

  1. a

...

  1. correct

...

  1. token.

...

  1. Change

...

  1. the

...

  1. proxy

...

  1. in

...

  1. the

...

  1. "esme"

...

  1. target

...

  1. in

...

  1. the

...

  1. build.xml

...

  1. file

...

  1. to

...

  1. a

...

  1. correct

...

  1. proxy.

...

  1. call

...

  1. ant

...

  1. dist

...

  1. esme

...

  1. to

...

  1. test

...

  1. the

...

  1. application

...

Build.xml

Code Block
langxml

<project name="EsmeViaAnt" default="dist" basedir=".">
   <!-- set global properties for this build -->
   <property name="src" location="src"/>
   <property name="build" location="build"/>
   <property name="dist"  location location="dist"/>
 
      <path id="project.class.path">
      <pathelement path="./dist/lib/EsmeViaAnt.jar:./lib/esme-rest-api-0.1-SNAPSHOT.jar:./lib/commons-codec-1.2.jar:./lib/commons-logging-1.0.4.jar:./lib/commons-httpclient-3.1.jar/"/>
   </path>


   <target name="init">
      <!-- Create the time stamp -->
      <tstamp/>
      <!-- Create the build directory structure used by compile -->
      <mkdir dir="${build}"/>
   </target>

   <target name="compile" depends="init"
            description="compile the source " >
      <!-- Compile the java code from ${src} into ${build} -->
      <javac srcdir="${src}" destdir="${build}">
      <classpath refid="project.class.path"/>
                               </javac>
   </target>

   <target name="dist" depends="compile"
            description="generate the distribution" >
      <!-- Create the distribution directory -->
      <mkdir dir="${dist}/lib"/>

      <!-- Put everything in ${build} into the jar file -->
      <jar jarfile="${dist}/lib/EsmeViaAnt.jar" basedir="${build}"/>
   </target>
 
   <target name="esme"
            description="Send Esme" >
            <java fork="true"
              classnameclassname="EsmeAntTask">
              <arg<arg value="http://api.esme.us/esme/api"/>
              <arg<arg value="IFDHJ2RNDECAT84ZJZUKDE59TVOIVTXL"/>
              <arg<arg value="proxy:81"/>
              <arg<arg value="A message from the ant build process"/>
              <classpath>
               <pathelement<classpath>
               <pathelement path="./dist/lib/EsmeViaAnt.jar:./lib/esme-rest-api-0.1-SNAPSHOT.jar:./lib/commons-codec-1.2.jar:./lib/commons-logging-1.0.4.jar:./lib/commons-httpclient-3.1.jar/"/>
              <</classpath>

           <</java>
   </target>
 
</project>

h1. 

EsmeAntTask?

...

java

...

class

Code Block

import us.esme.api.EsmeRestApi;
import us.esme.api.Message;
 
public class EsmeAntTask
{

public static void main (String[] args) {

 String String apiUrl;
 String String authToken;
 String String localProxy;
 String String message;
 EsmeRestApi EsmeRestApi esme;    
 
 apiUrl apiUrl = args[0];
 authToken authToken = args[1];
 localProxy localProxy = args[2];
 message message = args[3];
 
 try try {
 
              esmeesme = new EsmeRestApi(apiUrl);
 
         
         ifif ((localProxy != null) && !("".equals(localProxy)))
              {
                               // Split proxyHost:port into two parts
                               String[] proxy = localProxy.split(":");
                               esme.setProxy(proxy[0], Integer.parseInt(proxy[1]));
              }
 
         
         esmeesme.login(authToken);

          
         MessageMessage esmeMsg = new Message();

          
         esmeMsgesmeMsg.setText(message);
 
         
         StringString[] tags = new String[1];
              tagstags[0] = "Ant Task";
 
         
         esmeMsgesmeMsg.setTags(tags);
 
         
         esmeMsgesmeMsg.setVia("Ant");
 
         
         esmeesme.sendMsg(esmeMsg);
  }
 catch catch (Exception e) {}
  }
}