@Override
  protected void doPut(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    request.setCharacterEncoding("UTF-8"); // $NON-NLS-1$
    response.setContentType("text/html; charset=UTF-8"); // $NON-NLS-1$
    response.setCharacterEncoding("UTF-8"); // $NON-NLS-1$
    // configure writer depending on logger configuration.
    PrintWriter writer = configureWriter(response);
    writer.write("<html><body>"); // $NON-NLS-1$
    writer.write(
        "<p><b>Load data into MDM</b><br/>Check server log output to determine when load is completed</b></p>"); //$NON-NLS-1$
    String dataClusterName = request.getParameter(PARAMETER_CLUSTER);
    String typeName = request.getParameter(PARAMETER_CONCEPT);
    String dataModelName = request.getParameter(PARAMETER_DATAMODEL);
    boolean needValidate = Boolean.valueOf(request.getParameter(PARAMETER_VALIDATE));
    boolean needAutoGenPK = Boolean.valueOf(request.getParameter(PARAMETER_SMARTPK));

    LoadAction loadAction =
        getLoadAction(dataClusterName, typeName, dataModelName, needValidate, needAutoGenPK);
    if (needValidate && !loadAction.supportValidation()) {
      throw new ServletException(
          new UnsupportedOperationException("XML Validation isn't supported")); // $NON-NLS-1$
    }
    // Get xml server and key information
    XmlServer server;
    XSDKey keyMetadata;
    try {
      keyMetadata = getTypeKey(dataModelName, typeName);
      server = Util.getXmlServerCtrlLocal();
    } catch (Exception e) {
      throw new ServletException(e);
    }
    SaverSession session = SaverSession.newSession();
    SaverContextFactory contextFactory = session.getContextFactory();
    DocumentSaverContext context =
        contextFactory.createBulkLoad(
            dataClusterName,
            dataModelName,
            keyMetadata,
            request.getInputStream(),
            loadAction,
            server);
    DocumentSaver saver = context.createSaver();
    try {
      session.begin(dataClusterName);
      saver.save(session, context);
      session.end();
      // End the load (might persist counter state in case of autogen pk).
      loadAction.endLoad(server);
    } catch (Exception e) {
      try {
        session.abort();
      } catch (Exception rollbackException) {
        log.error("Ignoring rollback exception", rollbackException); // $NON-NLS-1$
      }
      throw new ServletException(e);
    }
    writer.write("</body></html>"); // $NON-NLS-1$
  }
 protected DataClusterPOJO getDataCluster(String dataClusterName) {
   DataClusterPOJO dataCluster;
   try {
     DataCluster dataClusterCtrlLocal = Util.getDataClusterCtrlLocal();
     DataClusterPOJOPK dataClusterPOJOPK = new DataClusterPOJOPK(dataClusterName);
     dataCluster = dataClusterCtrlLocal.getDataCluster(dataClusterPOJOPK);
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
   return dataCluster;
 }
 public TransformerV2POJO getTransformerPOJO() throws XtentisException {
   TransformerV2POJO transformerPOJO = (TransformerV2POJO) this.get(TRANSFORMER_POJO);
   if (transformerPOJO == null) {
     try {
       transformerPOJO =
           Util.getTransformerV2CtrlLocal().getTransformer(this.getTransformerV2POJOPK());
     } catch (Exception e) {
       String err =
           "Unable to get the transformer "
               + this.getTransformerV2POJOPK().getUniqueId()
               + " from the global Context: "
               + e.getClass().getName()
               + ": "
               + e.getMessage();
       org.apache.log4j.Logger.getLogger(this.getClass()).error("executeNextPlugin() " + err);
       throw new XtentisException(err);
     }
     this.put(TRANSFORMER_POJO, transformerPOJO);
   }
   return transformerPOJO;
 }