com.neeve.server.config
Class SrvConfigAppDescriptor

java.lang.Object
  extended by com.neeve.root.RootObject
      extended by com.neeve.server.config.SrvConfigAppDescriptor

public final class SrvConfigAppDescriptor
extends RootObject

A server application descriptor.

This class describes a server application and supplies methods to persist to and load descriptors from X Platform configuration respositories.

Threading:
This class is not safe for concurrent access by multiple threads.

Method Summary
static SrvConfigAppDescriptor create(String name)
          Create a default app descriptor.
static SrvConfigAppDescriptor create(UtlAddressDescriptor descriptor)
          Create a server app descriptor from an address descriptor object
 void delete(IConfigRepository repo, String serverName)
          Delete a server app descriptor from a configuration repository.
static boolean exists(IConfigRepository repo, String serverName, String name)
          Check if an app is configured in a configuration repository.
static boolean exists(String serverName, String name)
          Check if an app is configured in the default configuration repository.
 boolean getAutoStart()
          Get whether an app's AEP engine should be auto-started by a server.
 String getMainClass()
          Get the name of application's main class.
 String getName()
          Get the name of the app that this descriptor describes.
 Properties getProperties()
          Get the app properties
 String getProperty(String name)
          Get an app property.
static SrvConfigAppDescriptor load(IConfigRepository repo, String serverName, String name)
          Create a server app descriptor from a configuration repository.
static SrvConfigAppDescriptor load(String serverName, String name)
          Create a server app descriptor from the default configuration repository.
static Set<SrvConfigAppDescriptor> loadAll(IConfigRepository repo, String serverName)
          Create descriptors for all server apps under a server in a configuration repository.
static Set<SrvConfigAppDescriptor> loadAll(String serverName)
          Create app descriptors for all apps configured for a server in the default configuration repository.
 void save(IConfigRepository repo, String serverName)
          Save a server app descriptor to a configuration repository.
 void save(String serverName)
          Save a server app descriptor to the default configuration repository.
 SrvConfigAppDescriptor setAutoStart(boolean val)
          Set whether an app's AEP engine should be auto started by a server.
 SrvConfigAppDescriptor setMainClass(String mainClass)
          Set the name of application's main class.
 SrvConfigAppDescriptor setProperties(Properties props)
          Set a set of app properties.
 SrvConfigAppDescriptor setProperty(String name, String val)
          Set an app property.
 String toString()
          Returns a string representation of this object
 
Methods inherited from class com.neeve.root.RootObject
getChecked, getThreaded, getTracer, setChecked, setTracer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getName

public final String getName()
Get the name of the app that this descriptor describes.

Threading:
This method is safe for concurrent access by multiple threads.

setMainClass

public final SrvConfigAppDescriptor setMainClass(String mainClass)
Set the name of application's main class.

Parameters:
mainClass - The name of the main application class.
Returns:
Returns this object for invocation chaining.
Throws:
IllegalArgumentException - Thrown in case the main class name parameter is null.

getMainClass

public final String getMainClass()
Get the name of application's main class.


setAutoStart

public final SrvConfigAppDescriptor setAutoStart(boolean val)
Set whether an app's AEP engine should be auto started by a server.

Returns:
Returns this object for invocation chaining.
Threading:
This method is safe for concurrent access by multiple threads.

This method sets whether an app's AEP machinery should be auto-started by the server when the app is loaded. If set to true, the engine is auto-started after the application is loaded and initialized. Otherwise, the engine is created for the application but not started.


getAutoStart

public final boolean getAutoStart()
Get whether an app's AEP engine should be auto-started by a server.

Threading:
This method is safe for concurrent access by multiple threads.

The default value for this property is true i.e. unless otherwise configured, an app is automatically started by its hosting server when the app is loaded.


setProperty

public final SrvConfigAppDescriptor setProperty(String name,
                                                String val)
Set an app property.

Returns:
Returns this object for invocation chaining.
Threading:
This method is safe for concurrent access by multiple threads.

getProperty

public final String getProperty(String name)
Get an app property.

Threading:
This method is safe for concurrent access by multiple threads.

setProperties

public final SrvConfigAppDescriptor setProperties(Properties props)
Set a set of app properties.

Returns:
Returns this object for invocation chaining.
Threading:
This method is safe for concurrent access by multiple threads.

getProperties

public final Properties getProperties()
Get the app properties

Threading:
This method is safe for concurrent access by multiple threads.

save

public final void save(IConfigRepository repo,
                       String serverName)
                throws ESrvConfigException
Save a server app descriptor to a configuration repository.

Parameters:
repo - The configuration respository to save the descriptor to.
serverName - The server in which to associated the app descriptor.
Throws:
ESrvConfigException - Thrown in case an error in encountered while saving the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

This method saves a server app descriptor to a configuration repository. The descriptor is saved in a format suitable for loading subsequently using any of the load methods offered by this class.


save

public final void save(String serverName)
                throws ESrvConfigException
Save a server app descriptor to the default configuration repository.

Parameters:
serverName - The server in which to associate the app descriptor.
Throws:
ESrvConfigException
Threading:
This method is notsafe for concurrent access by multiple threads.

This method saves a server app descriptor to the default confiiguration respository. The descriptor is saved in a format suitable for loading subsequently using any of the load methods offered in this class.


delete

public final void delete(IConfigRepository repo,
                         String serverName)
                  throws ESrvConfigException
Delete a server app descriptor from a configuration repository.

Parameters:
repo - The configuration respository to delete the descriptor from.
Throws:
ESrvConfigException - Thrown in case an error in encountered while deleting the descriptor.
Threading:
This method is notsafe for concurrent access by multiple threads.

This method permanently deletes an app descriptor from a configuration repository.


toString

public final String toString()
Returns a string representation of this object

Overrides:
toString in class Object

create

public static SrvConfigAppDescriptor create(String name)
Create a default app descriptor.

Parameters:
name - The app name.
Threading:
This method is safe for concurrent access by multiple threads.

create

public static SrvConfigAppDescriptor create(UtlAddressDescriptor descriptor)
Create a server app descriptor from an address descriptor object

Parameters:
descriptor - The address descriptor using which to instantiate the server app descriptor.
Threading:
This method is safe for concurrent access by multiple threads.

This method creates and initializes a server app descriptor from an address descriptor of the following form:

://&...&class=&...


exists

public static boolean exists(IConfigRepository repo,
                             String serverName,
                             String name)
Check if an app is configured in a configuration repository.

Parameters:
repo - The configuration respository to check in.
serverName - The name of the server in which to check for app existence.
name - The name of the app to check for.
Threading:
This method is safe for concurrent access by multiple threads.

exists

public static boolean exists(String serverName,
                             String name)
Check if an app is configured in the default configuration repository.

Parameters:
serverName - The name of the server in which to check for app existence.
name - The name of the app to check for.
Threading:
This method is safe for concurrent access by multiple threads.

load

public static SrvConfigAppDescriptor load(IConfigRepository repo,
                                          String serverName,
                                          String name)
                                   throws ESrvConfigException
Create a server app descriptor from a configuration repository.

Parameters:
repo - The configuration respository to create it from.
serverName - The name of the server to which the app described by this descriptor belongs.
name - The name of the app whose descriptor is to be prepared.
Throws:
ESrvConfigException
Threading:
This method is safe for concurrent access by multiple threads.

This method creates and initializes a server app descriptor from the configuration repository identified by the specified configuration root.


load

public static SrvConfigAppDescriptor load(String serverName,
                                          String name)
                                   throws ESrvConfigException
Create a server app descriptor from the default configuration repository.

Parameters:
serverName - The name of the server to which the app belongs.
name - The name of the app whose descriptor is to be prepared.
Throws:
ESrvConfigException
Threading:
This method is safe for concurrent access by multiple threads.

This method creates and initializes a server app descriptor from the default configuration repository.


loadAll

public static Set<SrvConfigAppDescriptor> loadAll(IConfigRepository repo,
                                                  String serverName)
                                           throws ESrvConfigException
Create descriptors for all server apps under a server in a configuration repository.

Parameters:
repo - The configuration respository from where to create the apps.
serverName - The server whose apps to create descriptors for.
Returns:
Returns the set of app descriptors.

This method creates and initializes app descriptors for each of the apps configured for a server in a configuration repository.

Throws:
ESrvConfigException
Threading:
This method is safe for concurrent access by multiple threads.

loadAll

public static Set<SrvConfigAppDescriptor> loadAll(String serverName)
                                           throws ESrvConfigException
Create app descriptors for all apps configured for a server in the default configuration repository.

Returns:
Returns the set of app descriptors.

This method creates and initializes app descriptors for all the apps configured for a server in the default configuration repository.

Throws:
ESrvConfigException
Threading:
This method is safe for concurrent access by multiple threads.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.