use of org.pentaho.di.www.CarteObjectEntry in project pentaho-kettle by pentaho.
the class CarteResource method getJobsDetails.
@GET
@Path("/jobs/detailed")
@Produces({ MediaType.APPLICATION_JSON })
public List<JobStatus> getJobsDetails() {
List<CarteObjectEntry> jobEntries = CarteSingleton.getInstance().getJobMap().getJobObjects();
List<JobStatus> details = new ArrayList<JobStatus>();
JobResource jobRes = new JobResource();
for (CarteObjectEntry entry : jobEntries) {
details.add(jobRes.getJobStatus(entry.getId()));
}
return details;
}
use of org.pentaho.di.www.CarteObjectEntry in project pentaho-kettle by pentaho.
the class CarteResource method getCarteObjectEntry.
public static CarteObjectEntry getCarteObjectEntry(String id) {
List<CarteObjectEntry> transList = CarteSingleton.getInstance().getTransformationMap().getTransformationObjects();
for (CarteObjectEntry entry : transList) {
if (entry.getId().equals(id)) {
return entry;
}
}
List<CarteObjectEntry> jobList = CarteSingleton.getInstance().getJobMap().getJobObjects();
for (CarteObjectEntry entry : jobList) {
if (entry.getId().equals(id)) {
return entry;
}
}
return null;
}
use of org.pentaho.di.www.CarteObjectEntry in project pentaho-kettle by pentaho.
the class CarteResource method getTransformationsDetails.
@GET
@Path("/transformations/detailed")
@Produces({ MediaType.APPLICATION_JSON })
public List<TransformationStatus> getTransformationsDetails() {
List<CarteObjectEntry> transEntries = CarteSingleton.getInstance().getTransformationMap().getTransformationObjects();
List<TransformationStatus> details = new ArrayList<TransformationStatus>();
TransformationResource transRes = new TransformationResource();
for (CarteObjectEntry entry : transEntries) {
details.add(transRes.getTransformationStatus(entry.getId()));
}
return details;
}
use of org.pentaho.di.www.CarteObjectEntry in project pentaho-kettle by pentaho.
the class JobResource method startJob.
// change from GET to UPDATE/POST for proper REST method
@GET
@Path("/start/{id : .+}")
@Produces({ MediaType.APPLICATION_JSON })
public JobStatus startJob(@PathParam("id") String id) {
Job job = CarteResource.getJob(id);
CarteObjectEntry entry = CarteResource.getCarteObjectEntry(id);
try {
if (job.isInitialized() && !job.isActive()) {
//
if (job.getRep() != null && !job.getRep().isConnected()) {
if (job.getRep().getUserInfo() != null) {
job.getRep().connect(job.getRep().getUserInfo().getLogin(), job.getRep().getUserInfo().getPassword());
} else {
job.getRep().connect(null, null);
}
}
//
synchronized (this) {
JobConfiguration jobConfiguration = CarteSingleton.getInstance().getJobMap().getConfiguration(entry);
String carteObjectId = UUID.randomUUID().toString();
SimpleLoggingObject servletLoggingObject = new SimpleLoggingObject(getClass().getName(), LoggingObjectType.CARTE, null);
servletLoggingObject.setContainerObjectId(carteObjectId);
Job newJob = new Job(job.getRep(), job.getJobMeta(), servletLoggingObject);
newJob.setLogLevel(job.getLogLevel());
// Discard old log lines from the old job
//
KettleLogStore.discardLines(job.getLogChannelId(), true);
CarteSingleton.getInstance().getJobMap().replaceJob(entry, newJob, jobConfiguration);
job = newJob;
}
}
job.start();
} catch (KettleException e) {
e.printStackTrace();
}
return getJobStatus(id);
}
use of org.pentaho.di.www.CarteObjectEntry in project pentaho-kettle by pentaho.
the class JobResource method getJobStatus.
@GET
@Path("/status/{id : .+}")
@Produces({ MediaType.APPLICATION_JSON })
public JobStatus getJobStatus(@PathParam("id") String id) {
JobStatus status = new JobStatus();
// find job
Job job = CarteResource.getJob(id);
CarteObjectEntry entry = CarteResource.getCarteObjectEntry(id);
status.setId(entry.getId());
status.setName(entry.getName());
status.setStatus(job.getStatus());
return status;
}
Aggregations