コード例 #1
0
 @Override
 public void undeployArtifact(String artifactId) throws TemplateDeploymentException {
   try {
     BatchScriptDeployerValueHolder.getAnalyticsProcessorService()
         .deleteScript(
             PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(), artifactId);
   } catch (AnalyticsPersistenceException e) {
     throw new TemplateDeploymentException("Error when deleting batch script " + artifactId, e);
   }
 }
コード例 #2
0
  @Override
  public void deployArtifact(DeployableTemplate template) throws TemplateDeploymentException {
    try {
      int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
      String artifactId =
          template.getConfiguration().getFrom()
              + BatchScriptDeployerConstants.CONFIG_NAME_SEPARATOR
              + template.getConfiguration().getName();
      BatchScriptDeployerValueHolder.getAnalyticsProcessorService()
          .deleteScript(tenantId, artifactId);
      deployStreams(template);

      BatchScriptDeployerValueHolder.getAnalyticsProcessorService()
          .saveScript(
              tenantId,
              artifactId,
              template.getScript(),
              template.getConfiguration().getExecutionParameters());
    } catch (AnalyticsPersistenceException e) {
      throw new TemplateDeploymentException(
          "Error when saving batch script." + template.getConfiguration().getName(), e);
    }
  }
コード例 #3
0
 public static void deployStreams(DeployableTemplate template) {
   if (template.getStreams() != null) {
     for (String stream : template.getStreams()) {
       StreamDefinition streamDefinition = null;
       try {
         streamDefinition = EventDefinitionConverterUtils.convertFromJson(stream);
         BatchScriptDeployerValueHolder.getEventStreamService()
             .addEventStreamDefinition(streamDefinition);
       } catch (MalformedStreamDefinitionException e) {
         log.error("Stream definition is incorrect in domain template " + stream, e);
       } catch (EventStreamConfigurationException e) {
         log.error("Exception occurred when configuring stream " + streamDefinition.getName(), e);
       } catch (StreamDefinitionAlreadyDefinedException e) {
         log.error(
             "Same template stream name "
                 + streamDefinition.getName()
                 + " has been defined for another definition ",
             e);
         throw e;
       }
     }
   }
 }