Examples of CommandResult


Examples of org.glite.ce.creamapi.cmdmanagement.CommandResult

        } catch (Throwable t) {
          throw new CommandException(t.getMessage());
        }

        Calendar now = Calendar.getInstance();
        CommandResult cr = null;
        String failureReason = null;
       
        for (int i=1; i<4 && cr == null; i++) {
            failureReason = null;

            try {
                cr = submit(job);
            } catch (CommandException ce) {
                failureReason = ce.getMessage();
                logger.warn("submission to BLAH failed [jobId=" + job.getId() + "; reason=" + failureReason + "; retry count=" + i + "/3]");

                synchronized(now) {
                    try {
                        logger.debug("sleeping 10 sec...");
                        now.wait(10000);
                        logger.debug("sleeping 10 sec... done");
                    } catch (InterruptedException e) {
                        logger.warn(e.getMessage());
                    }
                }
            }
        }
       
        if (cr == null) {
            status = new JobStatus(JobStatus.ABORTED, job.getId());
            status.setDescription("submission to BLAH failed [retry count=3]");
            status.setFailureReason(failureReason);

            try {
                doOnJobStatusChanged(status, job);
            } catch (Throwable te) {
                throw new CommandException(te.getMessage());
            }

            setLeaseExpired(job);

            throw new CommandException("submission to BLAH failed [retry count=3]" + (failureReason != null ? ": " + failureReason : ""));
        }

        job.setLRMSJobId(cr.getParameterAsString("LRMS_JOB_ID"));
        job.setLRMSAbsLayerJobId(cr.getParameterAsString("LRMS_ABS_JOB_ID"));

        try {
            if (isEmptyField(job.getLRMSAbsLayerJobId())) {
                status = new JobStatus(JobStatus.ABORTED, job.getId());
                status.setFailureReason("LRMSAbsLayerJobId not found!");
View Full Code Here

Examples of org.jboss.aesh.console.command.CommandResult

            this.console = aeshConsole;
        }

        @Override
        public int readConsoleOutput(ConsoleOperation output) {
            CommandResult result = CommandResult.SUCCESS;
            if (output != null && output.getBuffer().trim().length() > 0) {
                try (CommandContainer commandContainer = getCommand(
                        Parser.findFirstWord(output.getBuffer()),
                        output.getBuffer())) {
View Full Code Here

Examples of org.jboss.aesh.console.command.CommandResult

        AeshConsoleCallback(AeshConsole aeshConsole) {
            this.console = aeshConsole;
        }
        @Override
        public int readConsoleOutput(ConsoleOperation output) {
            CommandResult result = CommandResult.SUCCESS;
            if(output != null && output.getBuffer().trim().length() > 0) {
                try {
                    CommandContainer commandContainer =
                            getCommand( Parser.findFirstWord(output.getBuffer()), output.getBuffer());
View Full Code Here

Examples of org.jfx4ee.adm4ee.business.util.CommandResult

        if (domainName == null) {
            throw new IllegalArgumentException("No domain name specified!");
        }
        int timeoutMsec = 8000;
        boolean destroyAfterTimeout = false;
        CommandResult result = SystemCommandExecutor.execute(Arrays.asList(standaloneCommand), 1024, timeoutMsec, destroyAfterTimeout);
        if (result.isOk()) {
            // It is OK if the process is still running
            // Poll until server is really up
            for (int i = 0; i < 10; i++) {
                CommandResult r = pingManagementResource();
                if (r.isOk()) {
                    break;
                }
                try {
                    Thread.sleep(1200);
                } catch (InterruptedException ex) {
View Full Code Here

Examples of org.jitterbit.util.net.CommandResult

            for (Command command : request) {
                String name = command.getCommandName();
                try {
                    if (commandHandlers.containsKey(name)) {
                        CommandHandler handler = commandHandlers.get(name);
                        CommandResult result = handler.handleCommand(command);
                        response.addCommandResult(result);
                    } else {
                        // Use the "default" command handler if one is registered.
                        if (unknownCommandHandler != null) {
                            CommandResult result = unknownCommandHandler.handleCommand(command);
                            response.addCommandResult(result);
                        } else {
                            System.err.println("Received unknown command \"" + name + "\"");
                        }
                    }
View Full Code Here

Examples of org.socialmusicdiscovery.server.business.service.browse.CommandResult

    @Override
    public CommandResult executeCommand(List<String> parameters) {
        Date currentTime = new Date();
        if (parameters.size() == 0) {
            return new CommandResult(false, "Missing parameters");
        }
        String objectId = parameters.get(0);
        if (!objectId.startsWith(SpotifyAlbum.class.getSimpleName() + ":")) {
            return new CommandResult(false, "Invalid object, needs album identity");
        }
        try {
            objectId = objectId.substring(SpotifyAlbum.class.getSimpleName().length() + 1);
            JSONObject object = Client.create().resource("http://ws.spotify.com/lookup/1/.json?uri=" + objectId + "&extras=trackdetail").accept(MediaType.APPLICATION_JSON).get(JSONObject.class);
            JSONObject jsonAlbum = object.getJSONObject("album");

            ReleaseEntity release = new ReleaseEntity();
            release.setName(jsonAlbum.getString("name"));
            if (jsonAlbum.has("released")) {
                release.setDate(new SimpleDateFormat("yyyy").parse(jsonAlbum.getString("released")));
            }
            release.setLastUpdated(currentTime);
            release.setLastUpdatedBy(SPOTIFY_SOURCE);
            releaseRepository.create(release);

            GlobalIdentityEntity globalIdentity = new GlobalIdentityEntity();
            globalIdentity.setSource(SPOTIFY_SOURCE);
            globalIdentity.setUri(jsonAlbum.getString("href"));
            globalIdentity.setEntityId(release.getId());
            globalIdentity.setLastUpdated(currentTime);
            globalIdentity.setLastUpdatedBy(SPOTIFY_SOURCE);
            globalIdentityRepository.create(globalIdentity);

            JSONArray array = jsonAlbum.getJSONArray("tracks");
            for (int i = 0; i < array.length(); i++) {
                JSONObject jsonTrack = array.getJSONObject(i);

                WorkEntity work = new WorkEntity();
                work.setName(jsonTrack.getString("name"));
                work.setLastUpdated(currentTime);
                work.setLastUpdatedBy(SPOTIFY_SOURCE);
                workRepository.create(work);

                RecordingEntity recording = new RecordingEntity();
                recording.setLastUpdated(currentTime);
                recording.setLastUpdatedBy(SPOTIFY_SOURCE);
                recordingRepository.create(recording);
                recording.getWorks().add(work);

                TrackEntity track = new TrackEntity();
                if (jsonTrack.has("track-number")) {
                    track.setNumber(jsonTrack.getInt("track-number"));
                }
                track.setRecording(recording);
                release.addTrack(track);
                track.setLastUpdated(currentTime);
                track.setLastUpdatedBy(SPOTIFY_SOURCE);
                trackRepository.create(track);

                PlayableElementEntity playableElement = new PlayableElementEntity();
                playableElement.setSmdID(jsonTrack.getString("href"));
                playableElement.setUri(jsonTrack.getString("href"));
                playableElement.setFormat(SPOTIFY_SOURCE);
                playableElement.setLastUpdated(currentTime);
                playableElement.setLastUpdatedBy(SPOTIFY_SOURCE);
                playableElementRepository.create(playableElement);
                track.getPlayableElements().add(playableElement);

                JSONArray jsonArtists = jsonTrack.optJSONArray("artists");
                if (jsonArtists != null && jsonArtists.length() > 0) {
                    for (int j = 0; j < jsonArtists.length(); j++) {
                        JSONObject jsonArtist = jsonArtists.getJSONObject(j);
                        String name = jsonArtist.getString("name");
                        Collection<ArtistEntity> artists = artistRepository.findByName(name);
                        if (artists.size() == 0) {
                            artists = new ArrayList<ArtistEntity>();
                            ArtistEntity artist = new ArtistEntity();
                            artist.setName(name);
                            artist.setLastUpdated(currentTime);
                            artist.setLastUpdatedBy(SPOTIFY_SOURCE);
                            artistRepository.create(artist);
                            artists.add(artist);

                            globalIdentity = new GlobalIdentityEntity();
                            globalIdentity.setSource(SPOTIFY_SOURCE);
                            globalIdentity.setUri(jsonArtist.getString("href"));
                            globalIdentity.setEntityId(artist.getId());
                            globalIdentity.setLastUpdated(currentTime);
                            globalIdentity.setLastUpdatedBy(SPOTIFY_SOURCE);
                            globalIdentityRepository.create(globalIdentity);
                        }
                        for (ArtistEntity artist : artists) {
                            ContributorEntity contributor = new ContributorEntity(artist, Contributor.PERFORMER);
                            recording.addContributor(contributor);
                            contributor.setLastUpdated(currentTime);
                            contributor.setLastUpdatedBy(SPOTIFY_SOURCE);
                            contributorRepository.create(contributor);
                        }
                    }
                }
                recordingRepository.refresh(recording);
            }

            return new CommandResult(true, "Added " + release.getName());
        } catch (ParseException e) {
            throw new RuntimeException(e);
        } catch (JSONException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of org.socialmusicdiscovery.server.business.service.browse.CommandResult

import java.util.List;

public class LastFMImport implements Command {
    @Override
    public CommandResult executeCommand(List<String> parameters) {
        return new CommandResult(true, "Dummy import of " + parameters.get(1));
    }
View Full Code Here

Examples of org.springframework.shell.core.CommandResult

   * @param streamName name of stream for which to obtain runtime modules
   * @return list of table rows containing runtime module information
   *         for the requested stream
   */
  private List<TableRow> getRuntimeModulesForStream(String streamName) {
    CommandResult cmdResult = executeCommand("runtime modules");
    Table table = (Table) cmdResult.getResult();
    List<TableRow> modules = new ArrayList<TableRow>();
    for (TableRow row : table.getRows()) {
      if (row.getValue(1).contains(streamName)) {
        modules.add(row);
      }
View Full Code Here

Examples of railo.commons.cli.CommandResult

      //synchronized(monitor){
      try {

        process = Command.createProcess(command,true);

        CommandResult result = Command.execute(process);
        String rst = result.getOutput();

        finished = true;
        if(!aborted) {
          if(outputfile==null && variable==null) pc.write(rst);
          else {
            if(outputfile!=nullIOUtil.write(outputfile, rst, SystemUtil.getCharset(), false);
            if(variable!=nullpc.setVariable(variable,rst);
          }

          if(errorFile != null)      IOUtil.write(errorFile, result.getError(), SystemUtil.getCharset(), false);
          if(errorVariable != nullpc.setVariable(errorVariable, result.getError());
        }
      }
      catch(Exception ioe){
        exception=ioe;
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.