fr.umlv.corosol.repository.impl
Class DefaultJImplementationRepository

java.lang.Object
  extended by java.lang.ClassLoader
      extended by fr.umlv.corosol.repository.JImplementationRepository
          extended by fr.umlv.corosol.repository.impl.DefaultJImplementationRepository
All Implemented Interfaces:
JObject, JProxyFactory

public class DefaultJImplementationRepository
extends JImplementationRepository

The default implementation of the fr.umlv.corosol.repository.JImplementationRepository interface.

Author:
Christophe Deleray

Nested Class Summary
 
Nested classes/interfaces inherited from class fr.umlv.corosol.repository.JImplementationRepository
JImplementationRepository.Singleton
 
Constructor Summary
DefaultJImplementationRepository()
          The default constructor.
 
Method Summary
 java.lang.Object create(java.lang.Class abstractType)
          Creates the object which is the implementation of the specified abstract type.
 java.lang.Object create(int item)
          Creates the object which implementation is associated with the specified integer.
 java.lang.Object create(java.lang.String item)
          Creates the object which implementation is associated with the specified String.
 JInstruction createInstruction(int opcode)
          Creates the instruction object which the opcode is specified.
 JClass createPrimitiveClass(java.lang.String descriptor)
          Creates a primitive class which descriptor is specified.
 JProxy createProxy(JClassInstance instance)
          Creates a proxy instance for the specified class instance.
 JProxy createProxy(JVMComponent component)
          Creates a proxy instance for the specified component object.
 java.lang.Class findClass(java.lang.String name)
          Finds the specified class.
 java.lang.String getCorosolProperty(java.lang.String key)
          Gets the Corosol property indicated by the specified key.
 void loadProperties(java.util.Properties properties)
          Loads a set of properties (key and element pairs) from the specified property set.
 java.lang.String toString()
          Returns a string representation of this repository.
 
Methods inherited from class fr.umlv.corosol.repository.JImplementationRepository
getInstance, getNativeObject
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultJImplementationRepository

public DefaultJImplementationRepository()
The default constructor.

Method Detail

loadProperties

public void loadProperties(java.util.Properties properties)
Loads a set of properties (key and element pairs) from the specified property set.

Specified by:
loadProperties in class JImplementationRepository
Parameters:
properties - a set of properties

create

public java.lang.Object create(java.lang.Class abstractType)
                        throws java.lang.IllegalArgumentException
Creates the object which is the implementation of the specified abstract type. The concrete implementation class, associated with the specified abstract type, will be found into this repository, and then it will be instantiated.

Specified by:
create in class JImplementationRepository
Parameters:
abstractType - an abstract type
Returns:
the implementation of the specified abstract type
Throws:
java.lang.IllegalArgumentException - if the specified abstract type is unknown by this repository

create

public java.lang.Object create(java.lang.String item)
                        throws java.lang.IllegalArgumentException
Creates the object which implementation is associated with the specified String. The concrete implementation class, associated with the specified String item, will be found into this repository, and then it will be instantiated.

Specified by:
create in class JImplementationRepository
Parameters:
item - a String item associated with a concrete implementation
Returns:
the implementation desgined by the specified String item
Throws:
java.lang.IllegalArgumentException - if the specified String item is unknown by this repository

create

public java.lang.Object create(int item)
                        throws java.lang.IllegalArgumentException
Creates the object which implementation is associated with the specified integer. The concrete implementation class, associated with the specified int item, will be found into this repository, and then it will be instantiated.

Specified by:
create in class JImplementationRepository
Parameters:
item - a int item associated with a concrete implementation
Returns:
the implementation desgined by the specified int item
Throws:
java.lang.IllegalArgumentException - if the specified int item is unknown by this repository

createPrimitiveClass

public JClass createPrimitiveClass(java.lang.String descriptor)
                            throws java.lang.IllegalArgumentException
Creates a primitive class which descriptor is specified.

Specified by:
createPrimitiveClass in class JImplementationRepository
Parameters:
descriptor - a primitive class descriptor
Returns:
a JClass object representing a primitive class
Throws:
java.lang.IllegalArgumentException - if the specified descriptor is not a descriptor for a primitive class or unknown by this repository

createInstruction

public JInstruction createInstruction(int opcode)
                               throws java.lang.IllegalArgumentException
Creates the instruction object which the opcode is specified.

Specified by:
createInstruction in class JImplementationRepository
Parameters:
opcode - the opcode of the instruction to be created
Returns:
a new instruction object
Throws:
java.lang.IllegalArgumentException - if the specified opcode is not a valid opcodea or unknown by this repository

createProxy

public JProxy createProxy(JVMComponent component)
Creates a proxy instance for the specified component object.

Parameters:
component - a JVM component instance
Returns:
a proxy for the specified component

createProxy

public JProxy createProxy(JClassInstance instance)
Creates a proxy instance for the specified class instance.

Parameters:
instance - a class instance allocated in the Corosol heap.
Returns:
a proxy for the specified class instance

findClass

public java.lang.Class findClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Finds the specified class.

Overrides:
findClass in class java.lang.ClassLoader
Parameters:
name - The name of the class
Returns:
The resulting Class object
Throws:
java.lang.ClassNotFoundException - If the class could not be found

getCorosolProperty

public java.lang.String getCorosolProperty(java.lang.String key)
Gets the Corosol property indicated by the specified key.

Specified by:
getCorosolProperty in class JImplementationRepository
Parameters:
key - the name of the Corosol property
Returns:
the string value of the Corosol property, or null if there is no property with that key.

toString

public java.lang.String toString()
Returns a string representation of this repository.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this repository