All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.novell.ldap.events.edir.eventdata.ChangeAddressEventData Maven / Gradle / Ivy

There is a newer version: 2009-10-07
Show newest version
/* **************************************************************************
 * $OpenLDAP: pkg/jldap/com/novell/ldap/events/edir/eventdata/ChangeAddressEventData.java,v 1.3 2005/01/17 15:48:57 sunilk Exp $
 *
 * Copyright (C) 1999-2002 Novell, Inc. All Rights Reserved.
 *
 * THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
 * TREATIES. USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT
 * TO VERSION 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS
 * AVAILABLE AT HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE"
 * IN THE TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION
 * OF THIS WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP
 * PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT
 * THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
 ******************************************************************************/
package com.novell.ldap.events.edir.eventdata;

import com.novell.ldap.asn1.ASN1Integer;
import com.novell.ldap.asn1.ASN1Object;
import com.novell.ldap.asn1.ASN1OctetString;
import com.novell.ldap.asn1.LBERDecoder;
import com.novell.ldap.events.edir.EventResponseData;

import java.io.ByteArrayInputStream;
import java.io.IOException;


/**
 * This class represents the data for Change Address Events. The event
 * data has the following encoding:-
 * 
 * 

* ChangeServerAddress ::= [APPLICATION 12]
*     SEQUENCE {
*     flags INTEGER,
*     proto INTEGER,
*     addrFamily INTEGER,
*     address OCTET STRING,
*     pstkname LDAPSTRING,
*     source LDAPSTRING
*     } *

* *

* Note: Please refer the JLDAP SDK Documentation at * * http://developer.novell.com/ndk/jldap.htm for details of all * the properties. *

*/ public class ChangeAddressEventData implements EventResponseData { private final int flags; private final int proto; private final int addrFamily; private final String address; private final String pstkName; private final String source; /** * Default Constructor * * @param message ASN1Object containing the encoded data as String. * * @throws IOException When decoding of message fails. */ public ChangeAddressEventData(final ASN1Object message) throws IOException { super(); byte[] data = ((ASN1OctetString) message).byteValue(); ByteArrayInputStream in = new ByteArrayInputStream(data); LBERDecoder decode = new LBERDecoder(); int[] length = new int[1]; flags = ((ASN1Integer) decode.decode(in, length)).intValue(); proto = ((ASN1Integer) decode.decode(in, length)).intValue(); addrFamily = ((ASN1Integer) decode.decode(in, length)).intValue(); address = ((ASN1OctetString) decode.decode(in, length)).stringValue(); pstkName = ((ASN1OctetString) decode.decode(in, length)).stringValue(); source = ((ASN1OctetString) decode.decode(in, length)).stringValue(); } /** * Returns the Address as a String. * * @return Address as String. */ public String getAddress() { return address; } /** * Returns the Address Family. * * @return Address Family as integer. */ public int getAddrFamily() { return addrFamily; } /** * Returns the Flags. * * @return Flags as integer. */ public int getFlags() { return flags; } /** * Returns the Protocols. * * @return Protocols as integer. */ public int getProto() { return proto; } /** * Returns the Pstk Name. * * @return PStk Name as String. */ public String getPstkName() { return pstkName; } /** * Returns the source Module. * * @return Source Module as String. */ public String getSource() { return source; } /** * Returns a string representation of the object. * * @return a string representation of the object. * * @see java.lang.Object#toString() */ public String toString() { StringBuffer buf = new StringBuffer(); buf.append("[ChangeAddresssEvent[flags=" + getFlags() + "]"); buf.append("[proto=" + getProto() + "]"); buf.append("[addrFamily=" + getAddrFamily() + "]"); buf.append("[address=" + getAddress() + "]"); buf.append("[pstkName=" + getPstkName() + "]"); buf.append("[source=" + getSource() + "]]"); return buf.toString(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy