org.lyra
Class Operations

java.lang.Object
  extended by org.lyra.Operations

public class Operations
extends java.lang.Object

Operations is a class which will deal with file operations required of the application. In the cases of hostCreate and hostRemove method also mix in database operations and confirmation.

Version:
1.0.5, %Revision, 174%, %LastChangedDate, 27/10/12 3:33PM%
Author:
Martin Foster

Field Summary
private static int BUFFER
           
private static java.lang.String CLASS
           
private  Ledger Logger
           
 
Constructor Summary
Operations(Ledger logger)
          Primary constructor for class, requires the logger element to be complete.
 
Method Summary
static java.lang.String extractFileExtension(java.io.File path)
          Extracts the dotted file extension from a provided File instance.
static java.lang.String extractFileExtension(java.lang.String name)
          Extracts the dotted file extension from a provided string.
 boolean fileCopy(java.io.File source, java.io.File target)
          Wrapper for a series of instructions which should create a quick and efficient file copy structure.
 boolean fileWrite(java.io.InputStream stream, java.io.File target)
          Wrapper for a series of instructions which should create a quick and efficient file copy structure.
 boolean hostCreate(Comptroller manager, java.util.Map<java.lang.String,java.lang.String> lang, java.util.Map<java.lang.String,java.lang.String> details)
          Host creation requires the transfer of a base database template and changes to the database itself.
 boolean hostRemove(Comptroller manager, java.util.Map<java.lang.String,java.lang.String> lang, java.util.Map<java.lang.String,java.lang.String> details)
          Host removal requires the removal of the separate database file as well as the associated database entry.
 boolean jarCopy(java.lang.String source, java.io.File target)
          Wrapper for a series of instructions which should create a quick and efficient file copy structure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS

private static final java.lang.String CLASS
See Also:
Constant Field Values

BUFFER

private static final int BUFFER
See Also:
Constant Field Values

Logger

private Ledger Logger
Constructor Detail

Operations

public Operations(Ledger logger)
Primary constructor for class, requires the logger element to be complete.

Parameters:
logger - Instance of the Ledger class.
Method Detail

fileCopy

public boolean fileCopy(java.io.File source,
                        java.io.File target)
Wrapper for a series of instructions which should create a quick and efficient file copy structure.

Parameters:
source - File source.
target - File target.
Returns:
Boolean indicating a structure.

jarCopy

public boolean jarCopy(java.lang.String source,
                       java.io.File target)
Wrapper for a series of instructions which should create a quick and efficient file copy structure.

Parameters:
source - String Java Archive resource.
target - File target.
Returns:
Boolean indicating a structure.

fileWrite

public boolean fileWrite(java.io.InputStream stream,
                         java.io.File target)
Wrapper for a series of instructions which should create a quick and efficient file copy structure.

Parameters:
stream - Stream containing contents.
target - File target.
Returns:
Boolean indicating a structure.

hostCreate

public boolean hostCreate(Comptroller manager,
                          java.util.Map<java.lang.String,java.lang.String> lang,
                          java.util.Map<java.lang.String,java.lang.String> details)
Host creation requires the transfer of a base database template and changes to the database itself. Without success on both this operation cannot proceed.

Parameters:
manager - Database comptroller instance.
lang - Map with language elements.
details - Map indicating host details.
Returns:
boolean to indicate success of operation.

hostRemove

public boolean hostRemove(Comptroller manager,
                          java.util.Map<java.lang.String,java.lang.String> lang,
                          java.util.Map<java.lang.String,java.lang.String> details)
Host removal requires the removal of the separate database file as well as the associated database entry.

Parameters:
manager - Database comptroller instance.
lang - Map with language elements.
details - Map indicating host details.
Returns:
boolean to indicate success of operation.

extractFileExtension

public static java.lang.String extractFileExtension(java.lang.String name)
Extracts the dotted file extension from a provided string.

Parameters:
name - Filename.
Returns:
String with extension.

extractFileExtension

public static java.lang.String extractFileExtension(java.io.File path)
Extracts the dotted file extension from a provided File instance.

Parameters:
path - File instance.
Returns:
String with extension.