Package net.ex337.scriptus.exceptions

Examples of net.ex337.scriptus.exceptions.ScriptusRuntimeException


        q.setParameter("pid", pid.toString());

        int rows = q.executeUpdate();

        if (rows != 1) {
            throw new ScriptusRuntimeException("no rows updated for pid " + pid);
        }

    }
View Full Code Here


        d.transport = transportType.toString();

        TransportTokenDAO dd = em.find(TransportTokenDAO.class, d);

        if(dd == null) {
            throw new ScriptusRuntimeException("no token found for user"+userId+", transport "+transportType);
        }
       
        TransportAccessToken t = createTransportAccessToken();

        t.load(dd);
View Full Code Here

    LOG.debug("waiting for "+childPid.toString().substring(30));
   
    final UUID parentPid = process.getPid();
   
        if( ! scriptus.getChildren(parentPid).contains(childPid)) {
      throw new ScriptusRuntimeException("not a child: "+childPid);
    }
       
        scriptus.updateProcessState(parentPid, this);

    try {
     
      scriptus.runWithLock(childPid, new Runnable() {

        @Override
        public void run() {
         
          ScriptProcess child = scriptus.getProcess(childPid); //overwrites state with child
         
          //already terminated
          if(child.getState() instanceof Termination) {

            //FIXME we should delete child & remove from list of children
            scriptus.updateProcessState(parentPid, ((Termination)child.getState()).getResult());

            scriptus.execute(parentPid);

            return;
           
          }
         
          LOG.debug("registering waiter for " + childPid.toString().substring(30) + ", waiterpid="
              + parentPid.toString().substring(30));
         
          child.setWaiterPid(parentPid);
          child.save();
         
        }
      });


    } catch (Exception e) {
      throw new ScriptusRuntimeException(e);
    }
   
  }
View Full Code Here

      String content = IOUtils.toString(c.getInputStream(), c.getContentEncoding());
      scriptus.updateProcessState(process.getPid(), content);
      scriptus.execute(process.getPid());
      //TODO make a ConvertsToScriptable object that will add headers property etc.
    } catch(IOException e) {
      throw new ScriptusRuntimeException(e);
    }

   
  }
View Full Code Here

    twitter = new TwitterFactory(cb.build()).getInstance();
    try {
            screenName = twitter.verifyCredentials().getScreenName();
        } catch (TwitterException e) {
            throw new ScriptusRuntimeException(e);
        }
    }
View Full Code Here

//          t.
//        result.add(tt);
//      }
     
    } catch (TwitterException e) {
      throw new ScriptusRuntimeException(e);
    }
   
    return new ArrayList<Tweet>(result);
  }
View Full Code Here

  @Override
  public long tweet(String txt) {
   
    if(txt.length() > 140) {
      throw new ScriptusRuntimeException("tweet > 140 characters: "+txt);
    }
   
    Status s;
    try {
      s = twitter.updateStatus(new StatusUpdate(txt));
    } catch (TwitterException e) {
      throw new ScriptusRuntimeException(e);
    }
    return s.getId();
  }
View Full Code Here

  public long tweet(String txt) {
     
      statusUpdates.add(txt);
   
    if(txt.length() > 140) {
      throw new ScriptusRuntimeException("tweet > 140 characters: "+txt);
    }
   
    return ctr++;
  }
View Full Code Here

            if (!processedIncomings.isEmpty()) {
                try {
                    datastore.updateTransportCursor(TransportType.Twitter, new String(SerializableUtils.serialiseObject(processedIncomings), ScriptusConfig.CHARSET));
                } catch (IOException e) {
                    throw new ScriptusRuntimeException(e);
                }
            }
           
        }
View Full Code Here

    }

    private byte[] getKey(String keyId) {
        byte[] key = keys.get(keyId);
        if (key == null) {
            throw new ScriptusRuntimeException("key with ID " + keyId + " not found");
        }
        return Arrays.copyOf(key, key.length);
    }
View Full Code Here

TOP

Related Classes of net.ex337.scriptus.exceptions.ScriptusRuntimeException

Copyright © 2018 www.massapicom. 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.