Package org.osgi.service.indexer.impl.util

Examples of org.osgi.service.indexer.impl.util.Tag


      indent = Indent.NONE;
      pw = new PrintWriter(new GZIPOutputStream(out, Deflater.BEST_COMPRESSION));
    }
   
    pw.print(Schema.XML_PROCESSING_INSTRUCTION);
    Tag repoTag = new Tag(Schema.ELEM_REPOSITORY);
   
    String repoName = config.get(REPOSITORY_NAME);
    if (repoName == null)
      repoName = REPOSITORYNAME_DEFAULT;
    repoTag.addAttribute(Schema.ATTR_NAME, repoName);
   
    String increment = config.get(REPOSITORY_INCREMENT_OVERRIDE);
    if (increment == null)
      increment = Long.toString(System.currentTimeMillis());
    repoTag.addAttribute(Schema.ATTR_INCREMENT, increment);
   
    repoTag.addAttribute(Schema.ATTR_XML_NAMESPACE, Schema.NAMESPACE);
   
    repoTag.printOpen(indent, pw, false);
    for (File file : files) {
      Tag resourceTag = generateResource(file, config);
      resourceTag.print(indent.next(), pw);
    }
    repoTag.printClose(indent, pw);
    pw.flush(); pw.close();
  }
View Full Code Here


      pw = (PrintWriter) out;
    else
      pw = new PrintWriter(out);
   
    for (File file : files) {
      Tag resourceTag = generateResource(file, config);
      resourceTag.print(Indent.PRETTY, pw);
    }
  }
View Full Code Here

      }
    } finally {
      bundleAnalyzer.setStateLocal(null);
    }
   
    Tag resourceTag = new Tag(Schema.ELEM_RESOURCE);
    for (Capability cap : caps) {
      Tag capTag = new Tag(Schema.ELEM_CAPABILITY);
      capTag.addAttribute(Schema.ATTR_NAMESPACE, cap.getNamespace());
     
      appendAttributeAndDirectiveTags(capTag, cap.getAttributes(), cap.getDirectives());
     
      resourceTag.addContent(capTag);
    }
   
    for (Requirement req : reqs) {
      Tag reqTag = new Tag(Schema.ELEM_REQUIREMENT);
      reqTag.addAttribute(Schema.ATTR_NAMESPACE, req.getNamespace());
     
      appendAttributeAndDirectiveTags(reqTag, req.getAttributes(), req.getDirectives());
     
      resourceTag.addContent(reqTag);
    }
View Full Code Here

      log.log(level, message, t);
  }
 
  private static void appendAttributeAndDirectiveTags(Tag parentTag, Map<String, Object> attribs, Map<String, String> directives) {
    for (Entry<String, Object> attribEntry : attribs.entrySet()) {
      Tag attribTag = new Tag(Schema.ELEM_ATTRIBUTE);
      attribTag.addAttribute(Schema.ATTR_NAME, attribEntry.getKey());

      TypedAttribute typedAttrib = TypedAttribute.create(attribEntry.getKey(), attribEntry.getValue());
      parentTag.addContent(typedAttrib.toXML());
    }
   
    for (Entry<String, String> directiveEntry : directives.entrySet()) {
      Tag directiveTag = new Tag(Schema.ELEM_DIRECTIVE);
      directiveTag.addAttribute(Schema.ATTR_NAME, directiveEntry.getKey());
      directiveTag.addAttribute(Schema.ATTR_VALUE, directiveEntry.getValue());
      parentTag.addContent(directiveTag);
    }
  }
View Full Code Here

      indent = Indent.NONE;
      pw = new PrintWriter(new GZIPOutputStream(out, Deflater.BEST_COMPRESSION));
    }
   
    pw.print(Schema.XML_PROCESSING_INSTRUCTION);
    Tag repoTag = new Tag(Schema.ELEM_REPOSITORY);
   
    String repoName = config.get(REPOSITORY_NAME);
    if (repoName == null)
      repoName = REPOSITORYNAME_DEFAULT;
    repoTag.addAttribute(Schema.ATTR_NAME, repoName);
   
    String increment = config.get(REPOSITORY_INCREMENT_OVERRIDE);
    if (increment == null)
      increment = Long.toString(System.currentTimeMillis());
    repoTag.addAttribute(Schema.ATTR_INCREMENT, increment);
   
    repoTag.addAttribute(Schema.ATTR_XML_NAMESPACE, Schema.NAMESPACE);
   
    repoTag.printOpen(indent, pw, false);
    for (File file : files) {
      Tag resourceTag = generateResource(file, config);
      resourceTag.print(indent.next(), pw);
    }
    repoTag.printClose(indent, pw);
    pw.flush(); pw.close();
  }
View Full Code Here

      pw = (PrintWriter) out;
    else
      pw = new PrintWriter(out);
   
    for (File file : files) {
      Tag resourceTag = generateResource(file, config);
      resourceTag.print(Indent.PRETTY, pw);
    }
  }
View Full Code Here

      }
    } finally {
      bundleAnalyzer.setStateLocal(null);
    }
   
    Tag resourceTag = new Tag(Schema.ELEM_RESOURCE);
    for (Capability cap : caps) {
      Tag capTag = new Tag(Schema.ELEM_CAPABILITY);
      capTag.addAttribute(Schema.ATTR_NAMESPACE, cap.getNamespace());
     
      appendAttributeAndDirectiveTags(capTag, cap.getAttributes(), cap.getDirectives());
     
      resourceTag.addContent(capTag);
    }
   
    for (Requirement req : reqs) {
      Tag reqTag = new Tag(Schema.ELEM_REQUIREMENT);
      reqTag.addAttribute(Schema.ATTR_NAMESPACE, req.getNamespace());
     
      appendAttributeAndDirectiveTags(reqTag, req.getAttributes(), req.getDirectives());
     
      resourceTag.addContent(reqTag);
    }
View Full Code Here

      log.log(level, message, t);
  }
 
  private static void appendAttributeAndDirectiveTags(Tag parentTag, Map<String, Object> attribs, Map<String, String> directives) {
    for (Entry<String, Object> attribEntry : attribs.entrySet()) {
      Tag attribTag = new Tag(Schema.ELEM_ATTRIBUTE);
      attribTag.addAttribute(Schema.ATTR_NAME, attribEntry.getKey());

      TypedAttribute typedAttrib = TypedAttribute.create(attribEntry.getKey(), attribEntry.getValue());
      parentTag.addContent(typedAttrib.toXML());
    }
   
    for (Entry<String, String> directiveEntry : directives.entrySet()) {
      Tag directiveTag = new Tag(Schema.ELEM_DIRECTIVE);
      directiveTag.addAttribute(Schema.ATTR_NAME, directiveEntry.getKey());
      directiveTag.addAttribute(Schema.ATTR_VALUE, directiveEntry.getValue());
      parentTag.addContent(directiveTag);
    }
  }
View Full Code Here

      indent = Indent.NONE;
      pw = new PrintWriter(new GZIPOutputStream(out, Deflater.BEST_COMPRESSION));
    }
   
    pw.print(Schema.XML_PROCESSING_INSTRUCTION);
    Tag repoTag = new Tag(Schema.ELEM_REPOSITORY);
   
    String repoName = config.get(REPOSITORY_NAME);
    if (repoName == null)
      repoName = REPOSITORYNAME_DEFAULT;
    repoTag.addAttribute(Schema.ATTR_NAME, repoName);
   
    String increment = config.get(REPOSITORY_INCREMENT_OVERRIDE);
    if (increment == null)
      increment = Long.toString(System.currentTimeMillis());
    repoTag.addAttribute(Schema.ATTR_INCREMENT, increment);
   
    repoTag.addAttribute(Schema.ATTR_XML_NAMESPACE, Schema.NAMESPACE);
   
    repoTag.printOpen(indent, pw, false);
    for (File file : files) {
      Tag resourceTag = generateResource(file, config);
      resourceTag.print(indent.next(), pw);
    }
    repoTag.printClose(indent, pw);
    pw.flush(); pw.close();
  }
View Full Code Here

      pw = (PrintWriter) out;
    else
      pw = new PrintWriter(out);
   
    for (File file : files) {
      Tag resourceTag = generateResource(file, config);
      resourceTag.print(Indent.PRETTY, pw);
    }
  }
View Full Code Here

TOP

Related Classes of org.osgi.service.indexer.impl.util.Tag

Copyright © 2018 www.massapicom. 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.