public static String getPlatform() { if (ServerUtils.isUnix()) { if (ServerUtils.is64bit()) { return "Linux-x86-64"; } else { return "Linux-x86-32"; } } else if (ServerUtils.isWindows()) { return "Win32"; } else if (ServerUtils.isMac()) { return "Mac-x86"; } else return "Solaris-x86"; }
/* * (non-Javadoc) * @see * com.gwtplatform.dispatch.server.actionhandler.ActionHandler#execute(com * .gwtplatform.dispatch.shared.Action, * com.gwtplatform.dispatch.server.ExecutionContext) */ @Override public GetDigitalObjectDetailResult execute( final GetDigitalObjectDetailAction action, final ExecutionContext context) throws ActionException { LOGGER.debug("Processing action: GetDigitalObjectDetailAction " + action.getUuid()); ServerUtils.checkExpiredSession(); if (!ServerUtils.checkUserRightOrAll(EDITOR_RIGHTS.OPEN_OBJECT)) { LOGGER.warn("Bad authorization in " + this.getClass().toString()); throw new ActionException("Bad authorization in " + this.getClass().toString()); } // parse input String uuid = action.getUuid(); String storedFOXMLFilePath = null; if (action.getSavedEditedObject() != null && action.getSavedEditedObject().getFileName() != null && !action.getSavedEditedObject().getFileName().equals("")) { storedFOXMLFilePath = action.getSavedEditedObject().getFileName(); } try { if (storedFOXMLFilePath == null) { LOGGER.debug("Processing action: GetDigitalObjectDetailAction: " + action.getUuid()); } else { LOGGER.debug( "Processing action: GetDigitalObjectDetailAction: " + action.getUuid() + " from the file: " + storedFOXMLFilePath); if (!new File(storedFOXMLFilePath).exists() || FedoraUtils.getModel(uuid) == null) return new GetDigitalObjectDetailResult(null, null, null); } HttpSession ses = httpSessionProvider.get(); Injector injector = (Injector) ses.getServletContext().getAttribute(Injector.class.getName()); injector.injectMembers(descritptionHandler); injector.injectMembers(getLockInformationHandler); DigitalObjectDetail obj = null; if (storedFOXMLFilePath == null) { if (action.getModel() == null) { // lazy obj = fedoraObjectHandler.getDigitalObject(uuid); } else { // fetch uuids obj = fedoraObjectHandler.getDigitalObjectItems(uuid, action.getModel()); } } else { obj = storedObjectHandler.getStoredDigitalObject( uuid, storedFOXMLFilePath, action.getModel()); try { digObjDAO.insertDOCrudAction( Constants.TABLE_CRUD_SAVED_EDITED_OBJECT_ACTION, "saved_edited_object_id", action.getSavedEditedObject().getId(), CRUD_ACTION_TYPES.READ); } catch (DatabaseException e) { LOGGER.error(e.getMessage()); e.printStackTrace(); throw new ActionException(e); } } // TODO storedFOXMLFilePath != null------------------------------------------------------ // GetDescriptionResult result = // descritptionHandler.execute(new GetDescriptionAction(uuid), context); // // String description = result.getUserDescription(); // Date modified = result.getModified(); // -------------------------------------------------------------------------------------- String description = null; Date modified = null; try { description = descriptionDAO.getUserDescription(uuid); // TODO: is the given user authorized to this operation? } catch (DatabaseException e) { throw new ActionException(e); } LockInfo lockInfo = getLockInformationHandler .execute(new GetLockInformationAction(uuid), context) .getLockInfo(); obj.setLockInfo(lockInfo); return new GetDigitalObjectDetailResult( obj, description == null ? "" : description, modified == null ? new Date() : modified); } catch (IOException e) { String msg = null; if (ServerUtils.isCausedByException(e, FileNotFoundException.class)) { msg = "Digital object with uuid " + uuid + " is not present in the repository. "; } else if (ServerUtils.isCausedByException(e, ConnectionException.class)) { msg = "Connection cannot be established. Please check whether Fedora is running. "; } else { msg = "Unable to obtain digital object with uuid " + uuid + ". "; } LOGGER.error(msg, e); throw new ActionException(msg, e); } }