package com.ibm.emb.meb.listener;

import javax.emb.ListenerVetoException;
import javax.emb.MediaEntityLocal;
import javax.emb.MediaException;
import javax.emb.MediaListener;

/**
 * This generic implementation of the MediaListener interface is only used for
 * testing purposes.
 */
public final class RemoveListener implements MediaListener {

    /**
     *
     */
    private static final long serialVersionUID = 3977298806821959991L;

    public RemoveListener() {
        super();
    }

    public void handleAboutToChangeMediaEntity(MediaEntityLocal meb, String propertyName) throws MediaException {
        if (propertyName == null) {
            throw new NullPointerException("property name was null");
        }
        if (meb == null) {
            throw new NullPointerException("meb was null");
        }
    }

    public void handleMediaEntityChanged(MediaEntityLocal meb, String propertyName) throws MediaException {
        if (propertyName == null) {
            throw new NullPointerException("property name was null");
        }
        if (meb == null) {
            throw new NullPointerException("meb was null");
        }
    }

    public void handleAboutToRemoveMediaEntity(MediaEntityLocal mediaEntity) throws MediaException {
        if (mediaEntity == null) throw new NullPointerException("media entity is null");
        throw new ListenerVetoException("will not allow this remove");
    }

    public boolean equals(Object obj) {
        if (obj instanceof RemoveListener) return true;
        return false;
    }

    public int hashCode() {
        return 1;
    }

}
