Log toegevoegd!
This commit is contained in:
@@ -10,5 +10,6 @@
|
||||
<classpathentry kind="lib" path="lib/TableLayout.jar"/>
|
||||
<classpathentry kind="lib" path="lib/nativecall-0.4.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/nativeloader-200505172341.jar"/>
|
||||
<classpathentry kind="lib" path="cfg"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
1
java/cfg/commons-logging.properties
Normal file
1
java/cfg/commons-logging.properties
Normal file
@@ -0,0 +1 @@
|
||||
#org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
|
||||
29
java/cfg/jlgui.ini
Normal file
29
java/cfg/jlgui.ini
Normal file
@@ -0,0 +1,29 @@
|
||||
allowed_extensions=m3u,pls,wsz,snd,aifc,aif,wav,au,mp1,mp2,mp3,ogg,spx,flac,ape,mac
|
||||
audio_device=
|
||||
equalizer_auto=false
|
||||
equalizer_enabled=false
|
||||
equalizer_on=false
|
||||
last_dir=C:\Users\Rik\Downloads\Skins\
|
||||
last_equalizer=50,50,92,100,10,40,0,100,50,50,50
|
||||
last_playlist=
|
||||
last_skin=C:\Users\Rik\Downloads\Skins\GSM_Winamp_FrostedFlames.wsz
|
||||
last_skin_dir=
|
||||
last_url=
|
||||
origine_x=636
|
||||
origine_y=282
|
||||
playlist_enabled=false
|
||||
playlist_impl=javazoom.jlgui.player.amp.playlist.BasePlaylist
|
||||
proxy_login=
|
||||
proxy_password=
|
||||
proxy_port=-1
|
||||
proxy_server=
|
||||
repeat_enabled=false
|
||||
screen_limit=false
|
||||
shuffle_enabled=false
|
||||
taginfo_ape_impl=javazoom.jlgui.player.amp.tag.APEInfo
|
||||
taginfo_flac_impl=javazoom.jlgui.player.amp.tag.FlacInfo
|
||||
taginfo_mpeg_impl=javazoom.jlgui.player.amp.tag.MpegInfo
|
||||
taginfo_oggvorbis_impl=javazoom.jlgui.player.amp.tag.OggVorbisInfo
|
||||
taginfo_policy=file
|
||||
visual_mode=
|
||||
volume_value=-1
|
||||
5
java/cfg/log4j.properties
Normal file
5
java/cfg/log4j.properties
Normal file
@@ -0,0 +1,5 @@
|
||||
log4j.rootLogger=TRACE, CA
|
||||
log4j.appender.CA=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
|
||||
log4j.logger.org.hibernate=TRACE
|
||||
@@ -2,6 +2,9 @@ package pm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import pm.application.ApplicationCycle;
|
||||
import pm.application.example.ExampleApplication;
|
||||
import pm.application.itunes.iTunesApplication;
|
||||
@@ -24,6 +27,8 @@ import pm.exception.device.DeviceInitialiseException;
|
||||
import pm.value.Action;
|
||||
|
||||
public class Main extends EventListener {
|
||||
protected Log log = LogFactory.getLog(Main.class);
|
||||
|
||||
//protected String[] deviceClassArray;
|
||||
protected ApplicationCycle applicationCycle;
|
||||
protected ArrayList<Device> deviceList;
|
||||
@@ -53,6 +58,7 @@ public class Main extends EventListener {
|
||||
try {
|
||||
device.initialise();
|
||||
device.start();
|
||||
log.info("Device started: " + device);
|
||||
} catch (DeviceInitialiseException e) {
|
||||
remove(device);
|
||||
}
|
||||
|
||||
@@ -3,32 +3,43 @@ package pm.event;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import pm.Event;
|
||||
import pm.Listener;
|
||||
import pm.event.task.Continuous;
|
||||
import pm.value.Action;
|
||||
|
||||
public abstract class EventListener extends Listener implements Runnable {
|
||||
protected Queue<Task> taskQueue;
|
||||
protected Queue<Event> eventQueue;
|
||||
|
||||
public EventListener() {
|
||||
taskQueue = new ConcurrentLinkedQueue<Task>();
|
||||
eventQueue = new ConcurrentLinkedQueue<Event>();
|
||||
}
|
||||
|
||||
public final void run() {
|
||||
while (run) {
|
||||
if (taskQueue.isEmpty()) {
|
||||
if (eventQueue.isEmpty()) {
|
||||
sleep();
|
||||
} else {
|
||||
task(taskQueue.poll());
|
||||
event(eventQueue.poll());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void add(Task task) {
|
||||
taskQueue.add(task);
|
||||
public void add(Event event) {
|
||||
eventQueue.add(event);
|
||||
}
|
||||
|
||||
protected void task(Task task) {
|
||||
protected void event(Event event) {
|
||||
if (event instanceof Feedback) {
|
||||
event((Feedback) event);
|
||||
} else if (event instanceof Task) {
|
||||
event((Task) event);
|
||||
}
|
||||
}
|
||||
|
||||
protected void event(Feedback feedback) {}
|
||||
|
||||
protected void event(Task task) {
|
||||
Action action = task.getAction();
|
||||
if (task instanceof Continuous) {
|
||||
Continuous continuous = (Continuous) task;
|
||||
|
||||
@@ -22,6 +22,12 @@ public class EventManager {
|
||||
taskListenerList.add(eventListener);
|
||||
}
|
||||
|
||||
public static void add(Feedback feedback) {
|
||||
for (EventListener eventListener : taskListenerList) {
|
||||
eventListener.add(feedback);
|
||||
}
|
||||
}
|
||||
|
||||
public static void add(EventListener self, Task task) {
|
||||
if (task instanceof Stopper) {
|
||||
Stopper stopper = (Stopper) task;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
TODO
|
||||
------------
|
||||
log bijhouden
|
||||
|
||||
mappings lezen vanuit config bestand
|
||||
|
||||
exeptions en foutmeldingen nakijken/afhandelen/loggen
|
||||
@@ -39,6 +37,10 @@ feedback systeem implementeren, rumble voor zowel wiimote als rumblepad
|
||||
algemene listener parent class / interface maken? die zou standaard thread functies implementeren / vereisen: start, run, stop
|
||||
+hier zijn al enkele aanpassingen aan gemaakt, de main stuurt nu direct de TaskManager aan in plaats van dat het vannuit een Device of Application gebeurd
|
||||
|
||||
log bijhouden
|
||||
+werkt via apache commons logging, nu nog boodschappen toevoegen!
|
||||
|
||||
|
||||
DONE
|
||||
-------------
|
||||
lantextdevice generiek maken met normale textdevice
|
||||
Reference in New Issue
Block a user