/** * Returns a serialized object. Uses org.python.util.PythonObjectInputStream * for Jython objects (read * <a href="http://aspn.activestate.com/ASPN/Mail/Message/Jython-users/1001401">here</a> * for more details). * * @return the restored object * @exception Exception if the object couldn't be restored */ public Object getObject() { try { ByteArrayInputStream istream = new ByteArrayInputStream(m_storedObjectArray); ObjectInputStream p; Object toReturn = null; if (m_isJython) { if (!m_isCompressed) toReturn = Jython.deserialize(new BufferedInputStream(istream)); else toReturn = Jython.deserialize(new BufferedInputStream(new GZIPInputStream(istream))); } else { if (!m_isCompressed) p = new ObjectInputStream(new BufferedInputStream(istream)); else p = new ObjectInputStream(new BufferedInputStream(new GZIPInputStream(istream))); toReturn = p.readObject(); } istream.close(); return toReturn; } catch (Exception e) { e.printStackTrace(); return null; } }
/** * Performs pre-execution checks. * <p/> * This method checks whether Jython is available (throws an exception if * not). * * @param args optional commandline arguments * @throws Exception if checks fail */ @Override protected void preCheck(String[] args) throws Exception { super.preCheck(args); if (!Jython.isPresent()) { throw new Exception("Jython classes are not present in CLASSPATH!"); } }
/** * Performs pre-execution checks. * <p/> * This method checks whether Jython is available (throws an exception if not). * * @param args optional commandline arguments * @throws Exception if checks fail */ protected void preCheck(String[] args) throws Exception { super.preCheck(args); if (!Jython.isPresent()) throw new Exception("Jython classes are not present in CLASSPATH!"); }
/** * Returns whether scripts can be executed, i.e., Jython is present. * * @return true if scripts can be executed */ @Override protected boolean canExecuteScripts() { return Jython.isPresent(); }
/** * Returns whether scripts can be executed, i.e., Jython is present. * * @return true if scripts can be executed */ protected boolean canExecuteScripts() { return Jython.isPresent(); }