1 50 package org.apache.excalibur.instrument.manager.altrmi; 51 52 import org.apache.altrmi.server.PublicationDescription; 53 import org.apache.altrmi.server.PublicationException; 54 import org.apache.altrmi.server.ServerException; 55 import org.apache.altrmi.server.impl.AbstractServer; 56 import org.apache.altrmi.server.impl.socket.CompleteSocketCustomStreamServer; 57 import org.apache.avalon.framework.activity.Disposable; 58 import org.apache.excalibur.instrument.manager.DefaultInstrumentManager; 59 import org.apache.excalibur.instrument.manager.InstrumentManagerClientLocalImpl; 60 import org.apache.excalibur.instrument.manager.interfaces.InstrumentDescriptor; 61 import org.apache.excalibur.instrument.manager.interfaces.InstrumentManagerClient; 62 import org.apache.excalibur.instrument.manager.interfaces.InstrumentSampleDescriptor; 63 import org.apache.excalibur.instrument.manager.interfaces.InstrumentableDescriptor; 64 65 74 public class InstrumentManagerAltrmiServer 75 implements Disposable 76 { 77 78 public static final int DEFAULT_PORT = 15555; 79 80 private int m_port; 81 private AbstractServer m_server; 82 83 86 public InstrumentManagerAltrmiServer( DefaultInstrumentManager manager ) 87 throws ServerException, PublicationException 88 { 89 this( manager, DEFAULT_PORT ); 90 } 91 92 public InstrumentManagerAltrmiServer( DefaultInstrumentManager manager, int port ) 93 throws ServerException, PublicationException 94 { 95 m_port = port; 96 97 InstrumentManagerClientLocalImpl client = new InstrumentManagerClientLocalImpl( manager ); 98 99 System.out.println( "Creating CompleteSocketCustomStreamServer..." ); 100 m_server = new CompleteSocketCustomStreamServer( port ); 101 102 System.out.println( "Publishing InstrumentManagerClient..." ); 103 104 Class [] additionalFacadeClasses = new Class [] 105 { 106 InstrumentableDescriptor.class, 107 InstrumentDescriptor.class, 108 InstrumentSampleDescriptor.class 109 }; 110 111 m_server.publish( client, "InstrumentManagerClient", 112 new PublicationDescription( InstrumentManagerClient.class, additionalFacadeClasses ) ); 113 114 System.out.println( "Starting CompleteSocketObjectStreamServer..." ); 115 m_server.start(); 116 System.out.println( "Started on port: " + port ); 117 } 118 119 122 public void dispose() 123 { 124 m_server.stop(); 125 m_server = null; 126 } 127 } 128 129 | Popular Tags |