示例#1
0
 public Property get(String category, String key, boolean defaultValue) {
   Property prop = get(category, key, Boolean.toString(defaultValue), BOOLEAN);
   if (!prop.isBooleanValue()) {
     prop.value = Boolean.toString(defaultValue);
   }
   return prop;
 }
示例#2
0
  public Property getItem(String category, String key, int defaultID) {
    Property prop = get(category, key, -1);
    int defaultShift = defaultID + ITEM_SHIFT;

    if (prop.getInt() != -1) {
      configItems[prop.getInt() + ITEM_SHIFT] = true;
      return prop;
    } else {
      if (Item.itemsList[defaultShift] == null
          && !configItems[defaultShift]
          && defaultShift > Block.blocksList.length) {
        prop.value = Integer.toString(defaultID);
        configItems[defaultShift] = true;
        return prop;
      } else {
        for (int x = configItems.length - 1; x >= ITEM_SHIFT; x--) {
          if (Item.itemsList[x] == null && !configItems[x]) {
            prop.value = Integer.toString(x - ITEM_SHIFT);
            configItems[x] = true;
            return prop;
          }
        }

        throw new RuntimeException("No more item ids available for " + key);
      }
    }
  }
示例#3
0
 public Property get(String category, String key, int defaultValue) {
   Property prop = get(category, key, Integer.toString(defaultValue), INTEGER);
   if (!prop.isIntValue()) {
     prop.value = Integer.toString(defaultValue);
   }
   return prop;
 }
示例#4
0
 static void delProperty(Client c, Window w, int name, int type) throws IOException {
   Property p;
   synchronized (w) {
     p = w.getProperty();
     Property prev = null;
     while (p != null) {
       if (p.propertyName == name) break;
       prev = p;
       p = p.next;
     }
     if (p != null) {
       if (prev == null) { // head !!
         w.setProperty(p.next);
         if (p.next == null) {
           // checkWindowOptionalNeed();
         }
       } else {
         prev.next = p.next;
       }
       c.cevent.mkPropertyNotify(
           w.id,
           p.propertyName,
           (int) System.currentTimeMillis(),
           // Property.PropertyDelete
           1);
     }
   }
   if (p != null) {
     w.sendEvent(c.cevent, 1, null);
   }
 }
示例#5
0
 void preallocateBlockIDs(boolean[] configMarkers) {
   ConfigCategory items = config.getCategory(config.CATEGORY_BLOCK);
   for (Property prop : items.getValues().values()) {
     int id = prop.getInt();
     if (id != -1) {
       // System.out.printf("BaseMod.preallocateItemIDs: Marking block id %d as in use\n", id);
       configMarkers[id] = true;
     }
   }
 }
示例#6
0
 private void writeProperties(BufferedWriter buffer, Collection<Property> props)
     throws IOException {
   for (Property property : props) {
     if (property.comment != null) {
       Splitter splitter = Splitter.onPattern("\r?\n");
       for (String commentLine : splitter.split(property.comment)) {
         buffer.write("   # " + commentLine + "\r\n");
       }
     }
     String propName = property.getName();
     if (!allowedProperties.matchesAllOf(propName)) {
       propName = '"' + propName + '"';
     }
     buffer.write("   " + propName + "=" + property.value);
     buffer.write("\r\n");
   }
 }
  /**
   * @param prop
   * @return
   * @throws DecoderException
   */
  private String getDecodedPropertyalue(Property prop) throws DecoderException {
    Encoding enc = (Encoding) prop.getParameter(Parameter.Id.ENCODING);
    String val = prop.getValue();
    if (enc != null && enc.getValue().equalsIgnoreCase("QUOTED-PRINTABLE")) {

      /*
       * A special Outlook2003 hack.
       */
      if (val.endsWith("=")) {
        val = val.substring(0, val.length() - 1);
      }

      QuotedPrintableCodec codec = new QuotedPrintableCodec();
      return codec.decode(val);
    } else {
      return val;
    }
  }
示例#8
0
  public Property getBlock(String category, String key, int defaultID) {
    Property prop = get(category, key, -1);

    if (prop.getInt() != -1) {
      configBlocks[prop.getInt()] = true;
      return prop;
    } else {
      if (Block.blocksList[defaultID] == null && !configBlocks[defaultID]) {
        prop.value = Integer.toString(defaultID);
        configBlocks[defaultID] = true;
        return prop;
      } else {
        for (int j = configBlocks.length - 1; j > 0; j--) {
          if (Block.blocksList[j] == null && !configBlocks[j]) {
            prop.value = Integer.toString(j);
            configBlocks[j] = true;
            return prop;
          }
        }

        throw new RuntimeException("No more block ids available for " + key);
      }
    }
  }
示例#9
0
 static void reqDeleteProperty(Client c) throws IOException {
   int foo, propty;
   IO io = c.client;
   foo = io.readInt();
   Window w = c.lookupWindow(foo);
   if (w == null) {
     c.errorValue = foo;
     c.errorReason = 3; // BadWindow;
   }
   propty = foo = io.readInt();
   c.length -= 3;
   if (c.errorReason != 0) {
     return;
   }
   if (w.parent != null) {
     Property.delProperty(c, w, propty, 0);
   }
 }
示例#10
0
  static void reqGetProperty(Client c) throws IOException {
    int foo;
    int dlt;
    int prprty;
    int typ;
    int ffst, lngth;
    IO io = c.client;
    dlt = c.data;

    foo = io.readInt();
    Window w = c.lookupWindow(foo);
    if (w == null) {
      c.errorValue = foo;
      c.errorReason = 3; // BadWindow;
    }
    prprty = io.readInt();
    typ = io.readInt();
    ffst = io.readInt();
    lngth = io.readInt();
    c.length -= 6;
    if (c.errorReason != 0) {
      return;
    }
    int frmt;
    int seq;
    int ba;
    Property prop;
    prop = Property.getProperty(w, prprty, typ);

    synchronized (io) {
      io.writeByte(1);
      if (prop == null) {
        io.writeByte(0);
        io.writeShort(c.seq);
        io.writeInt(0);
        io.writeInt(0);
        io.writeInt(0);
        io.writeInt(0);
        io.writePad(12);
        io.flush();
        return;
      }

      if ((typ != prop.type) && typ != 0) {
        io.writeByte(prop.format);
        io.writeShort(c.seq);
        io.writeInt(0);
        io.writeInt(prop.type);
        io.writeInt(0);
        io.writeInt(0);
        io.writePad(12);
        io.flush();
        return;
      }

      int n = (prop.format / 8) * prop.size;

      int ind = ffst * 4;
      if (n < ind) {
        // System.err.println("procGetProperty: ind-n="+new Integer((ind-n)));
      }

      int len = ((n - ind) < lngth * 4) ? n - ind : lngth * 4;
      if ((lngth * 4) < 0) len = n - ind;
      ba = n - (ind + len);
      if (dlt != 0 && ba == 0) {
        c.cevent.mkPropertyNotify(w.id, prprty, (int) System.currentTimeMillis(), 1);
        w.sendEvent(c.cevent, 1, null);
      }

      io.writeByte(prop.format);
      io.writeShort(c.seq);
      io.writeInt((len + 3) / 4);
      io.writeInt(prop.type);
      io.writeInt(ba);
      if ((prop.format / 8) == 0) io.writeInt(0);
      else io.writeInt(len / (prop.format / 8));

      io.writePad(12);

      if (len > 0) {
        if (c.swap && (prop.format == 16 || prop.format == 32)) {
          byte[] b = new byte[len];
          System.arraycopy(prop.data, ind, b, 0, len);
          switch (prop.format) {
            case 16:
              swapS(b, 0, len);
              break;
            case 32:
              swapL(b, 0, len);
              break;
            default:
          }
          io.writeByte(b, 0, len);
        } else {
          io.writeByte(prop.data, ind, len);
        }
        if (((-len) & 3) > 0) {
          io.writePad((-len) & 3);
        }
      }
      io.flush();
    }

    if (dlt != 0 && ba == 0) {
      Property.delProperty(c, w, prprty, typ);
    }
  }
 // 循环处理每个需要处理的程序对象
 public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
   // 定义一个文件输出流,用于生成额外的文件
   PrintStream ps = null;
   try {
     // 遍历每个被@Persistent修饰的class文件
     for (Element t : roundEnv.getElementsAnnotatedWith(Persistent.class)) {
       // 获取正在处理的类名
       Name clazzName = t.getSimpleName();
       // 获取类定义前的@Persistent Annotation
       Persistent per = t.getAnnotation(Persistent.class);
       // 创建文件输出流
       ps = new PrintStream(new FileOutputStream(clazzName + ".hbm.xml"));
       // 执行输出
       ps.println("<?xml version=\"1.0\"?>");
       ps.println("<!DOCTYPE hibernate-mapping PUBLIC");
       ps.println("	\"-//Hibernate/Hibernate " + "Mapping DTD 3.0//EN\"");
       ps.println("	\"http://www.hibernate.org/dtd/" + "hibernate-mapping-3.0.dtd\">");
       ps.println("<hibernate-mapping>");
       ps.print("	<class name=\"" + t);
       // 输出per的table()的值
       ps.println("\" table=\"" + per.table() + "\">");
       for (Element f : t.getEnclosedElements()) {
         // 只处理成员变量上的Annotation
         if (f.getKind() == ElementKind.FIELD) // ①
         {
           // 获取成员变量定义前的@Id Annotation
           Id id = f.getAnnotation(Id.class); // ②
           // 当@Id Annotation存在时输出<id.../>元素
           if (id != null) {
             ps.println(
                 "		<id name=\""
                     + f.getSimpleName()
                     + "\" column=\""
                     + id.column()
                     + "\" type=\""
                     + id.type()
                     + "\">");
             ps.println("		<generator class=\"" + id.generator() + "\"/>");
             ps.println("		</id>");
           }
           // 获取成员变量定义前的@Property Annotation
           Property p = f.getAnnotation(Property.class); // ③
           // 当@Property Annotation存在时输出<property.../>元素
           if (p != null) {
             ps.println(
                 "		<property name=\""
                     + f.getSimpleName()
                     + "\" column=\""
                     + p.column()
                     + "\" type=\""
                     + p.type()
                     + "\"/>");
           }
         }
       }
       ps.println("	</class>");
       ps.println("</hibernate-mapping>");
     }
   } catch (Exception ex) {
     ex.printStackTrace();
   } finally {
     if (ps != null) {
       try {
         ps.close();
       } catch (Exception ex) {
         ex.printStackTrace();
       }
     }
   }
   return true;
 }
  public static void main(String[] args) {

    List<String> obj = new ArrayList<String>();

    Scanner input = new Scanner(System.in);

    System.out.print("Enter URI: ");

    String userIn = input.nextLine();

    // create an empty Model
    Model model = ModelFactory.createDefaultModel();

    // read the RDF/XML file
    model.read(userIn);

    // write it to standard out
    // model.write(System.out);

    // list the statements in the Model
    StmtIterator iter = model.listStatements();

    System.out.println();

    // print out the predicate, subject and object of each statement
    while (iter.hasNext()) {
      Statement stmt = iter.nextStatement(); // get next statement
      Resource subject = stmt.getSubject(); // get the subject
      Property predicate = stmt.getPredicate(); // get the predicate
      RDFNode object = stmt.getObject(); // get the object

      System.out.print(subject.toString());
      System.out.print(" -> " + predicate.toString() + " -> ");
      if (object instanceof Resource) {
        System.out.print(object.toString() + "\n");
      } else {
        // object is a literal
        System.out.print(" \"" + object.toString() + "\"\n");
      }
    }

    /* for(int i = 0; i < (obj.size()); i++){

    	String sparqlQueryString1=
    								"SELECT ?s ?o "+
    								"WHERE {"+
    								"?s ?p ?o ."+
    								"?o <bif:contains> \""+obj.get(i)+"\" ."+
    								"}"+
    								"limit 10";

    		      Query query = QueryFactory.create(sparqlQueryString1);
    		      QueryExecution qexec = QueryExecutionFactory.sparqlService("http://pubmed.bio2rdf.org/sparql", query);

    		      ResultSet results = qexec.execSelect();
    		      System.out.println("Query: "+obj.get(i));
    		      ResultSetFormatter.out(System.out, results, query);

    		     qexec.close() ;
    } */

  }
示例#13
0
  /**
   * This example has been prepared with Outlook 2003, it is full of errors, but still the library
   * should be able to parse it as well as possible.
   *
   * <p>This test also makes use of a custom ParameterRegistry, that allows me to work around the
   * Outlook quirk, that places the TYPE parameter values without the TYPE string, i.e. instead of
   * TYPE=HOME,WORK, we have only HOME,WORK.
   *
   * @throws ParserException
   * @throws IOException
   * @throws ValidationException
   * @throws DecoderException
   */
  @Test
  public void testOutlookExample()
      throws IOException, ParserException, ValidationException, DecoderException {
    File file = new File("src/test/resources/samples/vcard-antoni-outlook2003.vcf");
    Reader reader = new FileReader(file);
    GroupRegistry groupRegistry = new GroupRegistry();
    PropertyFactoryRegistry propReg = new PropertyFactoryRegistry();
    ParameterFactoryRegistry parReg = new ParameterFactoryRegistry();

    /*
     * The custom registry allows the file to be parsed correctly. It's the
     * first workaround for the Outlook problem.
     */
    VCardBuilder builder = new VCardBuilder(reader, groupRegistry, propReg, parReg);

    VCard card = builder.build();
    assertEquals("Antoni Jozef Mylka jun.", card.getProperty(Id.FN).getValue());

    /*
     * To test whether the file has really been parsed correctly, we
     * generate a string out of it. Before writing this test, the builder
     * contained a bug. The file contains non-standard folding. The LABEL
     * property has two lines, but the second line is not indented properly.
     * The builder used to interpret it as a separate property. Since it
     * didn't know it, it used to insert NULL into the property list. This
     * NULL yielded a NullPointerException when trying to serialize the file
     * back.
     *
     * If we can't preserve all data we should still have "something"
     *
     * note: we use non-validating outputter, since the ENCODING parameter
     * has been deprecated in the newest versions
     */
    VCardOutputter outputter = new VCardOutputter(false);
    StringWriter writer = new StringWriter();
    outputter.output(card, writer);

    /*
     * We don't support quoted printable, and we don't try to support
     * the crappy Outlook 2003 folding, but we would still like to
     * get something.
     */
    Property labelProperty = card.getProperty(Id.LABEL);
    String labelvalue = labelProperty.getValue();
    assertEquals(
        "3.10=0D=0ATrippstadter Str. 122=0D=0AKaiserslautern, " + "Rheinland-Pfalz 67663=",
        labelvalue);

    /*
     * A workaround for the limitation above, a utility method, that
     * checks the encoding of a property, and returns an un-encoded
     * value.
     */
    assertEquals(
        "3.10\r\nTrippstadter Str. 122\r\nKaiserslautern, " + "Rheinland-Pfalz 67663",
        getDecodedPropertyalue(labelProperty));

    /*
     * Another issue found, the BDAY property is parsed, but the
     * value is not converted to a date, and te BDay.getDate() method
     * returns null.
     */
    BDay bday = (BDay) card.getProperty(Id.BDAY);
    assertNotNull(bday.getDate());
    assertEquals("19800118", bday.getValue());

    /*
     * Yet another issue. The entry in PropertyFactoryRegistry for the ORG
     * property was invalid. There should be TWO values for this file
     * and the org property.
     */
    String[] vals = ((Org) card.getProperty(Id.ORG)).getValues();
    assertEquals(2, vals.length);
    assertEquals("DFKI", vals[0]);
    assertEquals("Knowledge-Management", vals[1]);
  }
示例#14
0
 /**
  * Write the xml for a {@link Property}.
  *
  * @param property
  * @param contentHandler
  * @throws SAXException
  */
 protected static void generateXML(
     Property property, ContentHandler contentHandler, boolean isScrPrivateFile)
     throws SAXException {
   final AttributesImpl ai = new AttributesImpl();
   IOUtils.addAttribute(ai, "name", property.getName());
   IOUtils.addAttribute(ai, "type", property.getType());
   IOUtils.addAttribute(ai, "value", property.getValue());
   // we have to write more information if this is our scr private file
   if (isScrPrivateFile) {
     IOUtils.addAttribute(ai, "private", String.valueOf(property.isPrivate()));
     if (property.getLabel() != null) {
       IOUtils.addAttribute(ai, "label", String.valueOf(property.getLabel()));
     }
     if (property.getDescription() != null) {
       IOUtils.addAttribute(ai, "description", String.valueOf(property.getDescription()));
     }
     if (property.getCardinality() != null) {
       IOUtils.addAttribute(ai, "cardinality", String.valueOf(property.getCardinality()));
     }
   }
   IOUtils.indent(contentHandler, 2);
   contentHandler.startElement(
       INNER_NAMESPACE_URI,
       ComponentDescriptorIO.PROPERTY,
       ComponentDescriptorIO.PROPERTY_QNAME,
       ai);
   if (property.getMultiValue() != null && property.getMultiValue().length > 0) {
     // generate a new line first
     IOUtils.text(contentHandler, "\n");
     for (int i = 0; i < property.getMultiValue().length; i++) {
       IOUtils.indent(contentHandler, 3);
       IOUtils.text(contentHandler, property.getMultiValue()[i]);
       IOUtils.newline(contentHandler);
     }
     IOUtils.indent(contentHandler, 2);
   }
   contentHandler.endElement(
       INNER_NAMESPACE_URI, ComponentDescriptorIO.PROPERTY, ComponentDescriptorIO.PROPERTY_QNAME);
   IOUtils.newline(contentHandler);
 }
示例#15
0
  public void load() {
    BufferedReader buffer = null;
    try {
      if (file.getParentFile() != null) {
        file.getParentFile().mkdirs();
      }

      if (!file.exists() && !file.createNewFile()) {
        return;
      }

      if (file.canRead()) {
        UnicodeInputStreamReader input =
            new UnicodeInputStreamReader(new FileInputStream(file), defaultEncoding);
        defaultEncoding = input.getEncoding();
        buffer = new BufferedReader(input);

        String line;
        Map<String, Property> currentMap = null;

        while (true) {
          line = buffer.readLine();

          if (line == null) {
            break;
          }

          int nameStart = -1, nameEnd = -1;
          boolean skip = false;
          boolean quoted = false;
          for (int i = 0; i < line.length() && !skip; ++i) {
            if (Character.isLetterOrDigit(line.charAt(i))
                || ALLOWED_CHARS.indexOf(line.charAt(i)) != -1
                || (quoted && line.charAt(i) != '"')) {
              if (nameStart == -1) {
                nameStart = i;
              }

              nameEnd = i;
            } else if (Character.isWhitespace(line.charAt(i))) {
              // ignore space charaters
            } else {
              switch (line.charAt(i)) {
                case '#':
                  skip = true;
                  continue;

                case '"':
                  if (quoted) {
                    quoted = false;
                  }
                  if (!quoted && nameStart == -1) {
                    quoted = true;
                  }
                  break;

                case '{':
                  String scopeName = line.substring(nameStart, nameEnd + 1);

                  currentMap = categories.get(scopeName);
                  if (currentMap == null) {
                    currentMap = new TreeMap<String, Property>();
                    categories.put(scopeName, currentMap);
                  }

                  break;

                case '}':
                  currentMap = null;
                  break;

                case '=':
                  String propertyName = line.substring(nameStart, nameEnd + 1);

                  if (currentMap == null) {
                    throw new RuntimeException("property " + propertyName + " has no scope");
                  }

                  Property prop = new Property();
                  prop.setName(propertyName);
                  prop.value = line.substring(i + 1);
                  i = line.length();

                  currentMap.put(propertyName, prop);

                  break;

                default:
                  throw new RuntimeException("unknown character " + line.charAt(i));
              }
            }
          }
          if (quoted) {
            throw new RuntimeException("unmatched quote");
          }
        }
      }
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      if (buffer != null) {
        try {
          buffer.close();
        } catch (IOException e) {
        }
      }
    }
  }
示例#16
0
  static void changeWindowProperty(
      Client c,
      Window w,
      int property,
      int type,
      short format,
      byte mode,
      int len,
      byte[] value,
      boolean sendevent)
      throws IOException {
    synchronized (w) {
      Property p;
      int totalSize = len * (format / 8);
      p = w.getProperty();
      while (p != null) {
        if (p.propertyName == property) break;
        p = p.next;
      }

      if (p != null) {
        if ((format != p.format) && (mode != PropModeReplace)) {
          System.err.println("error!");
          c.errorReason = 8; // BadMatch
          return;
        }
        if ((type != p.type) && (mode != PropModeReplace)) {
          System.err.println("error!");
          c.errorReason = 8; // BadMatch
          return;
        }
        if (mode == PropModeReplace) {
          p.data = value;
          p.size = len;
          p.format = format;
          p.type = type;
        } else if (len == 0) {
        } else if (mode == PropModeAppend) {
          byte[] foo = new byte[(format / 8) * (len + p.size)];
          if (p.size > 0) System.arraycopy(p.data, 0, foo, 0, p.size);
          System.arraycopy(value, 0, foo, p.size, totalSize);
          p.size += len;
          p.data = foo;
        } else if (mode == PropModePrepend) {
          byte[] foo = new byte[(format / 8) * (len + p.size)];
          System.arraycopy(value, 0, foo, 0, totalSize);
          if (p.size > 0) System.arraycopy(p.data, 0, foo, totalSize, p.size);
          p.size += len;
          p.data = foo;
        }
        // change;
      } else {
        //    w.setProperty(null);
        p = new Property();
        p.propertyName = property;
        p.type = type;
        p.format = (short) format;
        p.data = value;
        p.size = len;
        p.next = w.getProperty();
        w.setProperty(p);
      }

      if (p != null) {
        if (p.propertyName == 9
            && // CUT_BUFFER0
            w == w.screen.root
            && p.size > 0) {
          CopyPaste.setString(new String(p.data, 0, p.size));
        }
        if (w.screen.windowmode != WeirdX.InBrowser
            && p.propertyName == 39
            && p.type == 31
            && p.size > 0
            && w.ddxwindow != null) {
          java.awt.Window frame = w.getFrame();
          if (frame != null && (frame instanceof java.awt.Frame)) {
            ((java.awt.Frame) frame).setTitle(new String(p.data));
          }
        }
      }
    }

    if (sendevent) {
      c.cevent.mkPropertyNotify(w.id, property, (int) System.currentTimeMillis(), 0);
      w.sendEvent(c.cevent, 1, null);
    }
  }
示例#17
0
    public void startElement(String uri, String localName, String name, Attributes attributes)
        throws SAXException {
      // according to the spec, the elements should have the namespace,
      // except when the root element is the "component" element
      // So we check this for the first element, we receive.
      if (this.firstElement) {
        this.firstElement = false;
        if (localName.equals(COMPONENT) && "".equals(uri)) {
          this.overrideNamespace = NAMESPACE_URI_1_0;
        }
      }

      if (this.overrideNamespace != null && "".equals(uri)) {
        uri = this.overrideNamespace;
      }

      // however the spec also states that the inner elements
      // of a component are unqualified, so they don't have
      // the namespace - we allow both: with or without namespace!
      if (this.isComponent && "".equals(uri)) {
        uri = NAMESPACE_URI_1_0;
      }

      // from here on, uri has the namespace regardless of the used xml format
      if (NAMESPACE_URI_1_0.equals(uri)
          || NAMESPACE_URI_1_1.equals(uri)
          || NAMESPACE_URI_1_1_FELIX.equals(uri)) {

        if (NAMESPACE_URI_1_1.equals(uri)) {
          components.setSpecVersion(Constants.VERSION_1_1);
        } else if (NAMESPACE_URI_1_1_FELIX.equals(uri)) {
          components.setSpecVersion(Constants.VERSION_1_1_FELIX);
        }

        if (localName.equals(COMPONENT)) {
          this.isComponent = true;

          this.currentComponent = new Component();
          this.currentComponent.setName(attributes.getValue(COMPONENT_ATTR_NAME));

          // enabled attribute is optional
          if (attributes.getValue(COMPONENT_ATTR_ENABLED) != null) {
            this.currentComponent.setEnabled(
                Boolean.valueOf(attributes.getValue(COMPONENT_ATTR_ENABLED)));
          }

          // immediate attribute is optional
          if (attributes.getValue(COMPONENT_ATTR_IMMEDIATE) != null) {
            this.currentComponent.setImmediate(
                Boolean.valueOf(attributes.getValue(COMPONENT_ATTR_IMMEDIATE)));
          }

          this.currentComponent.setFactory(attributes.getValue(COMPONENT_ATTR_FACTORY));

          // check for version 1.1 attributes
          if (components.getSpecVersion() == Constants.VERSION_1_1) {
            this.currentComponent.setConfigurationPolicy(
                attributes.getValue(COMPONENT_ATTR_POLICY));
            this.currentComponent.setActivate(attributes.getValue(COMPONENT_ATTR_ACTIVATE));
            this.currentComponent.setDeactivate(attributes.getValue(COMPONENT_ATTR_DEACTIVATE));
            this.currentComponent.setModified(attributes.getValue(COMPONENT_ATTR_MODIFIED));
          }
        } else if (localName.equals(IMPLEMENTATION)) {
          // Set the implementation class name (mandatory)
          final Implementation impl = new Implementation();
          this.currentComponent.setImplementation(impl);
          impl.setClassname(attributes.getValue("class"));

        } else if (localName.equals(PROPERTY)) {

          // read the property, unless it is the service.pid
          // property which must not be inherited
          final String propName = attributes.getValue("name");
          if (!org.osgi.framework.Constants.SERVICE_PID.equals(propName)) {
            final Property prop = new Property();

            prop.setName(propName);
            prop.setType(attributes.getValue("type"));

            if (attributes.getValue("value") != null) {
              prop.setValue(attributes.getValue("value"));
              this.currentComponent.addProperty(prop);
            } else {
              // hold the property pending as we have a multi value
              this.pendingProperty = prop;
            }
            // check for abstract properties
            prop.setLabel(attributes.getValue("label"));
            prop.setDescription(attributes.getValue("description"));
            prop.setCardinality(attributes.getValue("cardinality"));
            final String pValue = attributes.getValue("private");
            if (pValue != null) {
              prop.setPrivate(Boolean.valueOf(pValue).booleanValue());
            }
          }

        } else if (localName.equals("properties")) {

          // TODO: implement the properties tag

        } else if (localName.equals(SERVICE)) {

          this.currentService = new Service();

          this.currentService.setServicefactory(attributes.getValue("servicefactory"));

          this.currentComponent.setService(this.currentService);

        } else if (localName.equals(INTERFACE)) {
          final Interface interf = new Interface();
          this.currentService.addInterface(interf);
          interf.setInterfacename(attributes.getValue("interface"));

        } else if (localName.equals(REFERENCE)) {
          final Reference ref = new Reference();

          ref.setName(attributes.getValue("name"));
          ref.setInterfacename(attributes.getValue("interface"));
          ref.setCardinality(attributes.getValue("cardinality"));
          ref.setPolicy(attributes.getValue("policy"));
          ref.setTarget(attributes.getValue("target"));
          ref.setBind(attributes.getValue("bind"));
          ref.setUnbind(attributes.getValue("unbind"));

          if (attributes.getValue("checked") != null) {
            ref.setChecked(Boolean.valueOf(attributes.getValue("checked")).booleanValue());
          }
          if (attributes.getValue("strategy") != null) {
            ref.setStrategy(attributes.getValue("strategy"));
          }

          this.currentComponent.addReference(ref);
        }
      }
    }