package nl.tudelft.simulation.dsol.naming; import javax.naming.NamingException; import javax.naming.event.EventContext; import javax.naming.event.NamingEvent; import javax.naming.event.NamingExceptionEvent; import nl.tudelft.simulation.naming.InitialEventContext; import nl.tudelft.simulation.naming.listener.ContextListenerInterface; /** * The ServerTest. *

* (c) copyright 2002-2005 Delft University of Technology , the * Netherlands.
* See for project information www.simulation.tudelft.nl
* License of use: Lesser General Public License (LGPL) , no * warranty. * @author Peter Jacobs * @version 1.2 Apr 16, 2004 * @since 1.5 */ public class ServerTest implements ContextListenerInterface { /** * constructs a new ServerTest. * @param context the context to use. * @throws NamingException on subscription */ public ServerTest(final InitialEventContext context) throws NamingException { super(); context.addNamingListener("/test", EventContext.OBJECT_SCOPE, this); } /** * executes the ServerTest * @param args the commandline arguments */ public static void main(String[] args) { try { InitialEventContext context = new InitialEventContext(); context.bind("/test", "test"); new ServerTest(context); } catch (NamingException e) { e.printStackTrace(); } } /** {@inheritDoc} */ @Override public void objectChanged(NamingEvent evt) { System.out.println("changed " + evt); } /** {@inheritDoc} */ @Override public void namingExceptionThrown(NamingExceptionEvent evt) { System.out.println("exception " + evt); } /** {@inheritDoc} */ @Override public void objectAdded(NamingEvent evt) { System.out.println("added" + evt); } /** {@inheritDoc} */ @Override public void objectRemoved(NamingEvent evt) { System.out.println("removed" + evt); } /** {@inheritDoc} */ @Override public void objectRenamed(NamingEvent evt) { System.out.println("renamed : " + evt); } }