Package org.nasutekds.server.types

Examples of org.nasutekds.server.types.ByteStringBuilder$SubSequence


    }


    try
    {
      ByteStringBuilder builder = new ByteStringBuilder();
      ASN1Writer writer = ASN1.getWriter(builder);

      try
      {
        writer.writeStartSequence();
        writer.writeOctetString(targetDNString);

        // Use the subcommand provided to figure out how to encode the request.
        writer.writeStartSequence();
        result = processSubcommand(writer);
        if (result != LDAPResultCode.SUCCESS)
        {
          return result;
        }
        writer.writeEndSequence();

        writer.writeEndSequence();
      }
      catch(Exception e)
      {
        // TODO: Better message
        err.println(e);
      }


      ExtendedRequestProtocolOp extendedRequest =
           new ExtendedRequestProtocolOp(OID_PASSWORD_POLICY_STATE_EXTOP,
                                         builder.toByteString());

      LDAPMessage requestMessage =
           new LDAPMessage(nextMessageID.getAndIncrement(), extendedRequest);

      try
View Full Code Here


   */
  public InternalLDAPInputStream(InternalLDAPSocket socket)
  {
    this.socket = socket;
    this.messageQueue = new ArrayBlockingQueue<LDAPMessage>(10);
    this.messageBuffer = new ByteStringBuilder();
    this.messageReader = messageBuffer.asReader();
    this.writer = ASN1.getWriter(messageBuffer);
    this.closed = false;
  }
View Full Code Here

      int maxElementSize)
  {
    this.byteChannel = channel;
    this.byteBuffer = ByteBuffer.allocate(bufferSize);
    this.byteBuffer.flip();
    this.saveBuffer = new ByteStringBuilder();
    this.saveBufferReader = saveBuffer.asReader();

    CombinedBufferInputStream bufferStream = new CombinedBufferInputStream();
    this.reader = new ASN1InputStreamReader(bufferStream, maxElementSize);
  }
View Full Code Here

    // Make sure we have a cached sub-stream at this depth
    if(stackDepth >= streamStack.size())
    {
      ByteSequenceOutputStream subStream =
          new ByteSequenceOutputStream(new ByteStringBuilder());
      streamStack.add(subStream);
      out = subStream;
    }
    else
    {
View Full Code Here



    private ByteString getKey(int value, char type)
    {
      ByteStringBuilder builder = new ByteStringBuilder();
      builder.append(type);
      builder.append(value);
      return builder.toByteString();
    }
View Full Code Here

      DirectoryException lastException = null;
      boolean oneRegistered = false;
      Set<String> registeredAttrs = new HashSet<String>();
      for (String attrDefinition : remainingAttrs)
      {
        ByteStringBuilder sb = new ByteStringBuilder();
        sb.append(attrDefinition);
        try
        {
          AttributeType attrType =
            AttributeTypeSyntax.decodeAttributeType(sb, schema, false);
          schema.registerAttributeType(attrType, true);
          oneRegistered = true;
          registeredAttrs.add(attrDefinition);
        }
        catch (DirectoryException de)
        {
          lastException = de;
        }
      }
      if (!oneRegistered)
      {
        throw lastException;
      }
      remainingAttrs.removeAll(registeredAttrs);
    }

    List<Object> objectClasses =
      csr.getAttributeValues(ConfigConstants.ATTR_OBJECTCLASSES_LC);

    Set<String> remainingOcs = new HashSet<String>();
    for (Object o : objectClasses)
    {
      remainingOcs.add((String)o);
    }

    while (!remainingOcs.isEmpty())
    {
      DirectoryException lastException = null;
      boolean oneRegistered = false;
      Set<String> registeredOcs = new HashSet<String>();
      for (String ocDefinition : remainingOcs)
      {
        ByteStringBuilder sb = new ByteStringBuilder();
        sb.append(ocDefinition);
        try
        {
          ObjectClass oc =
            ObjectClassSyntax.decodeObjectClass(sb, schema, false);
          schema.registerObjectClass(oc, true);
View Full Code Here

    ProcessBuilder pb = new ProcessBuilder(args);
   
    Process p = pb.start();
    if (p.waitFor() != 0) {
      ByteStringBuilder stdOut = new ByteStringBuilder();
      ByteStringBuilder stdErr = new ByteStringBuilder();
      while(stdOut.append(p.getInputStream(), 512) > 0);
      while(stdErr.append(p.getErrorStream(), 512) > 0);
      throw new IllegalStateException(
          "setup server process failed:\n" +
          "exit value: " + p.exitValue() + "\n" +
          "stdout contents: " + stdOut.toString() + "\n" +
          "stderr contents: " + stdErr.toString());
    }
  }
View Full Code Here

   */
  @Test(dataProvider = "elementArrays")
  public void testDecodeValidArrayAsOctetString(byte[] b)
      throws Exception
  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);

    assertEquals(getReader(bsb.toByteArray(), 0).readOctetString(),
        ByteString.wrap(b));
  }
View Full Code Here

   */
  @Test(dataProvider = "elementArrays")
  public void testDecodeValidArrayAsOctetStringAsString(byte[] b)
      throws Exception
  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);

    assertEquals(getReader(bsb.toByteArray(), 0).readOctetStringAsString(),
        new String(b, "UTF-8"));
  }
View Full Code Here

   */
  @Test(dataProvider = "elementArrays")
  public void testDecodeValidArrayAsOctetStringAsStringCharSet(byte[] b)
      throws Exception
  {
    ByteStringBuilder bsb = new ByteStringBuilder();
    bsb.append(ASN1Constants.UNIVERSAL_OCTET_STRING_TYPE);
    bsb.appendBERLength(b.length);
    bsb.append(b);

    assertEquals(
        getReader(bsb.toByteArray(), 0).readOctetStringAsString("UTF-8"),
        new String(b, "UTF-8"));
  }
View Full Code Here

TOP

Related Classes of org.nasutekds.server.types.ByteStringBuilder$SubSequence

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.