@POST
  @Timed
  @Produces(MediaType.APPLICATION_JSON)
  @Path("applications")
  @ApiOperation(
      "Adds new application to SeaClouds Platform based on a SeaClouds-compliant TOSCA DAM specification")
  public Response addApplication(@ApiParam() String dam) {
    SeaCloudsApplicationData seaCloudsApplication = null;

    if (dam == null) {
      LOG.error("Missing input parameters");
      return Response.status(Response.Status.NOT_ACCEPTABLE).build();
    } else {
      try {
        LOG.debug("Deploy new application process started");

        seaCloudsApplication = new SeaCloudsApplicationData(dam);

        LOG.debug("STEP 1: Start deployment of the application");
        TaskSummary taskSummary = deployer.deployApplication(dam);
        seaCloudsApplication.setDeployerApplicationId(taskSummary);

        if (seaCloudsApplication.getMonitoringRulesTemplateId() != null) {
          LOG.debug("STEP 2: Retrieve Monitoring Rules from TOSCA");
          MonitoringRules monitoringRules =
              planner.getMonitoringRulesByTemplateId(
                  seaCloudsApplication.getMonitoringRulesTemplateId());

          LOG.debug("STEP 3: Install Monitoring Rules");
          monitor.addMonitoringRules(monitoringRules);
          seaCloudsApplication.setMonitoringRulesIds(monitoringRules);
        }

        if (seaCloudsApplication.getAgreementTemplateId() != null) {
          LOG.debug("STEP 4: Retrieve SLA Agreements from TOSCA");
          Agreement agreement =
              sla.getAgreementByTemplateId(seaCloudsApplication.getAgreementTemplateId());

          LOG.debug("STEP 5: Install SLA Agreements");
          sla.addAgreement(agreement);
          seaCloudsApplication.setAgreementId(agreement);

          LOG.debug("STEP 6: Notify Rules Ready (Issue #56)");
          sla.notifyRulesReady(agreement);
        }

        LOG.debug("Application deployment process finished");
        dataStore.addSeaCloudsApplicationData(seaCloudsApplication);
        return Response.ok(seaCloudsApplication).build();
      } catch (Exception e) {
        cleanUpApplicationDependencies(seaCloudsApplication);
        LOG.error(e.getMessage());
        return Response.status(Response.Status.BAD_REQUEST).build();
      }
    }
  }