diff --git a/pentaho-kettle/src/main/java/org/pentaho/di/job/Job.java b/pentaho-kettle/src/main/java/org/pentaho/di/job/Job.java index 16a6fd4..6004574 100644 --- a/pentaho-kettle/src/main/java/org/pentaho/di/job/Job.java +++ b/pentaho-kettle/src/main/java/org/pentaho/di/job/Job.java @@ -88,6 +88,9 @@ public class Job extends Thread implements VariableSpace, NamedParams, HasLogCha public static final String CONFIGURATION_IN_EXPORT_FILENAME = "__job_execution_configuration__.xml"; + public static final long MAX_JOB_DURATION_MS // by default, every job must be completed within 4 hours + = Integer.parseInt(System.getProperty("KETTLE_MAX_JOB_DURATION_MS", "14400000")); + private LogChannelInterface log; private LogLevel logLevel = DefaultLogLevel.getLogLevel(); @@ -904,7 +907,9 @@ public void waitUntilFinished() { */ public void waitUntilFinished(long maxMiliseconds) { long time = 0L; - while (isAlive() && (time < maxMiliseconds || maxMiliseconds <= 0)) { + maxMiliseconds = + maxMiliseconds <= 0 || maxMiliseconds > MAX_JOB_DURATION_MS ? MAX_JOB_DURATION_MS : maxMiliseconds; + while (isAlive() && (time < maxMiliseconds)) { try { Thread.sleep(1); time += 1; diff --git a/pentaho-kettle/src/main/java/org/pentaho/di/trans/Trans.java b/pentaho-kettle/src/main/java/org/pentaho/di/trans/Trans.java index 85873a3..6469dbf 100644 --- a/pentaho-kettle/src/main/java/org/pentaho/di/trans/Trans.java +++ b/pentaho-kettle/src/main/java/org/pentaho/di/trans/Trans.java @@ -103,6 +103,9 @@ public class Trans implements VariableSpace, NamedParams, HasLogChannelInterface private static final boolean KETTLE_TRANS_PREVIEW_DISABLED = "Y".equalsIgnoreCase(System.getProperty("KETTLE_TRANS_PREVIEW_DISABLED", "Y")); + private static final long MAX_TRANS_DURATION_MS // by default, every trans must be completed within 4 hours + = Integer.parseInt(System.getProperty("KETTLE_MAX_TRANS_DURATION_MS", "14400000")); + /** * The replay date format. */ @@ -1623,7 +1626,7 @@ public void waitUntilFinished() { } boolean wait = true; while (wait) { - wait = transFinishedBlockingQueue.poll(1, TimeUnit.DAYS) == null; + wait = transFinishedBlockingQueue.poll(MAX_TRANS_DURATION_MS, TimeUnit.MILLISECONDS) == null; } } catch (InterruptedException e) { throw new RuntimeException("Waiting for transformation to be finished interrupted!", e); diff --git a/pentaho-kettle/src/main/java/org/pentaho/di/www/GetCacheStatusServlet.java b/pentaho-kettle/src/main/java/org/pentaho/di/www/GetCacheStatusServlet.java index 6b341a7..220f50b 100644 --- a/pentaho-kettle/src/main/java/org/pentaho/di/www/GetCacheStatusServlet.java +++ b/pentaho-kettle/src/main/java/org/pentaho/di/www/GetCacheStatusServlet.java @@ -79,6 +79,10 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) thro String identity = ServerCache.getCachedIdentity(resourceName); if (!Strings.isNullOrEmpty(identity)) { result.setId(identity); + } else { + result.setResult(WebResult.STRING_ERROR); + result.setMessage( + new StringBuilder().append('[').append(resourceName).append("] not found").toString()); } } } diff --git a/pentaho-platform/pom.xml b/pentaho-platform/pom.xml index fc1323c..767f7b3 100644 --- a/pentaho-platform/pom.xml +++ b/pentaho-platform/pom.xml @@ -23,6 +23,16 @@ pentaho-platform-api ${pentaho-ce.version} + + pentaho-reporting-engine + pentaho-reporting-engine-classic-core + ${pentaho-ce.version} + + + pentaho-reporting-engine + pentaho-reporting-engine-classic-core-platform-plugin + ${pentaho-ce.version} + pentaho pentaho-platform-repository @@ -33,6 +43,16 @@ pentaho-platform-scheduler ${pentaho-ce.version} + + pentaho-kettle + kettle-core + ${pentaho-ce.version} + + + pentaho-kettle + kettle-engine + ${pentaho-ce.version} + org.quartz-scheduler quartz diff --git a/pentaho-platform/src/main/java/org/pentaho/reporting/platform/plugin/connection/PentahoJndiDatasourceConnectionProvider.java b/pentaho-platform/src/main/java/org/pentaho/reporting/platform/plugin/connection/PentahoJndiDatasourceConnectionProvider.java index 603c5ea..5a472f9 100644 --- a/pentaho-platform/src/main/java/org/pentaho/reporting/platform/plugin/connection/PentahoJndiDatasourceConnectionProvider.java +++ b/pentaho-platform/src/main/java/org/pentaho/reporting/platform/plugin/connection/PentahoJndiDatasourceConnectionProvider.java @@ -17,8 +17,12 @@ package org.pentaho.reporting.platform.plugin.connection; +import com.google.common.base.Strings; +import org.pentaho.database.model.DatabaseAccessType; +import org.pentaho.database.model.IDatabaseConnection; import org.pentaho.platform.api.data.IDBDatasourceService; import org.pentaho.platform.api.engine.ObjectFactoryException; +import org.pentaho.platform.api.repository.datasource.IDatasourceMgmtService; import org.pentaho.platform.engine.core.system.PentahoSystem; import org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.ConnectionProvider; @@ -52,6 +56,15 @@ public PentahoJndiDatasourceConnectionProvider() { */ public Connection createConnection(final String user, final String password) throws SQLException { try { + IDatasourceMgmtService dmService = PentahoSystem.get(IDatasourceMgmtService.class, null); + IDatabaseConnection dbConn = dmService == null ? null : dmService.getDatasourceByName(jndiName); + + if (dbConn != null && dbConn.getAccessType() == DatabaseAccessType.JNDI + && !Strings.isNullOrEmpty(dbConn.getDatabaseName())) { + // FIXME this is probably too tricky... let's do it just once for each call to avoid endless-loop + jndiName = dbConn.getDatabaseName(); + } + final IDBDatasourceService datasourceService = PentahoSystem.getObjectFactory().get(IDBDatasourceService.class, null); final DataSource dataSource = datasourceService.getDataSource(jndiName); @@ -120,13 +133,13 @@ public Connection createConnection(final String user, final String password) thr Messages .getInstance() .getErrorString( - "PentahoDatasourceConnectionProvider.ERROR_0002_UNABLE_TO_FACTORY_OBJECT", jndiName, e.getLocalizedMessage())); //$NON-NLS-1$ + "PentahoDatasourceConnectionProvider.ERROR_0002_UNABLE_TO_FACTORY_OBJECT", jndiName, e.getLocalizedMessage()), e); //$NON-NLS-1$ } catch (ObjectFactoryException objface) { throw new SQLException( Messages .getInstance() .getErrorString( - "PentahoDatasourceConnectionProvider.ERROR_0002_UNABLE_TO_FACTORY_OBJECT", jndiName, e.getLocalizedMessage())); //$NON-NLS-1$ + "PentahoDatasourceConnectionProvider.ERROR_0002_UNABLE_TO_FACTORY_OBJECT", jndiName, e.getLocalizedMessage()), e); //$NON-NLS-1$ } } }