HowTos Application Architecture

Aus Salespoint

Dies ist eine alte Version. Zeitpunkt der Bearbeitung: 20:58, 19. Jul. 2010 durch 173.212.206.186 (Diskussion).
Wechseln zu: Navigation, Suche

Nk39ga <a href="http://zgrzbgbheyof.com/">zgrzbgbheyof</a>, [url=http://zdhwbxjcxomx.com/]zdhwbxjcxomx[/url], [link=http://whfxahwwqsmu.com/]whfxahwwqsmu[/link], http://ikfuefkoyxfk.com/

comment5, http://dating-tuy.co.cc/znakomstva-seversk/page_578.html äåâîøêà ñåêñà, ivg,

comment5, http://meeteng-rsr.co.cc/znakomstva-vebkameroy/page-571.html çíàêîìñòâà ãåè ëèïåöê, fuwuq,

Inhaltsverzeichnis

Time Management

Incorporate a Timer

Description: A Timer is able to manage the current time in your application. A Timer needs a Time Object to be referenced on. If you want to react to different TimerEvents, you will have to incorporate a TimerListener. Time management in SalesPoint Framework is abutted on several Java classes:
java.util.Calendar
java.util.GregorianCalendar
java.util.Timer
java.util.TimerTask
java.util.TimeZone
java.sql.TimeStamp

ToDo:

  1. Create a new instance of Time. In this case CalendarTime is used. Set the time interval.
  2. Create a new instance of Timer. In this case AutoTimer is used.
  3. If you need, add a TimerListener and add the methods the class must inherit from the base class. Add your code to react to the events.
  4. Finally start the timer.

Example Source Code:

1
// initialize with current system time and increase time by second
CalendarTime calendarTime = new CalendarTime();
calendarTime.setTimeToCount(CalendarTime.SECOND);
 
2
// initialize Timer with CalendarTime and 992ms delay from step to step
(1000ms are too much, because the autotimer is delayed additionally)
AutoTimer autoTimer = new AutoTimer(calendarTime, (long) 992);
 
3
// if it becomes more complicate it will be clearer to realize
a subclass of TimerAdapter or to implement TimerListener
autoTimer.addTimerListener(new TimerListener()
{
public void onGoneAhead(TimerEvent timerEvent)
{
System.out.println(timerEvent.getTime());
}
 
public void onTimeSet(TimerEvent timerEvent)
{
 
}
 
public void onIntervalSet(TimerEvent timerEvent)
{
 
}
});
4
// start the timer
autoTimer.start();

Select a time type

Description: A Time Object is used by the Timer. It gives the Timer it´s certain shape. The Time Object defines which time field will be increased by goAhead method of the Timer. Choose the following timer types:

  • Date: "01.01.00" a simple date of the format: "dd.mm.yy".
  • Step: "26" a Long value is used to represent the time.
  • CalendarTime: "Sat Jul 20 15:38:53 CEST 2002" a time which is represented as a Gregorian Calendar.

ToDo:

  1. Create a new instance of Time. In this case CalendarTime is used. Set the time interval.

Example Source Code:

1
// initialize with current system time and increase time by second
CalendarTime calendarTime = new CalendarTime();
calendarTime.setTimeToCount(CalendarTime.SECOND);


Select a timer type

Description: A Timer is able to manage the current time in your application. It is referenced to a Time which gives the Timer it´s shape. Choose of following Timer types:

  • StepTimer: very simple implementation, is increased manually by goAhead() method.
  • AutoTimer: special step timer which inceases automatically with a certain time delay.

ToDo:

  1. Create a new instance of Timer. In this case AutoTimer is used.

Example Source Code:

1
// initialize Timer with CalendarTime and 992ms delay from step to step
(1000ms are too much, because the autotimer is delayed additionally)
AutoTimer autoTimer = new AutoTimer(calendarTime, (long) 992);

Common

Set default Databasket for SalesPoints

Description: This is required if processes executed on a SalesPoint are to run in a specific transactional context. The specified DataBasket will be attached to every process running on the SalesPoint and will determine its transactional context. By default, no DataBasket is attached to a SalesPoint so that processes run outside any transactional context.

ToDo: This can be achieved in several ways. In any case, you need to attach the DataBasket to the SalesPoint:

  1. a. Open the designated Shop class.
    b. Override the protected void onSalesPointAdded() method according to your needs.
  2. a. Open the designated SalesPoint class.
    b. Attach the DataBasket in it's constructor.

Example Source Code:

1 a
public class ArchitectureShop extends Shop
{
.
.
.
1 b
protected void onSalesPointAdded(SalesPoint sp) {
super.onSalesPointAdded(sp);
sp.attach(new DataBasketImpl());
}
 
}


2 a
public class ArchitectureSalesPoint extends SalesPoint
{
.
.
.
2 b
public ArchitectureSalesPoint(String sPointName, DataBasket db) {
super(sPointName);
attach(db);
}
 
}
Persönliche Werkzeuge