Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Rich Ajax Platform
Release 1.2

org.eclipse.rwt.service
Class FileSettingStore


java.lang.Object
  extended by
org.eclipse.rwt.service.FileSettingStore
All Implemented Interfaces:
ISettingStore

public final class FileSettingStore
extends Object
implements ISettingStore

This ISettingStore implementation persists all settings on the file system using Java Properties .

Since:
1.1

Field Summary
static  String FILE_SETTING_STORE_DIR
          This key (value "org.eclipse.rwt.service.FileSettingStore.dir") can be used to configure the working directory for file settings stores.
 
Constructor Summary
FileSettingStore ( File workDir)
          Create a FileSettingStore instance.
 
Method Summary
 void addSettingStoreListener ( SettingStoreListener listener)
          Attaches an SettingStoreListener to this ISettingStore.
  String getAttribute ( String name)
          Returns the attribute stored under the specified name in this ISettingStore, or null if no attribute is stored under that name.
  Enumeration getAttributeNames ()
          Returns an Enumeration of String objects with the names of all attributes in this ISettingStore.
  String getId ()
          Returns the unique identifier of this setting store
 void loadById ( String id)
          Replace the contents of this setting store with all attributes persisted under the given id.
 void removeAttribute ( String name)
          Removes the attribute stored under the specified name from this ISettingStore.
 void removeSettingStoreListener ( SettingStoreListener listener)
          Removes an SettingStoreListener from this ISettingStore.
 void setAttribute ( String name, String value)
          Stores an attribute to this ISettingStore, using the name specified.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_SETTING_STORE_DIR

public static final 
String FILE_SETTING_STORE_DIR
This key (value "org.eclipse.rwt.service.FileSettingStore.dir") can be used to configure the working directory for file settings stores. See RWTFileSettingStoreFactory and WorkbenchFileSettingStoreFactory.

See Also:
Constant Field Values
Constructor Detail

FileSettingStore

public FileSettingStore(
File workDir)
Create a FileSettingStore instance. The store will be initialized with a unique random id and will contain no attributes. Use loadById(String) to initialize an existing store with previously persisted attributes.

Parameters:
workDir - a non-null File instance denoting an existing directory, which will be used by this class persist its settings.
Throws:
NullPointerException - if the argument workDir is null
IllegalArgumentException - if the argument workDir is not a directory
See Also:
loadById(String)
Method Detail

getId

public 
String getId()
Description copied from interface: ISettingStore
Returns the unique identifier of this setting store

Specified by:
getId in interface ISettingStore
Returns:
a non-empty String value; never null

getAttribute

public 
String getAttribute(
String name)
Description copied from interface: ISettingStore
Returns the attribute stored under the specified name in this ISettingStore, or null if no attribute is stored under that name.

Specified by:
getAttribute in interface ISettingStore
Parameters:
name - a non-null String specifying the name of the attribute
Returns:
a String value or null

setAttribute

public void setAttribute(
String name,
                         
String value)
                  throws 
SettingStoreException
Description copied from interface: ISettingStore
Stores an attribute to this ISettingStore, using the name specified. If an attribute with the same name is already stored in that ISettingStore the previous value is replaced.

Any attribute stored to this ISettingStore using this method is considered persisted from that point on.

If the value argument is null, this has the same effect as calling ISettingStore.removeAttribute(String).

SettingStoreListeners attached to this instance will be notified after an attribute has been stored.

Specified by:
setAttribute in interface ISettingStore
Parameters:
name - the name of the attribute; cannot be null
value - the String to store; may be null
Throws:
SettingStoreException - if the load operation failed to complete normally

getAttributeNames

public 
Enumeration getAttributeNames()
Description copied from interface: ISettingStore
Returns an Enumeration of String objects with the names of all attributes in this ISettingStore.

Specified by:
getAttributeNames in interface ISettingStore
Returns:
an Enumeration ; never null

loadById

public void loadById(
String id)
              throws 
SettingStoreException
Description copied from interface: ISettingStore
Replace the contents of this setting store with all attributes persisted under the given id.

The attributes of this setting store before the load operation will remain associated with the old id, but will be removed from this store instance. SettingStoreListeners attached to this store will receive a notification for each removed attribute.

During the load operation this store will be filled with the attributes associated with the new id value. SettingStoreListeners attached to this store will receive a notification for each added attribute.

After the load operation this store will only hold attributes associated with the new id value.

It is important to note that this operation does not create a new setting store, so that listeners still remain associated with the same store instance. Instead the contents of this setting store are replaced with the contents associated with the given id.

Specified by:
loadById in interface ISettingStore
Parameters:
id - a non-null; non-empty; non-whitespace-only String
Throws:
SettingStoreException - if the load operation failed to complete normally

removeAttribute

public void removeAttribute(
String name)
                     throws 
SettingStoreException
Description copied from interface: ISettingStore
Removes the attribute stored under the specified name from this ISettingStore. If no attribute is stored under the specified name, this method does nothing.

SettingStoreListeners attached to this instance will be notified after an attribute has been removed.

Specified by:
removeAttribute in interface ISettingStore
Parameters:
name - the name of the attribute to remove; cannot be null
Throws:
SettingStoreException - if the remove operation failed to complete normally

addSettingStoreListener

public void addSettingStoreListener(
SettingStoreListener listener)
Description copied from interface: ISettingStore
Attaches an SettingStoreListener to this ISettingStore.

Listeners attached to this instance will notified of changes in the store.

Specified by:
addSettingStoreListener in interface ISettingStore
Parameters:
listener - the SettingStoreListener to add; non-null

removeSettingStoreListener

public void removeSettingStoreListener(
SettingStoreListener listener)
Description copied from interface: ISettingStore
Removes an SettingStoreListener from this ISettingStore.

Specified by:
removeSettingStoreListener in interface ISettingStore
Parameters:
listener - the SettingStoreListener to remove; non-null

Eclipse Rich Ajax Platform
Release 1.2

Copyright (c) Innoopract Informationssysteme GmbH and others 2002, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire