
/*
 * Copyright (C) The Apache Software Foundation. All rights reserved.
 *
 * This software is published under the terms of the Apache Software License
 * version 1.1, a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 */
package org.apache.commons.altrmi.common;



import java.io.ObjectOutput;
import java.io.IOException;
import java.io.ObjectInput;


/**
 * Class ListReply 
 *
 *
 * @author Vinay Chandrasekharan 
 * @version $Revision: 1.0 $
 */
public final class ListReply extends AltrmiReply {

    private String[] mListOfPublishedObjects;

    /**
     * Constructor LookupReply
     *
     *
     * @param param_listOfPublishedObjects : list of Published Objects
     *
     */
    public ListReply(String[] param_listOfPublishedObjects ) {
        mListOfPublishedObjects = param_listOfPublishedObjects;
    }

    /**
     * Constructor ListReply
     *
     *
     */
    public ListReply() {}    // for Externalization

    /**
     * Method getReferenceID.
     *
     *
     * @return
     *
     */
    public String[] getListOfPublishedObjects() {
        return mListOfPublishedObjects;
    }

    /**
     * Method getReplyCode.  This is quicker than instanceof for type checking.
     *
     *
     * @return
     *
     */
    public int getReplyCode() {
        return LISTREPLY;
    }

    /**
     * The object implements the writeExternal method to save its contents
     * by calling the methods of DataOutput for its primitive values or
     * calling the writeObject method of ObjectOutput for objects, strings,
     * and arrays.
     *
     * @serialData Overriding methods should use this tag to describe
     *             the data layout of this Externalizable object.
     *             List the sequence of element types and, if possible,
     *             relate the element to a public/protected field and/or
     *             method of this Externalizable class.
     *
     * @param out the stream to write the object to
     * @exception IOException Includes any I/O exceptions that may occur
     */
    public void writeExternal(ObjectOutput out) throws IOException {
        out.writeObject(mListOfPublishedObjects);
    }

    /**
     * The object implements the readExternal method to restore its
     * contents by calling the methods of DataInput for primitive
     * types and readObject for objects, strings and arrays.  The
     * readExternal method must read the values in the same sequence
     * and with the same types as were written by writeExternal.
     *
     * @param in the stream to read data from in order to restore the object
     * @exception IOException if I/O errors occur
     * @exception ClassNotFoundException If the class for an object being
     *              restored cannot be found.
     */
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
        mListOfPublishedObjects = (String[]) in.readObject();
    }
}
