コード例 #1
0
    public AclMessage executeRequest(AclMessage request, AclMessage agreement)
        throws FailureException {
      try {
        ExportManager exportManager = new ExportManager();
        exportManager.doExport(getConnection(request), request.getContent());

        AclMessage reply = request.createReply(AclMessage.Performative.INFORM);
        reply.setContent("Export terminé");
        return reply;
      } catch (SQLException exception) {
        LOG.error(exception.getLocalizedMessage(), exception);
        throw new FailureException(exception.getLocalizedMessage());
      } catch (IOException exception) {
        LOG.error("Impossible d'écrire le fichier d'export.", exception);
        throw new FailureException("Impossible d'écrire le fichier d'export.");
      } catch (Exception exception) {
        LOG.error("Exception inattendue.", exception);
        throw new FailureException(exception.getLocalizedMessage());
      }
    }
コード例 #2
0
    @Override
    public void parseMessage(AclMessage request)
        throws NotUnderstoodException, IOException, ParseException, SQLException {
      String message = request.getContent();
      if (message == null || message.length() == 0) {
        throw new NotUnderstoodException("Message vide.");
      }

      String[] args = message.split(";");
      if (args.length != 2) {
        throw new NotUnderstoodException("Message incorrect.");
      }

      String exportType = args[0];
      if (exportType == null || exportType.length() == 0) {
        throw new ParseException("Le type d'export est incorrect.");
      }

      String exportFilePath = args[1];
      if (exportFilePath == null || exportFilePath.length() == 0) {
        throw new ParseException("Le chemin du fichier d'export est incorrect.");
      }
    }