Examples of ConstraintChecker


Examples of cn.jhc.um.util.ConstraintChecker

    context.setAttribute(SC_UM_CONFIG, properties);
    checkUploadDirectories(properties);
    PathGenerator pathGenerator = loadPathGenerator(properties);
    context.setAttribute(SC_PATH_GENERATOR, pathGenerator);
   
    ConstraintChecker checker = new ConstraintChecker(properties);
    context.setAttribute(SC_CONSTRAINT_CHECKER, checker);
   
    initServlets(context, properties);
  }
View Full Code Here

Examples of cn.jhc.um.util.ConstraintChecker

    final ServletContext servletContext = request.getServletContext();
    Properties config = (Properties) servletContext.getAttribute(SC_UM_CONFIG);
    String uploadRoot = config.getProperty(UPLOAD_ROOT);

    ConstraintChecker checker = (ConstraintChecker)servletContext.getAttribute(SC_CONSTRAINT_CHECKER);

    String destUrl = config.getProperty(DEST_URL_PREFIX);

    PathGenerator pathGenerator = (PathGenerator) servletContext.getAttribute(SC_PATH_GENERATOR);
   
    ResourceBundle bundle = ResourceBundle.getBundle("messages", request.getLocale());
   
      String type = request.getParameter("type");

      String editorId = request.getParameter("editorid");
   
    Collection<Part> parts = null;
    try {
      parts = request.getParts();
    } catch (IllegalStateException e) {
      String pattern = bundle.getString(MSG_UPLOAD_EXCEEDED);
      out.println(buildResponseScript(editorId, destUrl,
          MessageFormat.format(pattern,
              config.getProperty(HUMAN_UPLOAD_FILE_SIZE_LIMIT),
              config.getProperty(HUMAN_REQUEST_SIZE_LIMIT))));
      return;
    } catch (ServletException e) {
      out.println(buildResponseScript(editorId, destUrl, bundle.getString(MSG_WRONG_ENCTYPE)));
      return;
    } catch (IOException e) {
      out.println(buildResponseScript(editorId, destUrl, bundle.getString(MSG_IO_ERROR)));
      return;
    }
    for (Part part : parts) {
      String fileName = extractFileName(part);
      if(fileName == null) continue;
      // 检查扩展名
      String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1)
          .toLowerCase();
      if( !checker.checkFileExtension(fileExt) ) {
        out.println(buildResponseScript(editorId, destUrl, bundle.getString(MSG_EXT_VIOLATED)));
        return;
      }

      String path = pathGenerator.generate(request, fileName);
View Full Code Here

Examples of edu.cmu.cs.fusion.relationship.ConstraintChecker

    try {
      compUnitName = compUnit.getElementName();
      sharedData.checkForProjectReset(compUnit.getJavaProject(), analysisInput.getProgressMonitor().isSome() ? analysisInput.getProgressMonitor().unwrap() : null);
      retriever.retrieveRelationships(ResourcesPlugin.getWorkspace().getRoot(), sharedData.getHierarchy());
     
      ConstraintChecker checker = new ConstraintChecker(constraints, getHierarchy(), variant, null);
      NoVarsAliasContext aContext = new NoVarsAliasContext(retriever.getAllLabels());
      RelationshipContext rels = retriever.getStartContext();
      new ErrorReporterVisitor<AC>(this, checker, reporter, null, compUnitName).checkXMLError(aContext, rels, rootNode);
     
    } catch (JavaModelException e) {
View Full Code Here

Examples of org.apache.accumulo.server.constraints.ConstraintChecker

    persistedTime = tabletTime.getTime();
   
    acuTableConf.addObserver(configObserver = new ConfigurationObserver() {
     
      private void reloadConstraints() {
        constraintChecker.set(new ConstraintChecker(getTableConfiguration()));
      }
     
      public void propertiesChanged() {
        reloadConstraints();
       
View Full Code Here

Examples of org.apache.accumulo.server.constraints.ConstraintChecker

    commitSession.updateMaxCommittedTime(time);
    return commitSession;
  }
 
  public void checkConstraints() {
    ConstraintChecker cc = constraintChecker.get();
   
    if (cc.classLoaderChanged()) {
      ConstraintChecker ncc = new ConstraintChecker(getTableConfiguration());
      constraintChecker.compareAndSet(cc, ncc);
    }
  }
View Full Code Here

Examples of org.apache.accumulo.server.constraints.ConstraintChecker

    }
  }

  public CommitSession prepareMutationsForCommit(TservConstraintEnv cenv, List<Mutation> mutations) throws TConstraintViolationException {
   
    ConstraintChecker cc = constraintChecker.get();
   
    List<Mutation> violators = null;
    Violations violations = new Violations();
    cenv.setExtent(extent);
    for (Mutation mutation : mutations) {
      Violations more = cc.check(cenv, mutation);
      if (more != null) {
        violations.add(more);
        if (violators == null)
          violators = new ArrayList<Mutation>();
        violators.add(mutation);
View Full Code Here

Examples of org.apache.accumulo.server.constraints.ConstraintChecker

   
    acuTableConf.addObserver(configObserver = new ConfigurationObserver() {
     
      private void reloadConstraints() {
       
        ConstraintChecker cc = null;
       
        try {
          log.debug("Reloading constraints");
          cc = ConstraintLoader.load(extent.getTableId().toString());
        } catch (IOException e) {
          log.error("Failed to reload constraints for " + extent, e);
          cc = new ConstraintChecker();
          cc.addConstraint(new UnsatisfiableConstraint((short) -1, "Failed to reload constraints, not accepting mutations."));
        }
       
        constraintChecker.set(cc);
      }
     
View Full Code Here

Examples of org.apache.accumulo.server.constraints.ConstraintChecker

    return commitSession;
  }
 
  public CommitSession prepareMutationsForCommit(TservConstraintEnv cenv, List<Mutation> mutations) throws TConstraintViolationException {
   
    ConstraintChecker cc = constraintChecker.get();
   
    List<Mutation> violators = null;
    Violations violations = new Violations();
    cenv.setExtent(extent);
    for (Mutation mutation : mutations) {
      Violations more = cc.check(cenv, mutation);
      if (more != null) {
        violations.add(more);
        if (violators == null)
          violators = new ArrayList<Mutation>();
        violators.add(mutation);
View Full Code Here

Examples of org.apache.accumulo.server.constraints.ConstraintChecker

    persistedTime = tabletTime.getTime();
   
    acuTableConf.addObserver(configObserver = new ConfigurationObserver() {
     
      private void reloadConstraints() {
        constraintChecker.set(new ConstraintChecker(getTableConfiguration()));
      }
     
      public void propertiesChanged() {
        reloadConstraints();
       
View Full Code Here

Examples of org.apache.accumulo.server.constraints.ConstraintChecker

    commitSession.updateMaxCommittedTime(time);
    return commitSession;
  }
 
  public void checkConstraints() {
    ConstraintChecker cc = constraintChecker.get();
   
    if (cc.classLoaderChanged()) {
      ConstraintChecker ncc = new ConstraintChecker(getTableConfiguration());
      constraintChecker.compareAndSet(cc, ncc);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.