org.wcb.autohome.factories
Class DeviceFactory

java.lang.Object
  extended byorg.wcb.autohome.factories.DeviceFactory
All Implemented Interfaces:
IDeviceRemote, X10DeviceConstants

public class DeviceFactory
extends java.lang.Object
implements IDeviceRemote, X10DeviceConstants

Project: Alice X10 Home Automation Filename: $Id: DeviceFactory.java,v 1.17 2004/02/25 21:38:36 wbogaardt Exp $ Abstract: Centralized backend for various components to send events to Serial port output. This mostly handles reading from a file and writting to a file the various user entries such as devices and macros for latter retrieval. $Log: DeviceFactory.java,v $ Revision 1.17 2004/02/25 21:38:36 wbogaardt added javadocs and fixed formating for checkstyle report Revision 1.16 2004/02/03 21:02:27 wbogaardt moved DeviceFactory away from rmi creation and simplified interface between gateway Revision 1.15 2004/01/17 08:15:46 wbogaardt Have an initial working monitoring frame that actually shows the date and time an event takes place Revision 1.14 2004/01/17 07:21:17 wbogaardt added serialization to run events and allow monitoring of these events to the file system to reload later Revision 1.13 2004/01/16 00:53:43 wbogaardt Fixed a very obscure bug with the Macro Panel that it didn't added new x10 devices to the drop down of available x10 device for the macro. Modified Macro triggers to change the events to integer verses strings cleaner this way. Revision 1.12 2003/12/24 20:24:20 wbogaardt Fixed display of console message on start up Revision 1.11 2003/12/20 21:32:39 wbogaardt enabled new file menu option and added functionality Revision 1.10 2003/12/16 22:08:37 wbogaardt refactored events daemon handeling Revision 1.9 2003/12/12 23:17:36 wbogaardt javadoc comments refactored methods so they are more descriptive Revision 1.8 2003/12/09 23:11:42 wbogaardt C: ---------------------------------------------------------------------- Revision 1.7 2003/12/08 21:57:24 wbogaardt refactored out properties loading for old x10 format Revision 1.6 2003/12/08 21:35:18 wbogaardt refactored out old methods of saving macros and modules Revision 1.5 2003/12/08 21:09:04 wbogaardt refactored old method signatures improved error handeling on windows Revision 1.4 2003/12/06 00:41:53 wbogaardt deprecated some method calls Revision 1.3 2003/10/10 21:39:07 wbogaardt modified macro triggers to use calendar in stead of strings Revision 1.2 2003/10/10 18:39:12 wbogaardt changed date time information from a string to a calendar object

Version:
1.0
Author:
wbogaardt

Field Summary
 
Fields inherited from interface org.wcb.autohome.interfaces.X10DeviceConstants
APPLIANCE_MODULE_OFF, APPLIANCE_MODULE_ON, BAUD, BAUD_RATE_ARRAY, BRIGHT_ACTION, BROWSER, CM11A_TRANSMITTER, CM17A_TRANSMITTER, CONNECT_ON_START, COUNTRY, DATA_BIT, DATA_BITS_ARRAY, DEVICE_ARRAY, DIM_ACTION, EMAIL_AUTHORIZE, EMAIL_FREQUENCY, EMAIL_FROM, EMAIL_PASSWORD, EMAIL_SMTP, EMAIL_TO, EMAIL_USERNAME, FALSE, HOUSE_CODES_ARRAY, INTERFACE_TYPE, LAMP_MODULE_OFF, LAMP_MODULE_ON, LANGUAGE, LAST_FILE, LOCALHOST, LOOK_AND_FEEL, MAC, METAL, MOTIF, OFF_ACTION, ON_ACTION, PARITY, PARITY_ARRAY, RECOVER_CM11A, RMI_HOST, SEPARATOR, SERIAL_PORT, SPEECH_ENGINE, STOP_BIT, STOP_BITS_ARRAY, TEST_TRANSMITTER, TIMER_EVENT, TRIGGER_EVENT, TRUE, USER_HOME, WINDOWS
 
Constructor Summary
DeviceFactory()
          Default Consturctor
 
Method Summary
 void createNewFile()
          Create a new file such as when the user select File->new
 void deleteMacro(IMacro macro)
          Moved saving macro information in the hash table
 void loadFile(java.lang.String sfilename)
          This new method takes in an Array of Vectors and assigns them to the appropriate Vector Array so that other objects can access these Vectors.
 java.util.Vector loadMacroTriggers()
          Load the Macro item triggers.
 java.util.Vector readInAliceMonitors()
          Loads the alice monitors and returns them as a vector to the application
 java.util.Vector readInX10Devices()
          Returns a list of X10Devices saved in the file.
 java.util.Vector readInX10Events()
          Returns a vector of IX10Events which are specific to the Alice environment.
 java.util.Vector readInX10Macros()
          Reads from the hash the serialized objects as a Vector of IX10Macro.
 boolean saveFile(java.lang.String sfileName)
          Saves all of the module information to the user selected save to file this method is usually called from a save or save as command.
 void saveMacro(IMacro macro)
          Moved saving macro information in the hash table
 void saveMacroTriggers(java.util.Vector items)
          Save the Macro item triggers.
 void writeAliceMonitors(java.util.Vector vList)
          This is used to store the alice monitoring events.
 void writeMacros(java.util.Vector vec)
          Writes the IMacro vector to the array for serialization storage.
 void writeX10Devices(java.util.Vector items)
          Save the vector of IX10Module into a properties Hash table key for quick access and storage;
 void writeX10Events(java.util.Vector items)
          Save the vector list of IX10Events into a Hash table key for quick access and storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeviceFactory

public DeviceFactory()
Default Consturctor

Method Detail

loadFile

public void loadFile(java.lang.String sfilename)
This new method takes in an Array of Vectors and assigns them to the appropriate Vector Array so that other objects can access these Vectors.

Specified by:
loadFile in interface IDeviceRemote
Parameters:
sfilename - an array of Vectors which have serilized objects.

saveFile

public boolean saveFile(java.lang.String sfileName)
Saves all of the module information to the user selected save to file this method is usually called from a save or save as command. This also writes the information to the diskdrive.

Specified by:
saveFile in interface IDeviceRemote
Parameters:
sfileName - Full path and file name
Returns:
true if file saved succesfully

createNewFile

public void createNewFile()
Create a new file such as when the user select File->new

Specified by:
createNewFile in interface IDeviceRemote

readInX10Devices

public java.util.Vector readInX10Devices()
Returns a list of X10Devices saved in the file.

Specified by:
readInX10Devices in interface IDeviceRemote
Returns:
Vector of IX10Module

writeX10Devices

public void writeX10Devices(java.util.Vector items)
Save the vector of IX10Module into a properties Hash table key for quick access and storage;

Specified by:
writeX10Devices in interface IDeviceRemote
Parameters:
items - Vector of IX10Module which are serialized.

readInX10Events

public java.util.Vector readInX10Events()
Returns a vector of IX10Events which are specific to the Alice environment.

Specified by:
readInX10Events in interface IDeviceRemote
Returns:
Vector of IX10Events

writeAliceMonitors

public void writeAliceMonitors(java.util.Vector vList)
This is used to store the alice monitoring events.

Specified by:
writeAliceMonitors in interface IDeviceRemote
Parameters:
vList - list of events

writeX10Events

public void writeX10Events(java.util.Vector items)
Save the vector list of IX10Events into a Hash table key for quick access and storage.

Specified by:
writeX10Events in interface IDeviceRemote
Parameters:
items - Vector of IX10Events, which are serialized.

readInX10Macros

public java.util.Vector readInX10Macros()
Reads from the hash the serialized objects as a Vector of IX10Macro.

Specified by:
readInX10Macros in interface IDeviceRemote
Returns:
Vector of IX10Macr serialized objects default value is an empyt Vector.

readInAliceMonitors

public java.util.Vector readInAliceMonitors()
Loads the alice monitors and returns them as a vector to the application

Specified by:
readInAliceMonitors in interface IDeviceRemote
Returns:
Vector of IX10MonitorEvents, which also have IRunEvents arrays

writeMacros

public void writeMacros(java.util.Vector vec)
Writes the IMacro vector to the array for serialization storage.

Specified by:
writeMacros in interface IDeviceRemote
Parameters:
vec - Vector of IMacros to be serialized

loadMacroTriggers

public java.util.Vector loadMacroTriggers()
Load the Macro item triggers. Thes are events that are handled by the CM11A X10 interface. These triggers are light A1 being turned on or appliance B2 turned off. Trigger are stored as Trigger.1=

Specified by:
loadMacroTriggers in interface IDeviceRemote
Returns:
vector of IMacroTrigger objects.

saveMacroTriggers

public void saveMacroTriggers(java.util.Vector items)
Save the Macro item triggers. Thes are events that are handled by the CM11A X10 interface. These triggers are light A1 being turned on or appliance B2 turned off.

Specified by:
saveMacroTriggers in interface IDeviceRemote
Parameters:
items - vector of IMacroTrigger objects to be serialized.

saveMacro

public void saveMacro(IMacro macro)
Moved saving macro information in the hash table

Specified by:
saveMacro in interface IDeviceRemote
Parameters:
macro - saves a serialized object into the hash.

deleteMacro

public void deleteMacro(IMacro macro)
Moved saving macro information in the hash table

Specified by:
deleteMacro in interface IDeviceRemote
Parameters:
macro - allows removal of IMacro from hash.


Copyright © 1999-2004 Walter Bogaardt. All Rights Reserved.