Tutorial: Create Your Own Network Layer

This page describes how to create a network layer for the Janus platform.

Contents


Introduction

Janus networking module implements a Kernel Agent that listens to network events based on JXTA. The implementation should be enough for most applications, however some applications might have other requirements.

This document explains how to create you own network layer so that the networking kernel can use it.

The NetworkAdapter

The networking kernel talks to a NetworkAdapter to handle distant kernel operations. This is the interface you have to implement. See the javadoc for details. Once you have implemented an new adapter you have to tell the kernel to use it. To do so you need to create a new KernelAgentFactory.

public class MyNetworkingKernelAgentFactory implements KernelAgentFactory {
 
	@Override
	public KernelAgent newInstance(boolean commitSuicide,
			AgentActivator activator, EventListener startUpListener)
			throws Exception {
		return new NetworkingKernelAgent(activator, commitSuicide, startUpListener, new MyNetworkAdapter(););
	}
 
}

Then let the kernel know what factory to use :

Kernels.setPreferredKernelFactory(new MyNetworkingKernelAgentFactory());

This is it!

Please let us know if you implement you network modules!

Related Pages

2012-04-30Internet service is up again after 5 days of broken service.
This page was last modified on 16 February 2011, at 08:50. This page has been accessed 644 times.
Copyright 2010-2012 © Janus Core Developers - Privacy policy