Commit 46e4b6e6 authored by Sunil Kumar's avatar Sunil Kumar
Browse files

Changes for feb-04 NDK release

parent 14c02c35
......@@ -45,10 +45,45 @@ public class RfcExtendedResponse extends ASN1Sequence implements RfcResponse {
private int responseNameIndex;
private int responseIndex;
//*************************************************************************
// Constructors for ExtendedResponse
//*************************************************************************
/**
* Creates the RFC Extended Response Object passing the individual parameters.
*
* @param resultCode The result code as defined in LDAPException.
*
* @param matchedDN The name of the lowest entry that was matched
* for some error result codes, an empty string
* or <code>null</code> if none.
*
* @param errorMessage A diagnostic message returned by the server,
* an empty string or <code>null</code> if none.
*
* @param referral The referral URLs returned for a REFERRAL result
* code or <code>null</code> if none.
*
* @param responseName The LDAPOID for this extended operation
*
* @param response Any Response returned by the server
*/
public RfcExtendedResponse(ASN1Enumerated resultCode, RfcLDAPDN matchedDN,
RfcLDAPString errorMessage, RfcReferral referral,RfcLDAPOID responseName ,ASN1OctetString response)
{
super(6);
add(resultCode);
add(matchedDN);
add(errorMessage);
if(referral != null)
add(referral);
if (responseName != null)
add(responseName);
if (response != null)
add(response);
return;
}
/**
* The only time a client will create a ExtendedResponse is when it is
* decoding it from an InputStream
......
......@@ -1110,7 +1110,7 @@ public class RfcFilter extends ASN1Choice
/**
* This inner class will tokenize the components of an RFC 2254 search filter.
*/
class FilterTokenizer
class FilterTokenizer implements java.io.Serializable
{
//*************************************************************************
......@@ -1370,5 +1370,29 @@ class FilterTokenizer
return filter.charAt(offset);
}
/**
* Writes the object state to a stream in standard Default Binary format
* This function wraps ObjectOutputStream' s defaultWriteObject() to write
* the non-static and non-transient fields of the current class to the stream
*
* @param objectOStrm The OutputSteam where the Object need to be written
*/
private void writeObject(java.io.ObjectOutputStream objectOStrm)
throws java.io.IOException {
objectOStrm.defaultWriteObject();
}
/**
* Reads the serialized object from the underlying input stream.
* This function wraps ObjectInputStream's defaultReadObject() function
*
* @param objectIStrm InputStream used to recover those objects previously serialized.
*/
private void readObject(java.io.ObjectInputStream objectIStrm)
throws java.io.IOException, ClassNotFoundException
{
objectIStrm.defaultReadObject();
}
}
}
......@@ -135,6 +135,24 @@ public class RfcLDAPMessage extends ASN1Sequence
return;
}
/**
* Create an RfcLDAPMessage using the specified LDAP Response when the return
* type is a ASN1SequenceOf .
* @param op an object of type ASN1SequenceOf.
*/
public RfcLDAPMessage(ASN1SequenceOf op)
{
super(2);
this.op = op;
add(new RfcMessageID()); // MessageID has static counter
add(op);
return;
}
/**
* Create an RfcLDAPMessage response from input parameters.
*/
......@@ -200,6 +218,9 @@ public class RfcLDAPMessage extends ASN1Sequence
case LDAPMessage.EXTENDED_RESPONSE:
set(1, new RfcExtendedResponse(dec, bais, content.length));
break;
case LDAPMessage.INTERMEDIATE_RESPONSE:
set(1, new RfcIntermediateResponse(dec, bais, content.length));
break;
case LDAPMessage.MODIFY_RESPONSE:
set(1, new RfcModifyResponse(dec, bais, content.length));
break;
......
......@@ -16,6 +16,9 @@ package com.novell.ldap.rfc2251;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import com.novell.ldap.LDAPUrl;
import com.novell.ldap.asn1.*;
/**
......@@ -44,6 +47,23 @@ public class RfcReferral extends ASN1SequenceOf {
// LDAPResponse.getReferrals())
}
/**
* This construtor is used when creating LDAPResponse directly and not from
* the stream.
* @param value This array of Referrals [LDAPURL]
* @throws MalformedURLException
* <b>Note:Limitation</b> The ldapurl specified to this constructor should
* have a dn part to it i.e ldap://www.nldap.com/cn=admin,o=acme is
* allowed but ldap://www.nldap.com is not allowed.
*/
public RfcReferral(String value[]) throws MalformedURLException {
super(value.length + 1);
for (int i = 0; i < value.length; i++) {
LDAPUrl url = new LDAPUrl(value[i]);
add(new ASN1OctetString(url.toString()));
}
}
//*************************************************************************
// Accessors
//*************************************************************************
......
......@@ -52,6 +52,16 @@ public class RfcSearchResultEntry extends ASN1Sequence {
// set(1, new PartitalAttributeList());
return;
}
/** Creates an RfcSearchResultEntry from individual ASN encoded objects.
* @param ObjectName The LDAPDN for the search result.
* @param attributes The various attributes for the specified attribute.
*/
public RfcSearchResultEntry(ASN1OctetString ObjectName,ASN1Sequence attributes)
{
super(2);
add(ObjectName);
add(attributes);
}
//*************************************************************************
// Accessors
......
......@@ -16,6 +16,8 @@ package com.novell.ldap.rfc2251;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import com.novell.ldap.*;
import com.novell.ldap.asn1.*;
......@@ -43,6 +45,21 @@ public class RfcSearchResultReference extends ASN1SequenceOf
super(dec, in, len);
return;
}
/** Creates the Object from a array of ldap urls passed as string.
* @param value array of urls with string Datatype.
* @throws MalformedURLException This exception is thrown if any of the
* LDAPURL is not formed
*/
public RfcSearchResultReference(String value[])
throws MalformedURLException {
super();
if (value == null)
throw new MalformedURLException("Malformed URL, null String are invalid URL");
for (int i = 0; i < value.length; i++) {
LDAPUrl url = new LDAPUrl(value[i]);
add(new ASN1OctetString(url.toString()));
}
}
//*************************************************************************
// Accessors
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment