1 19 package org.openharmonise.rm.commands; 20 21 import org.openharmonise.rm.resources.lifecycle.*; 22 23 24 32 public class CmdGetLiveVersion extends AbstractCmd { 33 34 38 public CmdGetLiveVersion() { 39 super(); 40 } 41 42 45 public Object execute(Context context) throws CommandException { 46 if((m_commandObj instanceof Editable) == false) { 47 throw new InvalidCommandException("Command is not valid for this object:" + m_commandObj.getClass()); 48 } 49 50 if (isAvailable(context) == false) { 51 throw new InvalidCommandException("Command is not available for this object"); 52 } 53 54 Editable eObj = (Editable)getCommandObject(context); 55 Editable rtnObj = null; 56 57 try { 58 rtnObj = eObj.getLiveVersion(); 59 } catch(Exception e) { 60 throw new CommandExecutionException(e.getMessage()); 61 } 62 63 return rtnObj; 64 } 65 66 69 public String getName() { 70 return "GetLiveVersion"; 71 } 72 73 76 public boolean isValidCommandObject(Object obj) { 77 return (obj instanceof Editable); 78 } 79 } | Popular Tags |