Java Code Examples for org.quartz.JobDetail#getJobListenerNames()

The following examples show how to use org.quartz.JobDetail#getJobListenerNames() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PointbaseDelegate.java    From AsuraFramework with Apache License 2.0 5 votes vote down vote up
/**
 * <p>
 * Insert the job detail record.
 * </p>
 * 
 * @param conn
 *          the DB Connection
 * @param job
 *          the job to insert
 * @return number of rows inserted
 * @throws IOException
 *           if there were problems serializing the JobDataMap
 */
public int insertJobDetail(Connection conn, JobDetail job)
    throws IOException, SQLException {
    //log.debug( "Inserting JobDetail " + job );
    ByteArrayOutputStream baos = serializeJobData(job.getJobDataMap());
    int len = baos.toByteArray().length;
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());

    PreparedStatement ps = null;

    int insertResult = 0;

    try {
        ps = conn.prepareStatement(rtp(INSERT_JOB_DETAIL));
        ps.setString(1, job.getName());
        ps.setString(2, job.getGroup());
        ps.setString(3, job.getDescription());
        ps.setString(4, job.getJobClass().getName());
        setBoolean(ps, 5, job.isDurable());
        setBoolean(ps, 6, job.isVolatile());
        setBoolean(ps, 7, job.isStateful());
        setBoolean(ps, 8, job.requestsRecovery());
        ps.setBinaryStream(9, bais, len);

        insertResult = ps.executeUpdate();
    } finally {
        closeStatement(ps);
    }

    if (insertResult > 0) {
        String[] jobListeners = job.getJobListenerNames();
        for (int i = 0; jobListeners != null && i < jobListeners.length; i++) {
            insertJobListener(conn, job, jobListeners[i]);
        }
    }

    return insertResult;
}
 
Example 2
Source File: PointbaseDelegate.java    From AsuraFramework with Apache License 2.0 5 votes vote down vote up
/**
 * <p>
 * Update the job detail record.
 * </p>
 * 
 * @param conn
 *          the DB Connection
 * @param job
 *          the job to update
 * @return number of rows updated
 * @throws IOException
 *           if there were problems serializing the JobDataMap
 */
public int updateJobDetail(Connection conn, JobDetail job)
    throws IOException, SQLException {
    //log.debug( "Updating job detail " + job );
    ByteArrayOutputStream baos = serializeJobData(job.getJobDataMap());
    int len = baos.toByteArray().length;
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());

    PreparedStatement ps = null;

    int insertResult = 0;

    try {
        ps = conn.prepareStatement(rtp(UPDATE_JOB_DETAIL));
        ps.setString(1, job.getDescription());
        ps.setString(2, job.getJobClass().getName());
        setBoolean(ps, 3, job.isDurable());
        setBoolean(ps, 4, job.isVolatile());
        setBoolean(ps, 5, job.isStateful());
        setBoolean(ps, 6, job.requestsRecovery());
        ps.setBinaryStream(7, bais, len);
        ps.setString(8, job.getName());
        ps.setString(9, job.getGroup());

        insertResult = ps.executeUpdate();
    } finally {
        closeStatement(ps);
    }

    if (insertResult > 0) {
        deleteJobListeners(conn, job.getName(), job.getGroup());

        String[] jobListeners = job.getJobListenerNames();
        for (int i = 0; jobListeners != null && i < jobListeners.length; i++) {
            insertJobListener(conn, job, jobListeners[i]);
        }
    }

    return insertResult;
}
 
Example 3
Source File: StdJDBCDelegate.java    From AsuraFramework with Apache License 2.0 5 votes vote down vote up
/**
 * <p>
 * Insert the job detail record.
 * </p>
 * 
 * @param conn
 *          the DB Connection
 * @param job
 *          the job to insert
 * @return number of rows inserted
 * @throws IOException
 *           if there were problems serializing the JobDataMap
 */
public int insertJobDetail(Connection conn, JobDetail job)
    throws IOException, SQLException {
    ByteArrayOutputStream baos = serializeJobData(job.getJobDataMap());

    PreparedStatement ps = null;

    int insertResult = 0;

    try {
        ps = conn.prepareStatement(rtp(INSERT_JOB_DETAIL));
        ps.setString(1, job.getName());
        ps.setString(2, job.getGroup());
        ps.setString(3, job.getDescription());
        ps.setString(4, job.getJobClass().getName());
        setBoolean(ps, 5, job.isDurable());
        setBoolean(ps, 6, job.isVolatile());
        setBoolean(ps, 7, job.isStateful());
        setBoolean(ps, 8, job.requestsRecovery());
        setBytes(ps, 9, baos);

        insertResult = ps.executeUpdate();
    } finally {
        closeStatement(ps);
    }

    if (insertResult > 0) {
        String[] jobListeners = job.getJobListenerNames();
        for (int i = 0; jobListeners != null && i < jobListeners.length; i++) {
            insertJobListener(conn, job, jobListeners[i]);
        }
    }

    return insertResult;
}
 
Example 4
Source File: StdJDBCDelegate.java    From AsuraFramework with Apache License 2.0 5 votes vote down vote up
/**
 * <p>
 * Update the job detail record.
 * </p>
 * 
 * @param conn
 *          the DB Connection
 * @param job
 *          the job to update
 * @return number of rows updated
 * @throws IOException
 *           if there were problems serializing the JobDataMap
 */
public int updateJobDetail(Connection conn, JobDetail job)
    throws IOException, SQLException {
    ByteArrayOutputStream baos = serializeJobData(job.getJobDataMap());

    PreparedStatement ps = null;

    int insertResult = 0;

    try {
        ps = conn.prepareStatement(rtp(UPDATE_JOB_DETAIL));
        ps.setString(1, job.getDescription());
        ps.setString(2, job.getJobClass().getName());
        setBoolean(ps, 3, job.isDurable());
        setBoolean(ps, 4, job.isVolatile());
        setBoolean(ps, 5, job.isStateful());
        setBoolean(ps, 6, job.requestsRecovery());
        setBytes(ps, 7, baos);
        ps.setString(8, job.getName());
        ps.setString(9, job.getGroup());

        insertResult = ps.executeUpdate();
    } finally {
        closeStatement(ps);
    }

    if (insertResult > 0) {
        deleteJobListeners(conn, job.getName(), job.getGroup());

        String[] jobListeners = job.getJobListenerNames();
        for (int i = 0; jobListeners != null && i < jobListeners.length; i++) {
            insertJobListener(conn, job, jobListeners[i]);
        }
    }

    return insertResult;
}