public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> extends Object implements ConfiguredObject<X>
Modifier and Type | Class and Description |
---|---|
static interface |
AbstractConfiguredObject.CallableWithArgument<V,A> |
static interface |
AbstractConfiguredObject.ChainedListenableFuture<V> |
static class |
AbstractConfiguredObject.ChainedSettableFuture<V> |
static class |
AbstractConfiguredObject.DuplicateIdException |
static class |
AbstractConfiguredObject.DuplicateNameException |
Modifier and Type | Field and Description |
---|---|
static String |
SECURED_STRING_VALUE |
CONTEXT, CREATED_BY, CREATED_TIME, DESCRIPTION, DESIRED_STATE, DURABLE, ID, LAST_UPDATED_BY, LAST_UPDATED_TIME, LIFETIME_POLICY, NAME, OVER_SIZED_ATTRIBUTE_ALTERNATIVE_TEXT, STATE, TYPE
Modifier | Constructor and Description |
---|---|
protected |
AbstractConfiguredObject(Map<Class<? extends ConfiguredObject>,ConfiguredObject<?>> parents,
Map<String,Object> attributes) |
protected |
AbstractConfiguredObject(Map<Class<? extends ConfiguredObject>,ConfiguredObject<?>> parents,
Map<String,Object> attributes,
TaskExecutor taskExecutor) |
protected |
AbstractConfiguredObject(Map<Class<? extends ConfiguredObject>,ConfiguredObject<?>> parents,
Map<String,Object> attributes,
TaskExecutor taskExecutor,
Model model) |
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ConfigurationChangeListener listener)
Add a listener which will be informed of all changes to this configuration object
|
protected <C extends ConfiguredObject> |
addChildAsync(Class<C> childClass,
Map<String,Object> attributes,
ConfiguredObject... otherParents) |
protected void |
applyToChildren(Action<ConfiguredObject<?>> action) |
ConfiguredObjectRecord |
asObjectRecord() |
protected com.google.common.util.concurrent.ListenableFuture<Void> |
attainState() |
protected void |
attributeSet(String attributeName,
Object oldAttributeValue,
Object newAttributeValue) |
protected void |
authoriseCreate(ConfiguredObject<?> object) |
protected <C extends ConfiguredObject<?>> |
authoriseCreateChild(Class<C> childClass,
Map<String,Object> attributes,
ConfiguredObject... otherParents) |
protected void |
authoriseDelete(ConfiguredObject<?> object) |
protected void |
authoriseSetAttributes(ConfiguredObject<?> proxyForValidation,
Set<String> modifiedAttributes) |
protected com.google.common.util.concurrent.ListenableFuture<Void> |
beforeClose() |
protected boolean |
changeAttribute(String name,
Object expected,
Object desired) |
protected void |
changeAttributes(Map<String,Object> attributes) |
protected void |
childAdded(ConfiguredObject<?> child) |
protected void |
childRemoved(ConfiguredObject<?> child) |
void |
close() |
com.google.common.util.concurrent.ListenableFuture<Void> |
closeAsync() |
protected com.google.common.util.concurrent.ListenableFuture<Void> |
closeChildren() |
void |
create() |
com.google.common.util.concurrent.ListenableFuture<Void> |
createAsync() |
<C extends ConfiguredObject> |
createChild(Class<C> childClass,
Map<String,Object> attributes,
ConfiguredObject... otherParents) |
<C extends ConfiguredObject> |
createChildAsync(Class<C> childClass,
Map<String,Object> attributes,
ConfiguredObject... otherParents) |
void |
decryptSecrets() |
void |
delete() |
com.google.common.util.concurrent.ListenableFuture<Void> |
deleteAsync() |
protected void |
deleted() |
protected static <V,A> AbstractConfiguredObject.ChainedListenableFuture<V> |
doAfter(Executor executor,
com.google.common.util.concurrent.ListenableFuture<A> first,
AbstractConfiguredObject.CallableWithArgument<com.google.common.util.concurrent.ListenableFuture<V>,A> second) |
protected static <V> AbstractConfiguredObject.ChainedListenableFuture<V> |
doAfter(Executor executor,
com.google.common.util.concurrent.ListenableFuture<V> first,
Callable<com.google.common.util.concurrent.ListenableFuture<V>> second) |
protected static <V> AbstractConfiguredObject.ChainedListenableFuture<Void> |
doAfter(Executor executor,
com.google.common.util.concurrent.ListenableFuture<V> first,
Runnable second) |
protected AbstractConfiguredObject.ChainedListenableFuture<Void> |
doAfter(com.google.common.util.concurrent.ListenableFuture<?> first,
Runnable second) |
protected <V,A> AbstractConfiguredObject.ChainedListenableFuture<V> |
doAfter(com.google.common.util.concurrent.ListenableFuture<A> first,
AbstractConfiguredObject.CallableWithArgument<com.google.common.util.concurrent.ListenableFuture<V>,A> second) |
protected <V> AbstractConfiguredObject.ChainedListenableFuture<V> |
doAfter(com.google.common.util.concurrent.ListenableFuture<V> first,
Callable<com.google.common.util.concurrent.ListenableFuture<V>> second) |
protected static <V> AbstractConfiguredObject.ChainedListenableFuture<Void> |
doAfterAlways(Executor executor,
com.google.common.util.concurrent.ListenableFuture<V> future,
Runnable after) |
protected <V> AbstractConfiguredObject.ChainedListenableFuture<Void> |
doAfterAlways(com.google.common.util.concurrent.ListenableFuture<V> future,
Runnable after) |
protected void |
doCreation(boolean skipCheck,
org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler) |
protected <T,E extends Exception> |
doOnConfigThread(Task<com.google.common.util.concurrent.ListenableFuture<T>,E> task) |
protected void |
doOpening(boolean skipCheck,
org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler) |
protected void |
doResolution(boolean skipCheck,
org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler) |
protected <R> R |
doSync(com.google.common.util.concurrent.ListenableFuture<R> async) |
protected <R> R |
doSync(com.google.common.util.concurrent.ListenableFuture<R> async,
long timeout,
TimeUnit units) |
protected void |
doValidation(boolean skipCheck,
org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler) |
<Y extends ConfiguredObject<Y>> |
findConfiguredObject(Class<Y> clazz,
String name) |
protected void |
forceUpdateAllSecureAttributes() |
Map<String,Object> |
getActualAttributes()
Return the map containing only explicitly set attributes
|
<C extends ConfiguredObject> |
getAttainedChildById(Class<C> childClass,
UUID id) |
<C extends ConfiguredObject> |
getAttainedChildByName(Class<C> childClass,
String name) |
Object |
getAttribute(String name)
Return the value for the given attribute name.
|
Collection<String> |
getAttributeNames()
Get the names of attributes that are set on this object
Note that the returned collection is correct at the time the method is called, but will not reflect future
additions or removals when they occur
|
Class<? extends ConfiguredObject> |
getCategoryClass() |
<C extends ConfiguredObject> |
getChildById(Class<C> clazz,
UUID id) |
<C extends ConfiguredObject> |
getChildByName(Class<C> clazz,
String name) |
TaskExecutor |
getChildExecutor() |
<C extends ConfiguredObject> |
getChildren(Class<C> clazz)
Return children of the ConfiguredObject of the given class
|
Map<String,String> |
getContext() |
Set<String> |
getContextKeys(boolean excludeSystem) |
<T> T |
getContextValue(Class<T> clazz,
String propertyName) |
<T> T |
getContextValue(Class<T> clazz,
Type type,
String propertyName) |
String |
getCreatedBy() |
long |
getCreatedTime() |
String |
getDescription() |
State |
getDesiredState()
Get the desired state of the object.
|
UUID |
getId()
Get the universally unique identifier for the object
|
long |
getLastOpenedTime() |
String |
getLastUpdatedBy() |
long |
getLastUpdatedTime() |
LifetimePolicy |
getLifetimePolicy()
Return the lifetime policy for the object
|
Model |
getModel() |
String |
getName()
Get the name of the object
|
ConfiguredObjectFactory |
getObjectFactory() |
<T extends ConfiguredObject> |
getParent(Class<T> clazz)
Get the parent of the given type for this object
|
protected SecurityManager |
getSecurityManager() |
State |
getState()
Get the actual state of the object.
|
Map<String,Number> |
getStatistics()
Return the statistics for the ConfiguredObject
|
TaskExecutor |
getTaskExecutor() |
String |
getType() |
Class<? extends ConfiguredObject> |
getTypeClass() |
protected void |
handleExceptionOnOpen(RuntimeException e) |
boolean |
isDurable()
Returns whether the the object configuration is durably stored
|
boolean |
managesChildStorage() |
protected void |
notifyStateChanged(State currentState,
State desiredState) |
protected void |
onClose() |
protected void |
onCreate() |
protected void |
onExceptionInOpen(RuntimeException e)
Callback method to perform ConfiguredObject specific exception handling on exception in open.
|
protected void |
onOpen() |
protected void |
onResolve() |
void |
onValidate()
Validation performed for configured object creation and opening.
|
void |
open() |
com.google.common.util.concurrent.ListenableFuture<Void> |
openAsync() |
protected static Map<Class<? extends ConfiguredObject>,ConfiguredObject<?>> |
parentsMap(ConfiguredObject<?>... parents) |
protected void |
postResolve() |
protected void |
postResolveChildren() |
void |
registerWithParents() |
boolean |
removeChangeListener(ConfigurationChangeListener listener)
Remove a change listener
|
protected boolean |
rethrowRuntimeExceptionsOnOpen() |
protected <T,E extends Exception> |
runTask(Task<T,E> task) |
Object |
setAttribute(String name,
Object expected,
Object desired)
Set the value of an attribute
|
void |
setAttributes(Map<String,Object> attributes) |
com.google.common.util.concurrent.ListenableFuture<Void> |
setAttributesAsync(Map<String,Object> attributes) |
protected void |
setEncrypter(ConfigurationSecretEncrypter encrypter) |
protected void |
setState(State state) |
void |
start() |
com.google.common.util.concurrent.ListenableFuture<Void> |
startAsync() |
void |
stop() |
String |
toString() |
protected void |
validateChange(ConfiguredObject<?> proxyForValidation,
Set<String> changedAttributes) |
protected void |
validateOnCreate() |
public static final String SECURED_STRING_VALUE
protected AbstractConfiguredObject(Map<Class<? extends ConfiguredObject>,ConfiguredObject<?>> parents, Map<String,Object> attributes)
protected AbstractConfiguredObject(Map<Class<? extends ConfiguredObject>,ConfiguredObject<?>> parents, Map<String,Object> attributes, TaskExecutor taskExecutor)
protected AbstractConfiguredObject(Map<Class<? extends ConfiguredObject>,ConfiguredObject<?>> parents, Map<String,Object> attributes, TaskExecutor taskExecutor, Model model)
protected static Map<Class<? extends ConfiguredObject>,ConfiguredObject<?>> parentsMap(ConfiguredObject<?>... parents)
public final void open()
open
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final com.google.common.util.concurrent.ListenableFuture<Void> openAsync()
openAsync
in interface ConfiguredObject<X extends ConfiguredObject<X>>
protected final <T,E extends Exception> com.google.common.util.concurrent.ListenableFuture<T> doOnConfigThread(Task<com.google.common.util.concurrent.ListenableFuture<T>,E> task)
public void registerWithParents()
protected final com.google.common.util.concurrent.ListenableFuture<Void> closeChildren()
public void close()
close
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final com.google.common.util.concurrent.ListenableFuture<Void> closeAsync()
closeAsync
in interface ConfiguredObject<X extends ConfiguredObject<X>>
protected com.google.common.util.concurrent.ListenableFuture<Void> beforeClose()
protected void onClose()
public final void create()
public final com.google.common.util.concurrent.ListenableFuture<Void> createAsync()
protected void validateOnCreate()
protected boolean rethrowRuntimeExceptionsOnOpen()
protected final void handleExceptionOnOpen(RuntimeException e)
protected void onExceptionInOpen(RuntimeException e)
The method is not expected to throw any runtime exception.
e
- open exceptionprotected void doOpening(boolean skipCheck, org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler)
protected final void doValidation(boolean skipCheck, org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler)
protected final void doResolution(boolean skipCheck, org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler)
protected void postResolveChildren()
protected void postResolve()
protected final void doCreation(boolean skipCheck, org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler)
protected void applyToChildren(Action<ConfiguredObject<?>> action)
public void onValidate()
IllegalConfigurationException
- indicates invalid configurationprotected final void setEncrypter(ConfigurationSecretEncrypter encrypter)
protected void onResolve()
protected void onOpen()
protected com.google.common.util.concurrent.ListenableFuture<Void> attainState()
protected void onCreate()
public final UUID getId()
ConfiguredObject
getId
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final String getName()
ConfiguredObject
getName
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final boolean isDurable()
ConfiguredObject
isDurable
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final ConfiguredObjectFactory getObjectFactory()
getObjectFactory
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final Model getModel()
getModel
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public Class<? extends ConfiguredObject> getCategoryClass()
getCategoryClass
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public Class<? extends ConfiguredObject> getTypeClass()
getTypeClass
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public boolean managesChildStorage()
managesChildStorage
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public Map<String,String> getContext()
getContext
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public State getDesiredState()
ConfiguredObject
getDesiredState
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public State getState()
ConfiguredObject
getState
in interface ConfiguredObject<X extends ConfiguredObject<X>>
protected void setState(State state)
public void addChangeListener(ConfigurationChangeListener listener)
ConfiguredObject
addChangeListener
in interface ConfiguredObject<X extends ConfiguredObject<X>>
listener
- the listener to addpublic boolean removeChangeListener(ConfigurationChangeListener listener)
ConfiguredObject
removeChangeListener
in interface ConfiguredObject<X extends ConfiguredObject<X>>
listener
- the listener to removeprotected final void childAdded(ConfiguredObject<?> child)
protected final void childRemoved(ConfiguredObject<?> child)
protected void attributeSet(String attributeName, Object oldAttributeValue, Object newAttributeValue)
public final Object getAttribute(String name)
ConfiguredObject
getAttribute
in interface ConfiguredObject<X extends ConfiguredObject<X>>
name
- the name of the attributepublic String getDescription()
getDescription
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public LifetimePolicy getLifetimePolicy()
ConfiguredObject
getLifetimePolicy
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final Map<String,Object> getActualAttributes()
ConfiguredObject
getActualAttributes
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public Object setAttribute(String name, Object expected, Object desired) throws IllegalStateException, AccessControlException, IllegalArgumentException
ConfiguredObject
setAttribute
in interface ConfiguredObject<X extends ConfiguredObject<X>>
name
- the name of the attribute to be setexpected
- the value the caller believes the attribute currently has (or null if it is expected to be unset)desired
- the desired value for the attribute (or null to unset the attribute)IllegalStateException
- if the attribute cannot be set while the object is in its current stateAccessControlException
- if the caller does not have permission to alter the value of the attributeIllegalArgumentException
- if the provided value is not valid for the given argumentpublic <T extends ConfiguredObject> T getParent(Class<T> clazz)
ConfiguredObject
getParent
in interface ConfiguredObject<X extends ConfiguredObject<X>>
clazz
- the class of parent being asked forpublic final Collection<String> getAttributeNames()
ConfiguredObject
getAttributeNames
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final ConfiguredObjectRecord asObjectRecord()
asObjectRecord
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public <C extends ConfiguredObject> C createChild(Class<C> childClass, Map<String,Object> attributes, ConfiguredObject... otherParents)
createChild
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public <C extends ConfiguredObject> com.google.common.util.concurrent.ListenableFuture<C> createChildAsync(Class<C> childClass, Map<String,Object> attributes, ConfiguredObject... otherParents)
createChildAsync
in interface ConfiguredObject<X extends ConfiguredObject<X>>
protected <C extends ConfiguredObject> com.google.common.util.concurrent.ListenableFuture<C> addChildAsync(Class<C> childClass, Map<String,Object> attributes, ConfiguredObject... otherParents)
public final void stop()
public final void delete()
delete
in interface ConfiguredObject<X extends ConfiguredObject<X>>
protected final <R> R doSync(com.google.common.util.concurrent.ListenableFuture<R> async)
protected final <R> R doSync(com.google.common.util.concurrent.ListenableFuture<R> async, long timeout, TimeUnit units) throws TimeoutException
TimeoutException
public final com.google.common.util.concurrent.ListenableFuture<Void> deleteAsync()
deleteAsync
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final void start()
public com.google.common.util.concurrent.ListenableFuture<Void> startAsync()
protected void deleted()
public final <C extends ConfiguredObject> C getChildById(Class<C> clazz, UUID id)
getChildById
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final <C extends ConfiguredObject> C getChildByName(Class<C> clazz, String name)
getChildByName
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public <C extends ConfiguredObject> Collection<C> getChildren(Class<C> clazz)
ConfiguredObject
getChildren
in interface ConfiguredObject<X extends ConfiguredObject<X>>
clazz
- the class of the children to returnpublic <C extends ConfiguredObject> com.google.common.util.concurrent.ListenableFuture<C> getAttainedChildByName(Class<C> childClass, String name)
getAttainedChildByName
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public <C extends ConfiguredObject> com.google.common.util.concurrent.ListenableFuture<C> getAttainedChildById(Class<C> childClass, UUID id)
getAttainedChildById
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final TaskExecutor getTaskExecutor()
getTaskExecutor
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public TaskExecutor getChildExecutor()
getChildExecutor
in interface ConfiguredObject<X extends ConfiguredObject<X>>
protected final <T,E extends Exception> T runTask(Task<T,E> task) throws E extends Exception
E extends Exception
public void setAttributes(Map<String,Object> attributes) throws IllegalStateException, AccessControlException, IllegalArgumentException
setAttributes
in interface ConfiguredObject<X extends ConfiguredObject<X>>
IllegalStateException
AccessControlException
IllegalArgumentException
protected final AbstractConfiguredObject.ChainedListenableFuture<Void> doAfter(com.google.common.util.concurrent.ListenableFuture<?> first, Runnable second)
protected static <V> AbstractConfiguredObject.ChainedListenableFuture<Void> doAfter(Executor executor, com.google.common.util.concurrent.ListenableFuture<V> first, Runnable second)
protected final <V> AbstractConfiguredObject.ChainedListenableFuture<V> doAfter(com.google.common.util.concurrent.ListenableFuture<V> first, Callable<com.google.common.util.concurrent.ListenableFuture<V>> second)
protected final <V,A> AbstractConfiguredObject.ChainedListenableFuture<V> doAfter(com.google.common.util.concurrent.ListenableFuture<A> first, AbstractConfiguredObject.CallableWithArgument<com.google.common.util.concurrent.ListenableFuture<V>,A> second)
protected static <V> AbstractConfiguredObject.ChainedListenableFuture<V> doAfter(Executor executor, com.google.common.util.concurrent.ListenableFuture<V> first, Callable<com.google.common.util.concurrent.ListenableFuture<V>> second)
protected static <V,A> AbstractConfiguredObject.ChainedListenableFuture<V> doAfter(Executor executor, com.google.common.util.concurrent.ListenableFuture<A> first, AbstractConfiguredObject.CallableWithArgument<com.google.common.util.concurrent.ListenableFuture<V>,A> second)
protected <V> AbstractConfiguredObject.ChainedListenableFuture<Void> doAfterAlways(com.google.common.util.concurrent.ListenableFuture<V> future, Runnable after)
protected static <V> AbstractConfiguredObject.ChainedListenableFuture<Void> doAfterAlways(Executor executor, com.google.common.util.concurrent.ListenableFuture<V> future, Runnable after)
public com.google.common.util.concurrent.ListenableFuture<Void> setAttributesAsync(Map<String,Object> attributes) throws IllegalStateException, AccessControlException, IllegalArgumentException
setAttributesAsync
in interface ConfiguredObject<X extends ConfiguredObject<X>>
IllegalStateException
AccessControlException
IllegalArgumentException
protected void forceUpdateAllSecureAttributes()
protected void validateChange(ConfiguredObject<?> proxyForValidation, Set<String> changedAttributes)
protected final <C extends ConfiguredObject<?>> void authoriseCreateChild(Class<C> childClass, Map<String,Object> attributes, ConfiguredObject... otherParents) throws AccessControlException
AccessControlException
protected final void authoriseCreate(ConfiguredObject<?> object) throws AccessControlException
AccessControlException
protected final void authoriseSetAttributes(ConfiguredObject<?> proxyForValidation, Set<String> modifiedAttributes)
protected final void authoriseDelete(ConfiguredObject<?> object)
protected SecurityManager getSecurityManager()
public final String getLastUpdatedBy()
getLastUpdatedBy
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final long getLastUpdatedTime()
getLastUpdatedTime
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final String getCreatedBy()
getCreatedBy
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final long getCreatedTime()
getCreatedTime
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final String getType()
getType
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public Map<String,Number> getStatistics()
ConfiguredObject
getStatistics
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public <Y extends ConfiguredObject<Y>> Y findConfiguredObject(Class<Y> clazz, String name)
findConfiguredObject
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final <T> T getContextValue(Class<T> clazz, String propertyName)
getContextValue
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public <T> T getContextValue(Class<T> clazz, Type type, String propertyName)
getContextValue
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public Set<String> getContextKeys(boolean excludeSystem)
getContextKeys
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public void decryptSecrets()
decryptSecrets
in interface ConfiguredObject<X extends ConfiguredObject<X>>
public final long getLastOpenedTime()
getLastOpenedTime
in interface ConfiguredObject<X extends ConfiguredObject<X>>
Copyright © 2006–2016 The Apache Software Foundation. All rights reserved.