Package org.jvnet.hk2.config
Class WriteableView
- java.lang.Object
-
- org.jvnet.hk2.config.WriteableView
-
- All Implemented Interfaces:
InvocationHandler,ConfigView,Transactor
public class WriteableView extends Object implements InvocationHandler, Transactor, ConfigView
A WriteableView is a view of a ConfigBean object that allow access to the setters of the ConfigBean.- Author:
- Jerome Dochez
-
-
Constructor Summary
Constructors Constructor Description WriteableView(ConfigBeanProxy readView)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(Transaction t)Aborts this Transaction, reverting the state<T extends ConfigBeanProxy>
TallocateProxy(Class<T> type)Allocate a new ConfigBean object as part of the Transaction associated with this configuration object.booleancanCommit(Transaction t)Returns true of this Transaction can be committed on this objectList<PropertyChangeEvent>commit(Transaction t)Commit this Transaction.ConfigBeangetMasterView()ConfigModel.PropertygetProperty(String xmlName)StringgetPropertyValue(String propertyName)<T extends ConfigBeanProxy>
TgetProxy(Class<T> type)<T extends ConfigBeanProxy>
Class<T>getProxyType()Objectgetter(ConfigModel.Property property, Type t)TransactiongetTransaction()Objectinvoke(Object proxy, Method method, Object[] args)booleanjoin(Transaction t)Enter a new Transaction, this method should return false if this object is already enlisted in another transaction, or cannot be enlisted with the passed transaction.voidsetMasterView(ConfigView view)voidsetter(ConfigModel.Property property, Object newValue, Type t)static StringstripMarkers(String s)remove @ or <> eg "@foo" => "foo" or "" => "foo"
-
-
-
Constructor Detail
-
WriteableView
public WriteableView(ConfigBeanProxy readView)
-
-
Method Detail
-
getTransaction
public Transaction getTransaction()
-
invoke
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- Specified by:
invokein interfaceInvocationHandler- Throws:
Throwable
-
getter
public Object getter(ConfigModel.Property property, Type t)
-
setter
public void setter(ConfigModel.Property property, Object newValue, Type t)
-
getProperty
public ConfigModel.Property getProperty(String xmlName)
-
join
public boolean join(Transaction t)
Enter a new Transaction, this method should return false if this object is already enlisted in another transaction, or cannot be enlisted with the passed transaction. If the object returns true, the object is enlisted in the passed transaction and cannot be enlisted in another transaction until either commit or abort has been issued.- Specified by:
joinin interfaceTransactor- Parameters:
t- the transaction to enlist with- Returns:
- true if the enlisting with the passed transaction was accepted, false otherwise
-
canCommit
public boolean canCommit(Transaction t) throws TransactionFailure
Returns true of this Transaction can be committed on this object- Specified by:
canCommitin interfaceTransactor- Parameters:
t- is the transaction to commit, should be the same as the one passed during the join(Transaction t) call.- Returns:
- true if the trsaction commiting would be successful
- Throws:
TransactionFailure- if the changes cannot be validated
-
stripMarkers
public static String stripMarkers(String s)
remove @ or <> eg "@foo" => "foo" or "" => "foo"
-
commit
public List<PropertyChangeEvent> commit(Transaction t) throws TransactionFailure
Commit this Transaction.- Specified by:
commitin interfaceTransactor- Parameters:
t- the transaction commiting.- Returns:
- list of applied property changes
- Throws:
TransactionFailure- if the transaction commit failed
-
abort
public void abort(Transaction t)
Aborts this Transaction, reverting the state- Specified by:
abortin interfaceTransactor- Parameters:
t- the aborting transaction
-
allocateProxy
public <T extends ConfigBeanProxy> T allocateProxy(Class<T> type) throws TransactionFailure
Allocate a new ConfigBean object as part of the Transaction associated with this configuration object. This will eventually be moved to a factory.- Parameters:
type- the request configuration object type- Returns:
- the propertly constructed configuration object
- Throws:
TransactionFailure- if the allocation failed
-
getMasterView
public ConfigBean getMasterView()
- Specified by:
getMasterViewin interfaceConfigView
-
setMasterView
public void setMasterView(ConfigView view)
- Specified by:
setMasterViewin interfaceConfigView
-
getProxyType
public <T extends ConfigBeanProxy> Class<T> getProxyType()
- Specified by:
getProxyTypein interfaceConfigView
-
getProxy
public <T extends ConfigBeanProxy> T getProxy(Class<T> type)
- Specified by:
getProxyin interfaceConfigView
-
-