com.elpical.jclaro.ws.server
Class JobImpl

java.lang.Object
  extended by com.elpical.jclaro.ws.server.JobImpl

@MTOM
@BindingType(value="http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/")
public class JobImpl
extends java.lang.Object

This Webservices interface contains the methods for accessing Claro with jobfiles.
The interface is published by JAX-WS RI with : http://<hostname>:<port>/jclarojaxws/job?wsdl

if you use Java, you can use the following code snippet:

        import com.elpical.jclaro.ws.client.JobImpl;
        import com.elpical.jclaro.ws.client.JobImplService;
     
        URL baseUrl = com.elpical.jclaro.ws.client.JobImplService.class.getResource(".");
        URL url = new URL(baseUrl, "http://"+hostname+":"+portnumber+"/jclarojaxws/job?wsdl");
        JobImplService anis = new JobImplService(url, new QName("http://server.ws.jclaro.elpical.com/", "JobImplService"));
        JobImpl port;
        if (asMTOM)
                port = anis.getJobImplPort(new MTOMFeature(true,8000));
        else
                port = anis.getJobImplPort();

The package is included in ClaroJobClient-<version>.jar (in the lib folder of the Claro installation)

After obtaining a valid port, the first thing to do is getting a ClientID, by calling getClientID().
This ID is needed for most usefull calls.

All Available Claro channels can be retrieved with getChannels(). One of them must be used for processing an image.

After getting the ClientID, an image file and a jobfile can be send to the server with processImage().
The jobfile must have the specified format below and can be complemented with tags defined in Manual_ClaroPremedia_Integration
IMPORTANT : the strings between "@" may not be replaced!

After calling processImage(), the server can be asked if the process has already been finished with isJobReady()
If the process has been finished, the image can be retrieved with getImageFile() and related information with getJobFile()

An example of the client implementation : ElpicalClaroWebservices_example.java (see folder examples_integration if the Claro installation)

jobfile format specification

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE preferences SYSTEM "http://java.sun.com/dtd/preferences.dtd"><preferences EXTERNAL_XML_VERSION="1.0">
 <root type="system">
   <map/>
   <node name="com">
     <map/>
      <node name="elpical">
       <map/>
       <node name="jclaro">
         <map/>
         <node name="preferences">
           <map/>
           <node name="job">
             <map/>
             <node name="Image">
               <map>
                 <entry key="PathName" value="@PathName@"/>
               </map>
             </node>
             <node name="Output">
               <map>
                 <entry key="DestinationFileName" value="@DestinationFileName@"/>
               </map>
             </node>
              <node name="JobControl">
                <map>
                 <entry key="FolderJob" value="@FolderJob@"/>
                 <entry key="ExportJobName" value="@ExportJobName@"/>
                 <entry key="ExportJob" value="true"/>
               </map>
             </node>
           </node>
         </node>
       </node>
     </node>
   </node>
 </root>
</preferences>


Constructor Summary
JobImpl()
          JobImpl should be instanced with JobImplService (see snippet above)
 
Method Summary
 void cancelJobs(java.lang.String clientid, java.lang.String image_set, java.lang.String channel_name)
          cancels the current job(s)
all related folders alre removed
 void checkClientID(java.lang.String clientid)
          checks if ClientID is valid or if the maximum is already reached
For internal usage a maximum number of clients can be used, if the maximum number of clients is exceeded, an exception is thrown
The maximum number is bounded to the license name, convention _JCx_ where x is the maximum.
 int getAnyJobReady(java.lang.String clid)
          checks if any job is ready for the actual ClientID
 java.lang.String[] getChannels()
          retrieves the installed channels
 java.util.ArrayList getClaroServers()
          returns number of available Claro servers in multiserver operation returns null if multiserver operation has not been configured For internal usage only!
 java.lang.String getClientID()
          returns a valid ClientID
should be called only once for the calling client.
A maximum number of clients can be used, if the maximum number of clients is exceeded, an exception is thrown
The maximum number is bounded to the license name, convention _JCx_ where x is the maximum.
 java.lang.String getClientIDinternal()
          returns a valid ClientID for internal use
should not be called, because this ID is bounded to license restrictions
 javax.activation.DataHandler getImageFile(java.lang.String clid, int jobid, java.lang.String imgname)
          retrieves the returned ImageFile of the processed image
 javax.activation.DataHandler getJobFile(java.lang.String clid, int jobid)
          retrieves the returned JobFile with information about the process
 java.util.ArrayList getMagazineTitles()
           
 java.lang.String getServerVersion()
          retrieves the server version
 boolean isJobReady(java.lang.String clid, int jobid)
          checks if the job is ready.
 void processImage(javax.activation.DataHandler jobdata, java.lang.String imgfilename, javax.activation.DataHandler imgdata, java.lang.String destination_imgfilename, java.lang.String channelstr, java.lang.String clientid, int jobid)
          send Image with Jobfile to the server and starts processing
 void removeJob(java.lang.String clientid, int jobid)
          removes all information on the server related to the specified job
should be called after job is finished and no more data should be retrieved for this job.
 boolean testConnection()
          Checks the server connection, if failed throws an exception
 void unregisterClientID(java.lang.String clientid)
          unregisters the ClientID
all related folders are removed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobImpl

public JobImpl()
JobImpl should be instanced with JobImplService (see snippet above)

Method Detail

getChannels

public java.lang.String[] getChannels()
retrieves the installed channels

Returns:
all installed channels
Throws:
java.lang.Exception

testConnection

public boolean testConnection()
Checks the server connection, if failed throws an exception

Returns:
true if connected to the server
Throws:
java.lang.Exception

getServerVersion

public java.lang.String getServerVersion()
retrieves the server version

Returns:
server version
Throws:
java.lang.Exception

isJobReady

public boolean isJobReady(java.lang.String clid,
                          int jobid)
checks if the job is ready.

Parameters:
clid - ClientID
jobid - JobID
Returns:
true if the job is ready otherwise false
Throws:
java.lang.Exception

getAnyJobReady

public int getAnyJobReady(java.lang.String clid)
checks if any job is ready for the actual ClientID

Parameters:
clid - ClientID
Returns:
the JobID which is ready, if no job is ready the value -1 is returned. If no actual job is present, -2 is returned
Throws:
java.lang.Exception

getJobFile

public javax.activation.DataHandler getJobFile(java.lang.String clid,
                                               int jobid)
retrieves the returned JobFile with information about the process

Parameters:
clid - ClientID
jobid - JobID
Returns:
DataHandler for the returned JobFile if the datahandler can not be generated, an exception is thrown
Throws:
javax.xml.ws.WebServiceException

getImageFile

public javax.activation.DataHandler getImageFile(java.lang.String clid,
                                                 int jobid,
                                                 java.lang.String imgname)
retrieves the returned ImageFile of the processed image

Parameters:
clid - ClientID
jobid - JobID
imgname - the DestinationFileName of the processed image
Returns:
DataHandler for the returned ImageFile if the datahandler can not be generated, an exception is thrown
Throws:
javax.xml.ws.WebServiceException

removeJob

public void removeJob(java.lang.String clientid,
                      int jobid)
removes all information on the server related to the specified job
should be called after job is finished and no more data should be retrieved for this job.

Parameters:
clientid - ClientID
jobid - JobID
Throws:
javax.xml.ws.WebServiceException

getClientID

public java.lang.String getClientID()
returns a valid ClientID
should be called only once for the calling client.
A maximum number of clients can be used, if the maximum number of clients is exceeded, an exception is thrown
The maximum number is bounded to the license name, convention _JCx_ where x is the maximum.

Returns:
valid ClientID
Throws:
javax.xml.ws.WebServiceException

getClientIDinternal

public java.lang.String getClientIDinternal()
returns a valid ClientID for internal use
should not be called, because this ID is bounded to license restrictions

Returns:
valid ClientID
Throws:
javax.xml.ws.WebServiceException

checkClientID

public void checkClientID(java.lang.String clientid)
checks if ClientID is valid or if the maximum is already reached
For internal usage a maximum number of clients can be used, if the maximum number of clients is exceeded, an exception is thrown
The maximum number is bounded to the license name, convention _JCx_ where x is the maximum.

Parameters:
clientid - ClientID
Throws:
javax.xml.ws.WebServiceException

unregisterClientID

public void unregisterClientID(java.lang.String clientid)
                        throws javax.xml.ws.WebServiceException
unregisters the ClientID
all related folders are removed

Parameters:
clientid - ClientID
Throws:
javax.xml.ws.WebServiceException

cancelJobs

public void cancelJobs(java.lang.String clientid,
                       java.lang.String image_set,
                       java.lang.String channel_name)
cancels the current job(s)
all related folders alre removed

Parameters:
clientid - ClientID
image_set - comma separated string with job id's or the string 'all' for all jobs of the related ClientID
channel_name - the name of channel for deleting the jobfiles in the related channel or null for not deleting the jobfiles in the related channel
Throws:
javax.xml.ws.WebServiceException

processImage

public void processImage(javax.activation.DataHandler jobdata,
                         java.lang.String imgfilename,
                         javax.activation.DataHandler imgdata,
                         java.lang.String destination_imgfilename,
                         java.lang.String channelstr,
                         java.lang.String clientid,
                         int jobid)
send Image with Jobfile to the server and starts processing

Parameters:
jobdata - DataHandler for the jobfile
imgfilename - filename of the original image
imgdata - DataHandler for the imagefile
destination_imgfilename - the DestinationFileName of the processed image
channelstr - the name of the processing channel
clientid - ClientID
jobid - JobID
Throws:
javax.xml.ws.WebServiceException

getMagazineTitles

public java.util.ArrayList getMagazineTitles()

getClaroServers

public java.util.ArrayList getClaroServers()
returns number of available Claro servers in multiserver operation returns null if multiserver operation has not been configured For internal usage only!

Returns:
list of servers
Throws:
java.lang.Exception


Copyright © 2010 Elpical Software B.V. All Rights Reserved.