Appia Documentation

net.sf.appia.xml
Class Configuration

java.lang.Object
  extended by net.sf.appia.xml.Configuration

public class Configuration
extends java.lang.Object

This class represents a configuration. This configuration is designed to reproduce all the information contained in a XML configuration file or string.

Author:
Jose Mocito

Constructor Summary
Configuration()
          Builds an empty configuration.
Configuration(Appia appia)
          Builds an empty configuration.
 
Method Summary
 void addSession(java.lang.String name, int sharing)
          Adds a new session to the current template.
 void addTemplate(java.lang.String name)
          Adds a new template to the configuration.
 Channel createChannel(java.lang.String name, java.lang.String templateName, java.lang.String label, ChannelProperties params, boolean initialized, EventScheduler eventScheduler, MemoryManager mm, JMXConfiguration jmxConfig, java.lang.String msgFactory)
          Creates a channel based on a chosen template with the given parameters.
 Channel createChannel(java.lang.String name, java.lang.String templateName, java.lang.String label, ChannelProperties params, boolean initialized, MemoryManager mm, boolean managed, java.lang.String msgFactory)
          Creates a channel based on a chosen template with the given parameters.
 void createChannels()
          Creates the channels stored in memory by the storeChannel() method.
 Channel getChannel(java.lang.String name)
          Returns a chosen Channel based on its name.
 Channel[] getChannelList()
          Returns the list of created channels..
 JMXConfiguration getJMXConfiguration()
          Gets the instance of the JMX configuration.
 void printConfig()
          FOR TESTING PURPOSES ONLY!
 void setEventScheduler(java.lang.String className)
          TODO: remove some exceptions!!!
 void setProtocol(java.lang.String protocol)
          Associates a protocol to the last session added.
 void setThreadFactory(java.lang.String className)
           
 void storeChannel(java.lang.String name, java.lang.String templateName, java.lang.String label, ChannelProperties params, boolean initialized, MemoryManager mm, boolean managed, java.lang.String msgFact)
          Stores all the information of a channel.
 void useMultiSchedulers(boolean multiSchedulers)
          Defines the type of event scheduler attribution.
 boolean usesGlobalScheduler()
          Tests if configuration is using a global EventScheduler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration()
Builds an empty configuration.


Configuration

public Configuration(Appia appia)
              throws AppiaXMLException
Builds an empty configuration.

Throws:
AppiaXMLException
Method Detail

useMultiSchedulers

public void useMultiSchedulers(boolean multiSchedulers)

Defines the type of event scheduler attribution.

If multiSchedulers is false, use a global event scheduler.

If multiSchedulers is true, use multiple schedulers.

Parameters:
multiSchedulers - true if using multi schedulers.

usesGlobalScheduler

public boolean usesGlobalScheduler()
Tests if configuration is using a global EventScheduler.

Returns:
true if using a global EventScheduler. False otherwise.

setEventScheduler

public void setEventScheduler(java.lang.String className)
                       throws java.lang.ClassNotFoundException,
                              java.lang.SecurityException,
                              java.lang.NoSuchMethodException,
                              java.lang.IllegalArgumentException,
                              java.lang.InstantiationException,
                              java.lang.IllegalAccessException,
                              java.lang.reflect.InvocationTargetException
TODO: remove some exceptions!!!

Parameters:
className -
Throws:
java.lang.ClassNotFoundException
java.lang.SecurityException
java.lang.NoSuchMethodException
java.lang.IllegalArgumentException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

setThreadFactory

public void setThreadFactory(java.lang.String className)
                      throws java.lang.ClassNotFoundException,
                             java.lang.InstantiationException,
                             java.lang.IllegalAccessException
Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

addTemplate

public void addTemplate(java.lang.String name)
Adds a new template to the configuration.

Parameters:
name - name of the template.

addSession

public void addSession(java.lang.String name,
                       int sharing)
Adds a new session to the current template.

Parameters:
name - the name of the session.
sharing - the kind of sharing.
See Also:
SharingState

setProtocol

public void setProtocol(java.lang.String protocol)
                 throws java.lang.ClassNotFoundException,
                        java.lang.InstantiationException,
                        java.lang.IllegalAccessException
Associates a protocol to the last session added.

Parameters:
protocol - the String description of the protocol.
Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

getJMXConfiguration

public JMXConfiguration getJMXConfiguration()
Gets the instance of the JMX configuration.

Returns:
the JMX configuration.

storeChannel

public void storeChannel(java.lang.String name,
                         java.lang.String templateName,
                         java.lang.String label,
                         ChannelProperties params,
                         boolean initialized,
                         MemoryManager mm,
                         boolean managed,
                         java.lang.String msgFact)
Stores all the information of a channel. The channel instance can be created later with the createChannels() method.

Parameters:
name - the channel name.
templateName - the template name.
label - the String label associated with the channel.
params - the parameters to be passed to their respective sessions.
initialized - whether or not the channel is returned initialized.

createChannels

public void createChannels()
                    throws AppiaXMLException
Creates the channels stored in memory by the storeChannel() method.

Throws:
AppiaXMLException

createChannel

public Channel createChannel(java.lang.String name,
                             java.lang.String templateName,
                             java.lang.String label,
                             ChannelProperties params,
                             boolean initialized,
                             MemoryManager mm,
                             boolean managed,
                             java.lang.String msgFactory)
                      throws AppiaXMLException
Creates a channel based on a chosen template with the given parameters.

Parameters:
name - the channel name.
templateName - the template name.
label - the String label associated with the channel.
params - the parameters to be passed to their respective sessions.
initialized - whether or not the channel is returned initialized.
Returns:
the Channel created.
Throws:
AppiaException
AppiaXMLException
See Also:
ChannelProperties

createChannel

public Channel createChannel(java.lang.String name,
                             java.lang.String templateName,
                             java.lang.String label,
                             ChannelProperties params,
                             boolean initialized,
                             EventScheduler eventScheduler,
                             MemoryManager mm,
                             JMXConfiguration jmxConfig,
                             java.lang.String msgFactory)
                      throws AppiaXMLException
Creates a channel based on a chosen template with the given parameters.
This method should only be used in channels to be associated with a given EventScheduler.

Parameters:
name - the channel name.
templateName - the template name.
label - the String label associated with the channel.
params - the parameters to be passed to their respective sessions.
initialized - whether or not the channel is returned initialized.
eventScheduler - the EventScheduler to use in the channel.
Returns:
the Channel created.
Throws:
AppiaException
AppiaXMLException
See Also:
ChannelProperties

getChannel

public Channel getChannel(java.lang.String name)
Returns a chosen Channel based on its name.

Parameters:
name - the channel's name.
Returns:
the requested Channel or null if it doesn't exist.

getChannelList

public Channel[] getChannelList()
Returns the list of created channels..

Returns:
array containing all the channels created.

printConfig

public void printConfig()
FOR TESTING PURPOSES ONLY!


Appia Documentation

COPYRIGHT 2006-2009, University of Lisbon and INESC-ID
For updates and related information please see Appia Home Page
Send questions, sugestions or remarks to the appia-users mailing list