org.ow2.easybeans.component.smartclient.client
Class AskingClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by java.net.URLClassLoader
              extended by org.ow2.easybeans.component.smartclient.client.AskingClassLoader

public class AskingClassLoader
extends java.net.URLClassLoader

ClassLoader that is used and that ask the EasyBeans remote server.

Author:
Florent Benoit

Constructor Summary
AskingClassLoader(java.lang.String host, int portNumber)
          Creates a new classloader by using an empty URL.
 
Method Summary
protected  java.lang.Class<?> findClass(java.lang.String name)
          Finds and loads the class with the specified name from the URL search path.
If the super classloader doesn't find the class, it ask the remote server to download the class
 java.net.URL findResource(java.lang.String name)
          Finds the resource with the specified name on the URL search path.
 java.lang.String getProviderURL()
          Ask and return the remote PROVIDER_URL in order to connect with RMI.
 java.nio.ByteBuffer sendRequest(Message message, java.nio.channels.SocketChannel channel)
          Sends the given message on the given channel.
 
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findResources, getPermissions, getURLs, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AskingClassLoader

public AskingClassLoader(java.lang.String host,
                         int portNumber)
Creates a new classloader by using an empty URL.

Parameters:
host - the remote host to connect.
portNumber - the port number for the protocol.
Method Detail

sendRequest

public java.nio.ByteBuffer sendRequest(Message message,
                                       java.nio.channels.SocketChannel channel)
Sends the given message on the given channel.

Parameters:
message - the message to send
channel - the channel used to send the message.
Returns:
the bytebuffer containing the answer (to analyze)

findClass

protected java.lang.Class<?> findClass(java.lang.String name)
                                throws java.lang.ClassNotFoundException
Finds and loads the class with the specified name from the URL search path.
If the super classloader doesn't find the class, it ask the remote server to download the class

Overrides:
findClass in class java.net.URLClassLoader
Parameters:
name - the name of the class
Returns:
the resulting class
Throws:
java.lang.ClassNotFoundException - if the class could not be found

getProviderURL

public java.lang.String getProviderURL()
Ask and return the remote PROVIDER_URL in order to connect with RMI.

Returns:
a string with the PROVIDER_URL value.

findResource

public java.net.URL findResource(java.lang.String name)
Finds the resource with the specified name on the URL search path.
If resource is not found locally, search on the remote side.

Overrides:
findResource in class java.net.URLClassLoader
Parameters:
name - the name of the resource
Returns:
a URL for the resource, or null if the resource could not be found.


Copyright © 2006-2007 OW2 Consortium. All Rights Reserved.