return true;
}
public void afterPropertiesSet() throws Exception {
this.grid = new GridImpl( new HashMap() );
MultiplexSocketServiceCongifuration socketConf = null;
if ( this.coreServices == null ) {
this.coreServices = new HashMap();
}
GridPeerConfiguration conf = new GridPeerConfiguration();
GridPeerServiceConfiguration coreSeviceLookupConf = new CoreServicesLookupConfiguration( this.coreServices );
conf.addConfiguration( coreSeviceLookupConf );
//Configuring the WhitePages
if ( this.whitePages != null ) {
WhitePagesLocalConfiguration wplConf = new WhitePagesLocalConfiguration();
wplConf.setWhitePages( this.whitePages );
conf.addConfiguration( wplConf );
}
conf.configure( this.grid );
// We do this after the main grid configuration, to make sure all services are instantiated
if ( this.socketServiceConfiguration != null ) {
AcceptorFactoryService acc = null;
if ( "mina".equals( this.socketServiceConfiguration.getAcceptor() ) ) {
acc = new MinaAcceptorFactoryService();
}
if ( acc == null ) {
// Mina is the default for the moment
acc = new MinaAcceptorFactoryService();
}
socketConf = new MultiplexSocketServiceCongifuration( new MultiplexSocketServerImpl( this.socketServiceConfiguration.getIp(),
acc,
SystemEventListenerFactory.getSystemEventListener(),
this.grid ) );
for ( String[] services : this.socketServiceConfiguration.getServices() ) {
Object service = ((GridImpl) this.grid).get( services[0].trim() );
if ( service == null ) {
throw new RuntimeException( "Unable to configure socket. Service '" + services[0] + "' could not be found" );
}
if ( "auto".equals( services[1].trim() ) ) {
} else {
socketConf.addService( services[0].trim(),
service,
Integer.parseInt( services[1].trim() ) );
}
}
socketConf.configureService( this.grid );
}
}