Search in sources :

Example 1 with JobInstanceImpl

use of com.ibm.jbatch.container.jobinstance.JobInstanceImpl in project Payara by payara.

the class PostgresPersistenceManager method createJobInstance.

/*
	 * (non-Javadoc)
	 * 
	 * @see com.ibm.jbatch.container.services.IPersistenceManagerService#
	 * createJobInstance(java.lang.String, java.lang.String, java.lang.String,
	 * java.util.Properties)
	 */
@Override
public JobInstance createJobInstance(String name, String apptag, String jobXml) {
    Connection conn = null;
    PreparedStatement statement = null;
    ResultSet rs = null;
    JobInstanceImpl jobInstance = null;
    try {
        conn = getConnection();
        statement = conn.prepareStatement(queryStrings.get(CREATE_JOB_INSTANCE), statement.RETURN_GENERATED_KEYS);
        statement.setString(1, name);
        statement.setString(2, apptag);
        statement.executeUpdate();
        rs = statement.getGeneratedKeys();
        if (rs.next()) {
            long jobInstanceID = rs.getLong(1);
            jobInstance = new JobInstanceImpl(jobInstanceID, jobXml);
            jobInstance.setJobName(name);
        }
    } catch (SQLException e) {
        throw new PersistenceException(e);
    } finally {
        cleanupConnection(conn, rs, statement);
    }
    return jobInstance;
}
Also used : SQLException(java.sql.SQLException) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PersistenceException(com.ibm.jbatch.container.exception.PersistenceException) PreparedStatement(java.sql.PreparedStatement) JobInstanceImpl(com.ibm.jbatch.container.jobinstance.JobInstanceImpl)

Example 2 with JobInstanceImpl

use of com.ibm.jbatch.container.jobinstance.JobInstanceImpl in project Payara by payara.

the class HazelcastPersistenceService method createJobInstance.

@Override
public JobInstance createJobInstance(String name, String apptag, String jobXml) {
    long id = jobInstanceIdGenerator.newId();
    JobInstanceImpl result = new JobInstanceImpl(id);
    return null;
}
Also used : JobInstanceImpl(com.ibm.jbatch.container.jobinstance.JobInstanceImpl)

Example 3 with JobInstanceImpl

use of com.ibm.jbatch.container.jobinstance.JobInstanceImpl in project Payara by payara.

the class JBatchJDBCPersistenceManager method createJobInstance.

/*
	 * (non-Javadoc)
	 * 
	 * @see com.ibm.jbatch.container.services.IPersistenceManagerService#
	 * createJobInstance(java.lang.String, java.lang.String, java.lang.String,
	 * java.util.Properties)
	 */
@Override
public JobInstance createJobInstance(String name, String apptag, String jobXml) {
    Connection conn = null;
    PreparedStatement statement = null;
    ResultSet rs = null;
    JobInstanceImpl jobInstance = null;
    try {
        conn = getConnection();
        statement = conn.prepareStatement(queryStrings.get(CREATE_JOB_INSTANCE), new String[] { "JOBINSTANCEID" });
        statement.setString(1, name);
        statement.setString(2, apptag);
        statement.executeUpdate();
        rs = statement.getGeneratedKeys();
        if (rs.next()) {
            long jobInstanceID = rs.getLong(1);
            jobInstance = new JobInstanceImpl(jobInstanceID, jobXml);
            jobInstance.setJobName(name);
        }
    } catch (SQLException e) {
        throw new PersistenceException(e);
    } finally {
        cleanupConnection(conn, rs, statement);
    }
    return jobInstance;
}
Also used : SQLException(java.sql.SQLException) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PersistenceException(com.ibm.jbatch.container.exception.PersistenceException) PreparedStatement(java.sql.PreparedStatement) JobInstanceImpl(com.ibm.jbatch.container.jobinstance.JobInstanceImpl)

Example 4 with JobInstanceImpl

use of com.ibm.jbatch.container.jobinstance.JobInstanceImpl in project Payara by payara.

the class PostgresPersistenceManager method createSubJobInstance.

@Override
public JobInstance createSubJobInstance(String name, String apptag) {
    Connection conn = null;
    PreparedStatement statement = null;
    ResultSet rs = null;
    JobInstanceImpl jobInstance = null;
    try {
        conn = getConnection();
        statement = conn.prepareStatement(queryStrings.get(CREATE_SUB_JOB_INSTANCE), statement.RETURN_GENERATED_KEYS);
        statement.setString(1, name);
        statement.setString(2, apptag);
        statement.executeUpdate();
        rs = statement.getGeneratedKeys();
        if (rs.next()) {
            long jobInstanceID = rs.getLong(1);
            jobInstance = new JobInstanceImpl(jobInstanceID);
            jobInstance.setJobName(name);
        }
    } catch (SQLException e) {
        throw new PersistenceException(e);
    } finally {
        cleanupConnection(conn, rs, statement);
    }
    return jobInstance;
}
Also used : SQLException(java.sql.SQLException) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PersistenceException(com.ibm.jbatch.container.exception.PersistenceException) PreparedStatement(java.sql.PreparedStatement) JobInstanceImpl(com.ibm.jbatch.container.jobinstance.JobInstanceImpl)

Example 5 with JobInstanceImpl

use of com.ibm.jbatch.container.jobinstance.JobInstanceImpl in project Payara by payara.

the class JBatchJDBCPersistenceManager method createSubJobInstance.

/*
	 * (non-Javadoc)
	 * 
	 * @see com.ibm.jbatch.container.services.IPersistenceManagerService#
	 * createJobInstance(java.lang.String, java.lang.String, java.lang.String,
	 * java.util.Properties)
	 */
@Override
public JobInstance createSubJobInstance(String name, String apptag) {
    Connection conn = null;
    PreparedStatement statement = null;
    ResultSet rs = null;
    JobInstanceImpl jobInstance = null;
    try {
        conn = getConnection();
        statement = conn.prepareStatement(queryStrings.get(CREATE_SUB_JOB_INSTANCE), new String[] { "JOBINSTANCEID" });
        statement.setString(1, name);
        statement.setString(2, apptag);
        statement.executeUpdate();
        rs = statement.getGeneratedKeys();
        if (rs.next()) {
            long jobInstanceID = rs.getLong(1);
            jobInstance = new JobInstanceImpl(jobInstanceID);
            jobInstance.setJobName(name);
        }
    } catch (SQLException e) {
        throw new PersistenceException(e);
    } finally {
        cleanupConnection(conn, rs, statement);
    }
    return jobInstance;
}
Also used : SQLException(java.sql.SQLException) Connection(java.sql.Connection) ResultSet(java.sql.ResultSet) PersistenceException(com.ibm.jbatch.container.exception.PersistenceException) PreparedStatement(java.sql.PreparedStatement) JobInstanceImpl(com.ibm.jbatch.container.jobinstance.JobInstanceImpl)

Aggregations

JobInstanceImpl (com.ibm.jbatch.container.jobinstance.JobInstanceImpl)5 PersistenceException (com.ibm.jbatch.container.exception.PersistenceException)4 Connection (java.sql.Connection)4 PreparedStatement (java.sql.PreparedStatement)4 ResultSet (java.sql.ResultSet)4 SQLException (java.sql.SQLException)4