public synchronized CarteObjectEntry getFirstCarteObjectEntry( String jobName ) { for ( CarteObjectEntry key : jobMap.keySet() ) { if ( key.getName().equals( jobName ) ) { return key; } } return null; }
public CarteObjectEntry getFirstCarteObjectEntry( String transName ) { for ( CarteObjectEntry key : transMap.keySet() ) { if ( key.getName().equals( transName ) ) { return key; } } return null; }
/** * @param transformationName * @return The first transformation configuration with the specified name */ public TransConfiguration getConfiguration( String transformationName ) { for ( CarteObjectEntry entry : transMap.keySet() ) { if ( entry.getName().equals( transformationName ) ) { return transMap.get( entry ).getConfiguration(); } } return null; }
public synchronized JobConfiguration getConfiguration( String jobName ) { for ( CarteObjectEntry entry : configurationMap.keySet() ) { if ( entry.getName().equals( jobName ) ) { return getConfiguration( entry ); } } return null; }
/** * Find the first transformation in the list that comes to mind! * * @param transformationName * @return the first transformation with the specified name */ public Trans getTransformation( String transformationName ) { for ( CarteObjectEntry entry : transMap.keySet() ) { if ( entry.getName().equals( transformationName ) ) { return transMap.get( entry ).getTrans(); } } return null; }
/** * Find the first job in the list that comes to mind! * * @param jobName * @return the first transformation with the specified name */ public synchronized Job getJob( String jobName ) { for ( CarteObjectEntry entry : jobMap.keySet() ) { if ( entry.getName().equals( jobName ) ) { return getJob( entry ); } } return null; }
/** * Deallocate all the ports for the given transformation entry, across all hosts. * * @param entry * the transformation object entry name to release the sockets for */ public void deallocateServerSocketPorts( CarteObjectEntry entry ) { for ( String hostname : hostServerSocketPortsMap.keySet() ) { List<SocketPortAllocation> serverSocketPorts = hostServerSocketPortsMap.get( hostname ); for ( SocketPortAllocation spa : hostServerSocketPortsMap.get( hostname ) ) { synchronized ( spa ) { if ( spa.getTransformationName().equalsIgnoreCase( entry.getName() ) ) { spa.setAllocated( false ); } } } } }
@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; }
@Override public Object doCall() throws Exception { while ( condition.get() ) { int i = random.nextInt( INITIAL_JOB_MAP_SIZE ); CarteObjectEntry entry = jobMap.getJobObjects().get( i ); if ( entry == null ) { throw new IllegalStateException( String.format( "Returned CarteObjectEntry must not be null. EntryId = %d", i ) ); } final String jobName = JOB_NAME_STRING + i; Job job = jobMap.getJob( entry.getName() ); if ( job == null ) { throw new IllegalStateException( String.format( "Returned job must not be null. Job name = %s", jobName ) ); } JobConfiguration jobConfiguration = jobMap.getConfiguration( entry.getName() ); if ( jobConfiguration == null ) { throw new IllegalStateException( String.format( "Returned jobConfiguration must not be null. Job name = %s", jobName ) ); } } return null; } }
@GET @Path( "/status/{id : .+}" ) @Produces( { MediaType.APPLICATION_JSON } ) public TransformationStatus getTransformationStatus( @PathParam( "id" ) String id ) { TransformationStatus status = new TransformationStatus(); // find trans Trans trans = CarteResource.getTransformation( id ); CarteObjectEntry entry = CarteResource.getCarteObjectEntry( id ); status.setId( entry.getId() ); status.setName( entry.getName() ); status.setStatus( trans.getStatus() ); for ( int i = 0; i < trans.nrSteps(); i++ ) { StepInterface step = trans.getRunThread( i ); if ( ( step.isRunning() ) || step.getStatus() != StepExecutionStatus.STATUS_EMPTY ) { StepStatus stepStatus = new StepStatus( step ); status.addStepStatus( stepStatus ); } } return status; }
String status = trans.getStatus(); SlaveServerTransStatus sstatus = new SlaveServerTransStatus( entry.getName(), entry.getId(), status ); sstatus.setLogDate( trans.getLogDate() ); sstatus.setPaused( trans.isPaused() ); Job job = getJobMap().getJob( entry ); String status = job.getStatus(); SlaveServerJobStatus jobStatus = new SlaveServerJobStatus( entry.getName(), entry.getId(), status ); jobStatus.setLogDate( job.getLogDate() ); serverStatus.getJobStatusList().add( jobStatus ); String name = transEntries.get( i ).getName(); String id = transEntries.get( i ).getId(); Trans trans = getTransformationMap().getTransformation( transEntries.get( i ) ); String name = jobEntries.get( i ).getName(); String id = jobEntries.get( i ).getId(); Job job = getJobMap().getJob( jobEntries.get( i ) );