Esempio n. 1
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;
        }
      }
    }
  }
Esempio n. 2
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);
        }
      }
    }
  }
Esempio n. 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;
 }
Esempio n. 4
0
 public ProcessorDefinition getProcessorDefinition(QName qName) {
   if (qName == null) {
     throw new IllegalArgumentException();
   }
   URI namespaceURI = qName.getNamespaceURI();
   String localName = qName.getLocalName();
   for (Iterator it = iterateLibraryDefinition(namespaceURI); it.hasNext(); ) {
     LibraryDefinition library = (LibraryDefinition) it.next();
     ProcessorDefinition processor = library.getProcessorDefinition(localName);
     if (processor != null) {
       return processor;
     }
   }
   return null;
 }