示例#1
0
  protected void buildAll() {
    _libraries = new ArrayList();
    Set builtLibraries = new HashSet();
    for (int i = 0; i < _scanners.size(); i++) {
      SourceScanner scanner = (SourceScanner) _scanners.get(i);
      for (Iterator it = scanner.scan(); it.hasNext(); ) {
        SourceDescriptor source = (SourceDescriptor) it.next();
        boolean built = false;
        for (int k = 0; k < _builders.size(); k++) {
          DefinitionBuilder builder = (DefinitionBuilder) _builders.get(k);
          LibraryDefinition library = builder.build(source);
          if (library != null) {
            if (builtLibraries.contains(library.getNamespaceURI()) == false) {
              _libraries.add(library);
              builtLibraries.add(library.getNamespaceURI());
              if (LOG.isInfoEnabled()) {
                LOG.info(
                    StringUtil.getMessage(
                        LibraryManagerImpl.class,
                        4,
                        source.getSystemID(),
                        String.valueOf(library.getNamespaceURI())));
              }
            }
            built = true;
            break;
          }
        }

        if (built == false) {
          assignTaglibLocation(source);
        }
      }
    }
  }
示例#2
0
  // condition: already loaded "META-INF/taglib.tld"
  private void assignTaglibLocation(SourceDescriptor source) {
    String realPath = source.getParameter(WebXMLTaglibSourceScanner.REAL_PATH);
    if (StringUtil.isEmpty(realPath) || realPath.endsWith(".jar") == false) {
      return;
    }

    for (int j = 0; j < _libraries.size(); j++) {
      LibraryDefinition library = (LibraryDefinition) _libraries.get(j);
      for (Iterator it = library.iterateAssignedURI(); it.hasNext(); ) {
        URI uri = (URI) it.next();
        if (realPath.equals(String.valueOf(uri))) {
          URI assignedURI = SpecificationUtil.createURI(source.getParameter(SourceAlias.ALIAS));
          library.addAssignedURI(assignedURI);
          if (LOG.isInfoEnabled()) {
            LOG.info(
                StringUtil.getMessage(
                    LibraryManagerImpl.class,
                    4,
                    library.getNamespaceURI() + " (alias)",
                    String.valueOf(assignedURI)));
          }
          return;
        }
      }
    }
  }
示例#3
0
 protected boolean filter(Object test) {
   if (test == null || (test instanceof LibraryDefinition == false)) {
     return false;
   }
   LibraryDefinition library = (LibraryDefinition) test;
   if (_namespaceURI.equals(library.getNamespaceURI())) {
     return true;
   }
   for (Iterator it = library.iterateAssignedURI(); it.hasNext(); ) {
     if (_namespaceURI.equals(it.next())) {
       return true;
     }
   }
   return false;
 }