fr.umlv.corosol.component.impl
Class DefaultJVirtualMachine

java.lang.Object
  extended by fr.umlv.corosol.component.impl.DefaultJVirtualMachine
All Implemented Interfaces:
JObject, JVirtualMachine

public class DefaultJVirtualMachine
extends java.lang.Object
implements JVirtualMachine

The default implementation of the fr.umlv.corosol.component.JVirtualMachine interface.

Author:
Christophe Deleray

Constructor Summary
DefaultJVirtualMachine()
          Creates a new java virtual machine.
 
Method Summary
 JProxy addComponent(JVMComponent component)
          Adds the specified component into the JVM.
 boolean containsComponent(java.lang.Class type)
          Determines if this jvm contains a component of the specified type.
 JProxy getComponent(java.lang.Class type)
          Returns the JVM component of the specified type.
 JVMComponent[] getComponents()
          Returns an array containing all the JVM components.
 java.lang.Object getNativeObject()
          Returns the object equivalent to this object but which belong to the underlaying Virtual Machine.
 void replaceComponent(JVMComponent component)
          Replaces a component into the JVM.
 void startUp(java.lang.String className, java.lang.String[] args)
          Executes the class asociated with the given string name.
 java.lang.String toString()
          Returns a string representation of the JVM.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultJVirtualMachine

public DefaultJVirtualMachine()
Creates a new java virtual machine.

Method Detail

getNativeObject

public java.lang.Object getNativeObject()
Returns the object equivalent to this object but which belong to the underlaying Virtual Machine.


getComponent

public JProxy getComponent(java.lang.Class type)
Returns the JVM component of the specified type.

Specified by:
getComponent in interface JVirtualMachine
Parameters:
type - the type of a JVM component
Returns:
the component of the specified type
Throws:
java.lang.IllegalArgumentException - if the component doesn't exist in the virtual machine

addComponent

public JProxy addComponent(JVMComponent component)
Adds the specified component into the JVM.

Specified by:
addComponent in interface JVirtualMachine
Parameters:
component - a component
Returns:
a proxy of the added component

replaceComponent

public void replaceComponent(JVMComponent component)
Replaces a component into the JVM.

Specified by:
replaceComponent in interface JVirtualMachine
Parameters:
component - a component

containsComponent

public boolean containsComponent(java.lang.Class type)
Determines if this jvm contains a component of the specified type.

Specified by:
containsComponent in interface JVirtualMachine
Parameters:
type - the type of a JVM component
Returns:
true if this jvm contains an component of the specified type, or false otherwise

getComponents

public JVMComponent[] getComponents()
Returns an array containing all the JVM components.

Specified by:
getComponents in interface JVirtualMachine
Returns:
an array containing all the JVM components.

toString

public java.lang.String toString()
Returns a string representation of the JVM.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the JVM

startUp

public void startUp(java.lang.String className,
                    java.lang.String[] args)
             throws java.lang.Throwable
Executes the class asociated with the given string name.

Specified by:
startUp in interface JVirtualMachine
Parameters:
className - the fully qualified name of the desired class
args - the command line arguments
Throws:
java.lang.Throwable - if an exception occurs during execution