Package com.iizix.app.builder
Class ApplicationDistributor
java.lang.Object
com.iizix.app.builder.ApplicationDistributor
- All Implemented Interfaces:
IAppLoader
,Serializable
- Direct Known Subclasses:
EclipseApplicationDistributor
Class used to produce a distribution of an iiziApp file from module projects. This class is used either from inside Eclipse, or externally from a command line wrapper.
- Author:
- Christopher Mindus
- See Also:
Field Summary
Modifier and TypeFieldDescriptionprotected AppPropCnr
The Application container.static final String
The Jar "Created-By" version = "a.b.c.buildnr (com.iizigo)".protected ServerAppDistributionProps
The distribution property.static final String
The Application distribution file name located under the Module root.protected ModuleProjectPropCnr[]
The modules to process.protected final PropFactory
The property factory to use when creating the distribution, null for the Designer.Constructor Summary
ConstructorDescriptionApplicationDistributor
(PropFactory propFactory, PropMgr propMgr, PluginLoader pluginLoader, ExecutorService executorService, boolean isVerbose) Constructs the application compiler for the target file.Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new operation to the target.protected void
checkCanceled
(Object monitor) Checks if the monitor is canceled.Creates the Jar file.int
createResourceOperations
(Object monitor) Process all resource operations, i.e.void
dispose()
Disposes of the instance when done.getDestinationJar
(File projectDir) Gets the destination Jar file.Gets the parallel loader ExecutorService.The property manager to use when creating the distribution.Initializes the license system because app registration is requested.Initializes the license system because app registration is requested.void
loadApplicationDefinition
(File project) Loads the application definition and all required Modules into memory in Command Line mode.protected <PC extends PropCnr>
PCLoads a property file.Loads a property file.loadFile
(String fileName, InputStream inputStream) Loads a property file.protected void
loadModule
(IIDirectory iidir) Loads the entire Module application using the "Server code" with parallel thread load of all files.loadPlugins
(String names) Loads required plug-in's.void
resolveReferences
(List<String> warnings, List<String> errors) Resolves all references and then checks for property errors.Verifies the Modules.protected void
Ticks units of work from progress.
Field Details
FILENAME
The Application distribution file name located under the Module root.- See Also:
CREATED_BY
The Jar "Created-By" version = "a.b.c.buildnr (com.iizigo)".dist
The distribution property.appCnr
The Application container.modules
The modules to process.propFactory
The property factory to use when creating the distribution, null for the Designer.
Constructor Details
ApplicationDistributor
public ApplicationDistributor(PropFactory propFactory, PropMgr propMgr, PluginLoader pluginLoader, ExecutorService executorService, boolean isVerbose) Constructs the application compiler for the target file.- Parameters:
propFactory
- The Property Factory.propMgr
- The Property Manager.pluginLoader
- The plug-in loader.executorService
- The executor service.isVerbose
- Verbose output.
Method Details
initializeLicenseSystem
Initializes the license system because app registration is requested.- Returns:
- null for success, otherwise an error message. If an error is returned, it has already been logged as a severe error.
initializeLicenseSystem
Initializes the license system because app registration is requested.- Parameters:
licCB
- The license callback, null for none. This parameter is used for the Designer.- Returns:
- null for success, otherwise an error message. If an error is returned, it has already been logged as a severe error.
dispose
public void dispose()Disposes of the instance when done.getPropertyManager
The property manager to use when creating the distribution.- Specified by:
getPropertyManager
in interfaceIAppLoader
loadApplicationDefinition
public void loadApplicationDefinition(File project) throws IOException, PropException, CancelException Loads the application definition and all required Modules into memory in Command Line mode.- Parameters:
project
- The project directory.- Throws:
IOException
- For file errors.PropException
- For property errors.CancelException
- If operation is canceled by user.
getDestinationJar
Gets the destination Jar file.- Parameters:
projectDir
- The project directory.- Returns:
- The absolute file, perhaps resolved from the project directory if the name is relative. null is returned if the Jar file name is not specified!
resolveReferences
Resolves all references and then checks for property errors.The returned list contains the property path in warning/error, a Tab character, then followed by the error message.
- Parameters:
warnings
- Warnings list to fill.errors
- Errors list to fill.
verifyModules
Verifies the Modules. This includes verifying the classpath and dependencies to other non-included Modules in the distribution.- Returns:
- Error message string, or null for OK.
createResourceOperations
Process all resource operations, i.e. directories and file operations.- Parameters:
monitor
- The progress monitor.- Returns:
- The count of resource operations to perform.
- Throws:
FileNotFoundException
- If a file is not found.IOException
- For file errors.CancelException
- If operation is canceled by user.
getExecutorService
Gets the parallel loader ExecutorService.- Specified by:
getExecutorService
in interfaceIAppLoader
loadFile
Loads a property file.- Specified by:
loadFile
in interfaceIAppLoader
- Parameters:
fileName
- The file name for logging.inputStream
- The file input stream.- Returns:
- A Property container.
- Throws:
IOException
- For file errors.PropException
- For property errors.
loadFile
Loads a property file.- Specified by:
loadFile
in interfaceIAppLoader
- Parameters:
file
- The file to load.- Returns:
- A Property container.
- Throws:
IOException
- For file errors.PropException
- For property errors.
loadPlugins
Loads required plug-in's.Each plug-in must have a class called "name.server.Descriptor" that implement the interface
com.iizix.IPluginDescriptor
available.The plug-in definition should be found at the "name/schema/properties.xml", but the iiziGo modules have the "iizigo" module instead of "iizix". To figure out translation of names, a class called "name.server.Descriptor" is loaded and should implement the interface
- Specified by:
loadPlugins
in interfaceIAppLoader
- Parameters:
names
- The plug-in name, e.g. "com.iizigo.db,com.iizigo.term,com.iizigo.ws".- Throws:
IOException
- If a plug-in failed to load.
loadFile
protected <PC extends PropCnr> PC loadFile(IIFile iifile, Class<PC> propClass, Object monitor) throws IOException, PropException Loads a property file.- Parameters:
iifile
- The file to load.- Returns:
- A Property container.
- Throws:
IOException
- For file errors.PropException
- For property errors.
addOperation
Adds a new operation to the target.- Parameters:
op
- The operation.
loadModule
Loads the entire Module application using the "Server code" with parallel thread load of all files.- Parameters:
iidir
- The directory where the Module project is located.- Throws:
IOException
- For file errors.PropException
- For property errors.
createJar
Creates the Jar file.- Parameters:
monitor
- The Eclipse progress monitor, or null for none.- Returns:
- The temp-file for the Jar.
- Throws:
IOException
- For I/O errors.
checkCanceled
Checks if the monitor is canceled.- Parameters:
monitor
- The progress monitor, or null for none.- Throws:
CancelException
- If the operation is canceled.
worked
Ticks units of work from progress.- Parameters:
monitor
- The progress monitor, or null for none.work
- The work units count.