Log into DBM
Show the sequence diagram for logging into
DBM.
Because the security mechanism of DBM is based on ACL (Access Control List), thus it is a little different from logging into common system.
Because the security mechanism of DBM is based on ACL (Access Control List), thus it is a little different from logging into common system.
Sequence Diagram for Logging Into DBM
Data Backup
Class Diagram
Class Diagram for Data Backup
Description:
The Schedule
class manages the schedule of data backup. The schedule’s behaviors depend on
its state. This is referred as “State Pattern”. Once you pass
proper state to schedule, the schedule will invoke the stored procedure written
by Owen and pass proper arguments to this stored procedure to do data
backup.
It is very complicated to invoke the stored
procedure to perform data backup. For example, the stored procedure has many
arguments. Therefore, it is very convenient to wrap this complex into some
abstract classes so that client may understand it easily and this abstract layer
may also provide flexibility to face requirement changes.
The relevant classes are described as
flowing, and you may see the mimic client code in the later section.
No.
|
Class / Interface
|
Responsibilities |
1.
|
Info
|
Record the needed information about data
backup.
For example, it will record database name,
backup type (Complete, Differential, and Transaction log),
backup destination, and so on.
|
2.
|
Schedule
|
Represent a schedule for MS SQL Server data
backup. After the schedule is configured properly, you may call its execute
method to add a schedule into MS SQL Server.
Each Schedule
object contains Frequency object, Info
object, and State object.
|
3.
|
Frequency
|
Frequency object manages the main arguments
to invoke stored procedure.
In MS SQL Server, the data backup is setup
based on frequency concept. This class abstracts this concept to wrap the
complex of the stored procedure of MS SQL Server.
|
4.
|
State
|
Interface. The root type of the state of the
schedule.
It defines the behaviors of all states.
Schedule object will behaves depending on the State
object it contains.
|
5.
|
RunNowState
|
In this state, data backup command will be
executed immediately.
|
6.
|
OnTimeState
|
Execute data backup at the specified date
and time.
|
7.
|
RecurringState
|
Abstract class that represents a recurring
backup concept.
|
8.
|
DailyState
|
Represent daily backup state of
schedule.
|
9.
|
WeeklyState
|
Represent weekly backup state of
schedule.
|
10.
|
MonthlyState
|
Represent monthly backup state of
schedule.
|
Mimic Client Code
public static void main( String[]
args ) throws Exception {
Schedule schedule = new Schedule( "My Schedule" );
schedule.setDescription( "This is my test back-up schedule!!" );
Info info = new Info();
info.setType( Info.COMPLETE ); // Complete Backup info.setDatabase( "POISC" ); // Database to backup info.setDestination( "POISC_BKUP.dat" ); // Backup file name
schedule.setInfo( info );
// Assign Info to Schedule
// Test 5 backup
types.
runNow( schedule );
onTime( schedule );
daily( schedule );
Weekly( schedule );
Monthly( schedule );
}
private static void runNow(
Schedule schedule ) throws Exception {
schedule.setState( new RunNowState()
);
schedule.execute();
System.out.println(
schedule.getFrequency().toString() );
}
private static void onTime( Schedule schedule ) throws Exception
{
schedule.setState( new
OnTimeState(20030221, 1530) );
schedule.execute();
System.out.println(
schedule.getFrequency().toString() );
}
private static void daily(
Schedule schedule ) throws Exception {
schedule.setState(
new DailyState(20030221, Schedule.Frequency.FI_NONE, 1530) );
schedule.execute();
System.out.println(
schedule.getFrequency().toString() );
}
private static void Weekly(
Schedule schedule ) throws Exception {
int intvls[] = new int[] {
Schedule.Frequency.FI_SUN,
//Schedule.Frequency.FI_MON,
Schedule.Frequency.FI_TUE,
Schedule.Frequency.FI_WED,
//Schedule.Frequency.FI_THU,
Schedule.Frequency.FI_FRI,
//Schedule.Frequency.FI_SAT,
};
schedule.setState(
new WeeklyState(20030221, Schedule.Frequency.FI_NONE, 1530, intvls)
);
schedule.execute();
System.out.println(
schedule.getFrequency().toString() );
}
private static void Monthly(
Schedule schedule ) throws Exception {
schedule.setState(
new MonthlyState(20030221, Schedule.Frequency.FI_NONE, 1530, 5) );
schedule.execute();
System.out.println(
schedule.getFrequency().toString() );
}
|
Export Data
This function lets user to download data
with CSV file format (which can be opened by MicroSfot Excel
Application). User may select data according to several criteria.
We must support date export by 3 criteria:
1) by Lot ID, 2) by Updated Time, and 3) by Record Number. All data query
methods are almost similar; the only different part is the SQL WHERE conditions.
So it is reasonable to have a general abstract class to be the top most class of
all the subclasses.
Class Diagram for Data Export
沒有留言:
張貼留言