Package org.apache.qpid.server.model
Class AbstractConfiguredObject<X extends ConfiguredObject<X>>
- java.lang.Object
-
- org.apache.qpid.server.model.AbstractConfiguredObject<X>
-
- All Implemented Interfaces:
ConfiguredObject<X>
,ContextProvider
,PermissionedObject
,TaskExecutorProvider
- Direct Known Subclasses:
AbstractAccessControlProvider
,AbstractAMQPConnection
,AbstractAMQPSession
,AbstractAuthenticationManager
,AbstractCaseAwareGroupProvider
,AbstractContainer
,AbstractExchange
,AbstractKeyStore
,AbstractNonConnectionAcceptingVirtualHost
,AbstractPluginAdapter
,AbstractPort
,AbstractQueue
,AbstractSystemConfig
,AbstractTrustStore
,AbstractVirtualHost
,AbstractVirtualHostNode
,AllowAllAccessControlProviderImpl
,CloudFoundryDashboardManagementGroupProviderImpl
,DefaultVirtualHostAliasImpl
,GroupImpl
,GroupMemberImpl
,HostNameAliasImpl
,PatternMatchingAliasImpl
,ProducerImpl
,RedirectingVirtualHostNodeImpl
,SystemAddressSpaceAliasImpl
,VirtualHostNameAliasImpl
public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> extends java.lang.Object implements ConfiguredObject<X>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class 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
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SECURED_STRING_VALUE
-
Fields inherited from interface org.apache.qpid.server.model.ConfiguredObject
AWAIT_ATTAINMENT_TIMEOUT, CONTEXT, CREATED_BY, CREATED_TIME, DEFAULT_AWAIT_ATTAINMENT_TIMEOUT, DESCRIPTION, DESIRED_STATE, DURABLE, ID, LAST_UPDATED_BY, LAST_UPDATED_TIME, LIFETIME_POLICY, NAME, OVER_SIZED_ATTRIBUTE_ALTERNATIVE_TEXT, STATE, TYPE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractConfiguredObject(ConfiguredObject<?> parent, java.util.Map<java.lang.String,java.lang.Object> attributes)
protected
AbstractConfiguredObject(ConfiguredObject<?> parent, java.util.Map<java.lang.String,java.lang.Object> attributes, TaskExecutor taskExecutor)
protected
AbstractConfiguredObject(ConfiguredObject<?> parent, java.util.Map<java.lang.String,java.lang.Object> attributes, TaskExecutor taskExecutor, Model model)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChangeListener(ConfigurationChangeListener listener)
Add a listener which will be informed of all changes to this configuration objectprotected <C extends ConfiguredObject>
com.google.common.util.concurrent.ListenableFuture<C>addChildAsync(java.lang.Class<C> childClass, java.util.Map<java.lang.String,java.lang.Object> attributes)
static <V> void
addFutureCallback(com.google.common.util.concurrent.ListenableFuture<V> future, com.google.common.util.concurrent.FutureCallback<V> callback, java.util.concurrent.Executor taskExecutor)
protected void
applyToChildren(Action<ConfiguredObject<?>> action)
ConfiguredObjectRecord
asObjectRecord()
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
attainState()
protected java.lang.String
attributesAsString(java.util.Map<java.lang.String,java.lang.Object> attributes)
protected void
attributeSet(java.lang.String attributeName, java.lang.Object oldAttributeValue, java.lang.Object newAttributeValue)
void
authorise(Operation operation)
void
authorise(Operation operation, java.util.Map<java.lang.String,java.lang.Object> arguments)
void
authorise(SecurityToken token, Operation operation, java.util.Map<java.lang.String,java.lang.Object> arguments)
protected <C extends ConfiguredObject<?>>
voidauthoriseCreateChild(java.lang.Class<C> childClass, java.util.Map<java.lang.String,java.lang.Object> attributes)
protected <C extends ConfiguredObject>
CawaitChildClassToAttainState(java.lang.Class<C> childClass, java.lang.String name)
protected <C extends ConfiguredObject>
CawaitChildClassToAttainState(java.lang.Class<C> childClass, java.util.UUID id)
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
beforeClose()
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
beforeDelete()
protected void
changeAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
protected void
childAdded(ConfiguredObject<?> child)
protected void
childRemoved(ConfiguredObject<?> child)
void
close()
com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
closeAsync()
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
closeChildren()
void
create()
com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
createAsync()
<C extends ConfiguredObject>
CcreateChild(java.lang.Class<C> childClass, java.util.Map<java.lang.String,java.lang.Object> attributes)
<C extends ConfiguredObject>
com.google.common.util.concurrent.ListenableFuture<C>createChildAsync(java.lang.Class<C> childClass, java.util.Map<java.lang.String,java.lang.Object> attributes)
void
decryptSecrets()
void
delete()
com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
deleteAsync()
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
deleteChildren()
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
deleteNoChecks()
protected AbstractConfiguredObject.ChainedListenableFuture<java.lang.Void>
doAfter(com.google.common.util.concurrent.ListenableFuture<?> first, java.lang.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, java.util.concurrent.Callable<com.google.common.util.concurrent.ListenableFuture<V>> second)
protected static <V,A>
AbstractConfiguredObject.ChainedListenableFuture<V>doAfter(java.util.concurrent.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<java.lang.Void>
doAfter(java.util.concurrent.Executor executor, com.google.common.util.concurrent.ListenableFuture<V> first, java.lang.Runnable second)
protected static <V> AbstractConfiguredObject.ChainedListenableFuture<V>
doAfter(java.util.concurrent.Executor executor, com.google.common.util.concurrent.ListenableFuture<V> first, java.util.concurrent.Callable<com.google.common.util.concurrent.ListenableFuture<V>> second)
protected <V> AbstractConfiguredObject.ChainedListenableFuture<java.lang.Void>
doAfterAlways(com.google.common.util.concurrent.ListenableFuture<V> future, java.lang.Runnable after)
protected static <V> AbstractConfiguredObject.ChainedListenableFuture<java.lang.Void>
doAfterAlways(java.util.concurrent.Executor executor, com.google.common.util.concurrent.ListenableFuture<V> future, java.lang.Runnable after)
protected void
doCreation(boolean skipCheck, org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler)
protected <T,E extends java.lang.Exception>
com.google.common.util.concurrent.ListenableFuture<T>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, java.util.concurrent.TimeUnit units)
protected void
doValidation(boolean skipCheck, org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler)
<Y extends ConfiguredObject<Y>>
YfindConfiguredObject(java.lang.Class<Y> clazz, java.lang.String name)
void
forceUpdateAllSecureAttributes()
protected AccessControl
getAccessControl()
java.util.Map<java.lang.String,java.lang.Object>
getActualAttributes()
Return the map containing only explicitly set attributes<T> T
getAncestor(java.lang.Class<T> clazz)
<C extends ConfiguredObject>
com.google.common.util.concurrent.ListenableFuture<C>getAttainedChildById(java.lang.Class<C> childClass, java.util.UUID id)
<C extends ConfiguredObject>
com.google.common.util.concurrent.ListenableFuture<C>getAttainedChildByName(java.lang.Class<C> childClass, java.lang.String name)
java.lang.Object
getAttribute(java.lang.String name)
Return the value for the given attribute name.java.util.Collection<java.lang.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 occurjava.lang.Class<? extends ConfiguredObject>
getCategoryClass()
<C extends ConfiguredObject>
CgetChildById(java.lang.Class<C> clazz, java.util.UUID id)
<C extends ConfiguredObject>
CgetChildByName(java.lang.Class<C> clazz, java.lang.String name)
TaskExecutor
getChildExecutor()
<C extends ConfiguredObject>
java.util.Collection<C>getChildren(java.lang.Class<C> clazz)
Return children of the ConfiguredObject of the given classjava.util.Map<java.lang.String,java.lang.String>
getContext()
java.util.Set<java.lang.String>
getContextKeys(boolean excludeSystem)
<T> T
getContextValue(java.lang.Class<T> clazz, java.lang.reflect.Type type, java.lang.String propertyName)
<T> T
getContextValue(java.lang.Class<T> clazz, java.lang.String propertyName)
Retrieve and interpolate a context variable of the given name and convert it to the given type.java.lang.String
getCreatedBy()
java.util.Date
getCreatedTime()
java.lang.String
getDescription()
State
getDesiredState()
Get the desired state of the object.java.util.UUID
getId()
Get the universally unique identifier for the objectjava.util.Date
getLastOpenedTime()
java.lang.String
getLastUpdatedBy()
java.util.Date
getLastUpdatedTime()
LifetimePolicy
getLifetimePolicy()
Return the lifetime policy for the objectModel
getModel()
java.lang.String
getName()
Get the name of the objectConfiguredObjectFactory
getObjectFactory()
ConfiguredObject<?>
getParent()
Get the parent of the given type for this objectState
getState()
Get the actual state of the object.java.util.Map<java.lang.String,java.lang.Object>
getStatistics()
Return the statistics for the ConfiguredObjectjava.util.Map<java.lang.String,java.lang.Object>
getStatistics(java.util.List<java.lang.String> statistics)
protected javax.security.auth.Subject
getSubjectWithAddedSystemRights()
protected java.security.Principal
getSystemPrincipal()
protected java.security.AccessControlContext
getSystemTaskControllerContext(java.lang.String taskName, java.security.Principal principal)
protected javax.security.auth.Subject
getSystemTaskSubject(java.lang.String taskName)
protected javax.security.auth.Subject
getSystemTaskSubject(java.lang.String taskName, java.security.Principal principal)
TaskExecutor
getTaskExecutor()
java.lang.String
getType()
java.lang.Class<? extends ConfiguredObject>
getTypeClass()
UserPreferences
getUserPreferences()
protected void
handleExceptionOnOpen(java.lang.RuntimeException e)
boolean
hasEncrypter()
boolean
isDurable()
Returns whether the the object configuration is durably storedprotected boolean
isSystemProcess()
protected boolean
isSystemSubject(javax.security.auth.Subject subject)
protected void
logCreated(java.util.Map<java.lang.String,java.lang.Object> attributes, Outcome outcome)
protected void
logDeleted(Outcome outcome)
protected void
logOperation(java.lang.String operation)
protected void
logRecovered(Outcome outcome)
protected void
logUpdated(java.util.Map<java.lang.String,java.lang.Object> attributes, Outcome outcome)
boolean
managesChildStorage()
SecurityToken
newToken(javax.security.auth.Subject subject)
protected void
notifyStateChanged(State currentState, State desiredState)
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
onClose()
protected void
onCreate()
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
onDelete()
protected void
onExceptionInOpen(java.lang.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<java.lang.Void>
openAsync()
protected void
postResolve()
protected void
postResolveChildren()
protected void
postSetAttributes(java.util.Set<java.lang.String> actualUpdatedAttributes)
void
registerWithParents()
boolean
removeChangeListener(ConfigurationChangeListener listener)
Remove a change listenerjava.lang.String
removeContextVariable(java.lang.String name)
protected boolean
rethrowRuntimeExceptionsOnOpen()
protected <T,E extends java.lang.Exception>
TrunTask(Task<T,E> task)
void
setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
setAttributesAsync(java.util.Map<java.lang.String,java.lang.Object> attributes)
java.lang.String
setContextVariable(java.lang.String name, java.lang.String value)
protected void
setEncrypter(ConfigurationSecretEncrypter encrypter)
protected void
setState(State state)
void
setUserPreferences(UserPreferences userPreferences)
void
start()
com.google.common.util.concurrent.ListenableFuture<java.lang.Void>
startAsync()
void
stop()
java.lang.String
toString()
protected void
updateModel(Model model)
protected void
validateChange(ConfiguredObject<?> proxyForValidation, java.util.Set<java.lang.String> changedAttributes)
protected void
validateChildDelete(ConfiguredObject<?> child)
protected void
validateOnCreate()
-
-
-
Field Detail
-
SECURED_STRING_VALUE
public static final java.lang.String SECURED_STRING_VALUE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractConfiguredObject
protected AbstractConfiguredObject(ConfiguredObject<?> parent, java.util.Map<java.lang.String,java.lang.Object> attributes)
-
AbstractConfiguredObject
protected AbstractConfiguredObject(ConfiguredObject<?> parent, java.util.Map<java.lang.String,java.lang.Object> attributes, TaskExecutor taskExecutor)
-
AbstractConfiguredObject
protected AbstractConfiguredObject(ConfiguredObject<?> parent, java.util.Map<java.lang.String,java.lang.Object> attributes, TaskExecutor taskExecutor, Model model)
-
-
Method Detail
-
updateModel
protected final void updateModel(Model model)
-
open
public final void open()
- Specified by:
open
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
openAsync
public final com.google.common.util.concurrent.ListenableFuture<java.lang.Void> openAsync()
- Specified by:
openAsync
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
doOnConfigThread
protected final <T,E extends java.lang.Exception> com.google.common.util.concurrent.ListenableFuture<T> doOnConfigThread(Task<com.google.common.util.concurrent.ListenableFuture<T>,E> task)
-
registerWithParents
public void registerWithParents()
-
closeChildren
protected final com.google.common.util.concurrent.ListenableFuture<java.lang.Void> closeChildren()
-
close
public void close()
- Specified by:
close
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
closeAsync
public final com.google.common.util.concurrent.ListenableFuture<java.lang.Void> closeAsync()
- Specified by:
closeAsync
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
beforeClose
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void> beforeClose()
-
onClose
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void> onClose()
-
create
public final void create()
-
createAsync
public final com.google.common.util.concurrent.ListenableFuture<java.lang.Void> createAsync()
-
validateOnCreate
protected void validateOnCreate()
-
rethrowRuntimeExceptionsOnOpen
protected boolean rethrowRuntimeExceptionsOnOpen()
-
handleExceptionOnOpen
protected final void handleExceptionOnOpen(java.lang.RuntimeException e)
-
onExceptionInOpen
protected void onExceptionInOpen(java.lang.RuntimeException e)
Callback method to perform ConfiguredObject specific exception handling on exception in open.The method is not expected to throw any runtime exception.
- Parameters:
e
- open exception
-
doOpening
protected final void doOpening(boolean skipCheck, org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler)
-
doValidation
protected final void doValidation(boolean skipCheck, org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler)
-
doResolution
protected final void doResolution(boolean skipCheck, org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler)
-
postResolveChildren
protected void postResolveChildren()
-
postResolve
protected void postResolve()
-
doCreation
protected final void doCreation(boolean skipCheck, org.apache.qpid.server.model.AbstractConfiguredObject.AbstractConfiguredObjectExceptionHandler exceptionHandler)
-
applyToChildren
protected void applyToChildren(Action<ConfiguredObject<?>> action)
-
onValidate
public void onValidate()
Validation performed for configured object creation and opening.- Throws:
IllegalConfigurationException
- indicates invalid configuration
-
setEncrypter
protected final void setEncrypter(ConfigurationSecretEncrypter encrypter)
-
onResolve
protected void onResolve()
-
onOpen
protected void onOpen()
-
attainState
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void> attainState()
-
onCreate
protected void onCreate()
-
getId
public final java.util.UUID getId()
Description copied from interface:ConfiguredObject
Get the universally unique identifier for the object- Specified by:
getId
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Returns:
- the objects id
-
getName
public final java.lang.String getName()
Description copied from interface:ConfiguredObject
Get the name of the object- Specified by:
getName
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Specified by:
getName
in interfacePermissionedObject
- Returns:
- the name of the object
-
isDurable
public final boolean isDurable()
Description copied from interface:ConfiguredObject
Returns whether the the object configuration is durably stored- Specified by:
isDurable
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Returns:
- the durability
-
getObjectFactory
public final ConfiguredObjectFactory getObjectFactory()
- Specified by:
getObjectFactory
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getModel
public final Model getModel()
- Specified by:
getModel
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getCategoryClass
public java.lang.Class<? extends ConfiguredObject> getCategoryClass()
- Specified by:
getCategoryClass
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Specified by:
getCategoryClass
in interfacePermissionedObject
-
getTypeClass
public java.lang.Class<? extends ConfiguredObject> getTypeClass()
- Specified by:
getTypeClass
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
managesChildStorage
public boolean managesChildStorage()
- Specified by:
managesChildStorage
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getContext
public java.util.Map<java.lang.String,java.lang.String> getContext()
- Specified by:
getContext
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getDesiredState
public State getDesiredState()
Description copied from interface:ConfiguredObject
Get the desired state of the object. This is the state set at the object itself, however the object may not be able attain this state if one of its ancestors is in a different state (in particular a descendant object may not be ACTIVE if all of its ancestors are not also ACTIVE).- Specified by:
getDesiredState
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Returns:
- the desired state of the object
-
validateChildDelete
protected void validateChildDelete(ConfiguredObject<?> child)
-
getState
public State getState()
Description copied from interface:ConfiguredObject
Get the actual state of the object. This state is derived from the desired state of the object itself and the actual state of its parents. If an object "desires" to be ACTIVE, but one of its parents is STOPPED, then the actual state of the object will be STOPPED- Specified by:
getState
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Returns:
- the actual state of the object
-
setState
protected void setState(State state)
-
addChangeListener
public void addChangeListener(ConfigurationChangeListener listener)
Description copied from interface:ConfiguredObject
Add a listener which will be informed of all changes to this configuration object- Specified by:
addChangeListener
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Parameters:
listener
- the listener to add
-
removeChangeListener
public boolean removeChangeListener(ConfigurationChangeListener listener)
Description copied from interface:ConfiguredObject
Remove a change listener- Specified by:
removeChangeListener
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Parameters:
listener
- the listener to remove- Returns:
- true iff a listener was removed
-
childAdded
protected final void childAdded(ConfiguredObject<?> child)
-
childRemoved
protected final void childRemoved(ConfiguredObject<?> child)
-
attributeSet
protected void attributeSet(java.lang.String attributeName, java.lang.Object oldAttributeValue, java.lang.Object newAttributeValue)
-
getAttribute
public final java.lang.Object getAttribute(java.lang.String name)
Description copied from interface:ConfiguredObject
Return the value for the given attribute name. The actual attribute value is returned if the configured object has such attribute set. If not, the value is looked default attributes.- Specified by:
getAttribute
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Parameters:
name
- the name of the attribute- Returns:
- the value of the attribute at the object (or null if the attribute value is set neither on object itself no in defaults)
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescription
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getLifetimePolicy
public LifetimePolicy getLifetimePolicy()
Description copied from interface:ConfiguredObject
Return the lifetime policy for the object- Specified by:
getLifetimePolicy
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Returns:
- the lifetime policy
-
getActualAttributes
public final java.util.Map<java.lang.String,java.lang.Object> getActualAttributes()
Description copied from interface:ConfiguredObject
Return the map containing only explicitly set attributes- Specified by:
getActualAttributes
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Returns:
- the map with the attributes
-
getParent
public ConfiguredObject<?> getParent()
Description copied from interface:ConfiguredObject
Get the parent of the given type for this object- Specified by:
getParent
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Returns:
- the objects parent
-
getAncestor
public final <T> T getAncestor(java.lang.Class<T> clazz)
-
getAttributeNames
public final java.util.Collection<java.lang.String> getAttributeNames()
Description copied from interface:ConfiguredObject
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- Specified by:
getAttributeNames
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Returns:
- the collection of attribute names
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
asObjectRecord
public final ConfiguredObjectRecord asObjectRecord()
- Specified by:
asObjectRecord
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
createChild
public <C extends ConfiguredObject> C createChild(java.lang.Class<C> childClass, java.util.Map<java.lang.String,java.lang.Object> attributes)
- Specified by:
createChild
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
createChildAsync
public <C extends ConfiguredObject> com.google.common.util.concurrent.ListenableFuture<C> createChildAsync(java.lang.Class<C> childClass, java.util.Map<java.lang.String,java.lang.Object> attributes)
- Specified by:
createChildAsync
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
addChildAsync
protected <C extends ConfiguredObject> com.google.common.util.concurrent.ListenableFuture<C> addChildAsync(java.lang.Class<C> childClass, java.util.Map<java.lang.String,java.lang.Object> attributes)
-
stop
public final void stop()
-
delete
public final void delete()
- Specified by:
delete
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
doSync
protected final <R> R doSync(com.google.common.util.concurrent.ListenableFuture<R> async)
-
doSync
protected final <R> R doSync(com.google.common.util.concurrent.ListenableFuture<R> async, long timeout, java.util.concurrent.TimeUnit units) throws java.util.concurrent.TimeoutException
- Throws:
java.util.concurrent.TimeoutException
-
deleteAsync
public final com.google.common.util.concurrent.ListenableFuture<java.lang.Void> deleteAsync()
- Specified by:
deleteAsync
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
deleteNoChecks
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void> deleteNoChecks()
-
deleteChildren
protected final com.google.common.util.concurrent.ListenableFuture<java.lang.Void> deleteChildren()
-
beforeDelete
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void> beforeDelete()
-
onDelete
protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void> onDelete()
-
start
public final void start()
-
startAsync
public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> startAsync()
-
getChildById
public final <C extends ConfiguredObject> C getChildById(java.lang.Class<C> clazz, java.util.UUID id)
- Specified by:
getChildById
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getChildByName
public final <C extends ConfiguredObject> C getChildByName(java.lang.Class<C> clazz, java.lang.String name)
- Specified by:
getChildByName
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getChildren
public <C extends ConfiguredObject> java.util.Collection<C> getChildren(java.lang.Class<C> clazz)
Description copied from interface:ConfiguredObject
Return children of the ConfiguredObject of the given class- Specified by:
getChildren
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Parameters:
clazz
- the class of the children to return- Returns:
- the children
-
getAttainedChildByName
public <C extends ConfiguredObject> com.google.common.util.concurrent.ListenableFuture<C> getAttainedChildByName(java.lang.Class<C> childClass, java.lang.String name)
- Specified by:
getAttainedChildByName
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getAttainedChildById
public <C extends ConfiguredObject> com.google.common.util.concurrent.ListenableFuture<C> getAttainedChildById(java.lang.Class<C> childClass, java.util.UUID id)
- Specified by:
getAttainedChildById
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getTaskExecutor
public final TaskExecutor getTaskExecutor()
- Specified by:
getTaskExecutor
in interfaceTaskExecutorProvider
-
getChildExecutor
public TaskExecutor getChildExecutor()
- Specified by:
getChildExecutor
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
runTask
protected final <T,E extends java.lang.Exception> T runTask(Task<T,E> task) throws E extends java.lang.Exception
- Throws:
E extends java.lang.Exception
-
setAttributes
public void setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes) throws java.lang.IllegalStateException, java.security.AccessControlException, java.lang.IllegalArgumentException
- Specified by:
setAttributes
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Throws:
java.lang.IllegalStateException
java.security.AccessControlException
java.lang.IllegalArgumentException
-
postSetAttributes
protected void postSetAttributes(java.util.Set<java.lang.String> actualUpdatedAttributes)
-
doAfter
protected final AbstractConfiguredObject.ChainedListenableFuture<java.lang.Void> doAfter(com.google.common.util.concurrent.ListenableFuture<?> first, java.lang.Runnable second)
-
doAfter
protected static <V> AbstractConfiguredObject.ChainedListenableFuture<java.lang.Void> doAfter(java.util.concurrent.Executor executor, com.google.common.util.concurrent.ListenableFuture<V> first, java.lang.Runnable second)
-
doAfter
protected final <V> AbstractConfiguredObject.ChainedListenableFuture<V> doAfter(com.google.common.util.concurrent.ListenableFuture<V> first, java.util.concurrent.Callable<com.google.common.util.concurrent.ListenableFuture<V>> second)
-
doAfter
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)
-
doAfter
protected static <V> AbstractConfiguredObject.ChainedListenableFuture<V> doAfter(java.util.concurrent.Executor executor, com.google.common.util.concurrent.ListenableFuture<V> first, java.util.concurrent.Callable<com.google.common.util.concurrent.ListenableFuture<V>> second)
-
doAfter
protected static <V,A> AbstractConfiguredObject.ChainedListenableFuture<V> doAfter(java.util.concurrent.Executor executor, com.google.common.util.concurrent.ListenableFuture<A> first, AbstractConfiguredObject.CallableWithArgument<com.google.common.util.concurrent.ListenableFuture<V>,A> second)
-
doAfterAlways
protected <V> AbstractConfiguredObject.ChainedListenableFuture<java.lang.Void> doAfterAlways(com.google.common.util.concurrent.ListenableFuture<V> future, java.lang.Runnable after)
-
doAfterAlways
protected static <V> AbstractConfiguredObject.ChainedListenableFuture<java.lang.Void> doAfterAlways(java.util.concurrent.Executor executor, com.google.common.util.concurrent.ListenableFuture<V> future, java.lang.Runnable after)
-
addFutureCallback
public static <V> void addFutureCallback(com.google.common.util.concurrent.ListenableFuture<V> future, com.google.common.util.concurrent.FutureCallback<V> callback, java.util.concurrent.Executor taskExecutor)
-
setAttributesAsync
public com.google.common.util.concurrent.ListenableFuture<java.lang.Void> setAttributesAsync(java.util.Map<java.lang.String,java.lang.Object> attributes) throws java.lang.IllegalStateException, java.security.AccessControlException, java.lang.IllegalArgumentException
- Specified by:
setAttributesAsync
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Throws:
java.lang.IllegalStateException
java.security.AccessControlException
java.lang.IllegalArgumentException
-
forceUpdateAllSecureAttributes
public void forceUpdateAllSecureAttributes()
-
changeAttributes
protected void changeAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
-
validateChange
protected void validateChange(ConfiguredObject<?> proxyForValidation, java.util.Set<java.lang.String> changedAttributes)
-
authoriseCreateChild
protected final <C extends ConfiguredObject<?>> void authoriseCreateChild(java.lang.Class<C> childClass, java.util.Map<java.lang.String,java.lang.Object> attributes) throws java.security.AccessControlException
- Throws:
java.security.AccessControlException
-
authorise
public final void authorise(Operation operation) throws java.security.AccessControlException
- Specified by:
authorise
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Throws:
java.security.AccessControlException
-
authorise
public final void authorise(Operation operation, java.util.Map<java.lang.String,java.lang.Object> arguments) throws java.security.AccessControlException
- Specified by:
authorise
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Throws:
java.security.AccessControlException
-
authorise
public final void authorise(SecurityToken token, Operation operation, java.util.Map<java.lang.String,java.lang.Object> arguments) throws java.security.AccessControlException
- Specified by:
authorise
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Throws:
java.security.AccessControlException
-
newToken
public final SecurityToken newToken(javax.security.auth.Subject subject)
- Specified by:
newToken
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getSystemPrincipal
protected java.security.Principal getSystemPrincipal()
-
getSubjectWithAddedSystemRights
protected final javax.security.auth.Subject getSubjectWithAddedSystemRights()
-
getSystemTaskControllerContext
protected final java.security.AccessControlContext getSystemTaskControllerContext(java.lang.String taskName, java.security.Principal principal)
-
getSystemTaskSubject
protected javax.security.auth.Subject getSystemTaskSubject(java.lang.String taskName)
-
getSystemTaskSubject
protected final javax.security.auth.Subject getSystemTaskSubject(java.lang.String taskName, java.security.Principal principal)
-
isSystemProcess
protected final boolean isSystemProcess()
-
isSystemSubject
protected boolean isSystemSubject(javax.security.auth.Subject subject)
-
awaitChildClassToAttainState
protected final <C extends ConfiguredObject> C awaitChildClassToAttainState(java.lang.Class<C> childClass, java.lang.String name)
-
awaitChildClassToAttainState
protected final <C extends ConfiguredObject> C awaitChildClassToAttainState(java.lang.Class<C> childClass, java.util.UUID id)
-
getAccessControl
protected AccessControl getAccessControl()
-
getLastUpdatedBy
public final java.lang.String getLastUpdatedBy()
- Specified by:
getLastUpdatedBy
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getLastUpdatedTime
public final java.util.Date getLastUpdatedTime()
- Specified by:
getLastUpdatedTime
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getCreatedBy
public final java.lang.String getCreatedBy()
- Specified by:
getCreatedBy
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getCreatedTime
public final java.util.Date getCreatedTime()
- Specified by:
getCreatedTime
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getType
public final java.lang.String getType()
- Specified by:
getType
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getStatistics
public java.util.Map<java.lang.String,java.lang.Object> getStatistics()
Description copied from interface:ConfiguredObject
Return the statistics for the ConfiguredObject- Specified by:
getStatistics
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
- Returns:
- the current statistics for the ConfiguredObject
-
getStatistics
public java.util.Map<java.lang.String,java.lang.Object> getStatistics(java.util.List<java.lang.String> statistics)
- Specified by:
getStatistics
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
setContextVariable
public java.lang.String setContextVariable(java.lang.String name, java.lang.String value)
- Specified by:
setContextVariable
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
removeContextVariable
public java.lang.String removeContextVariable(java.lang.String name)
- Specified by:
removeContextVariable
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
findConfiguredObject
public <Y extends ConfiguredObject<Y>> Y findConfiguredObject(java.lang.Class<Y> clazz, java.lang.String name)
- Specified by:
findConfiguredObject
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getContextValue
public final <T> T getContextValue(java.lang.Class<T> clazz, java.lang.String propertyName)
Retrieve and interpolate a context variable of the given name and convert it to the given type. Note that this SHOULD not be called before the model has been resolved (e.g., not in the constructor).- Specified by:
getContextValue
in interfaceContextProvider
- Type Parameters:
T
- the type the interpolated context variable should be converted to- Parameters:
clazz
- the class object of the type the interpolated context variable should be converted topropertyName
- the name of the context variable to retrieve- Returns:
- the interpolated context variable converted to an object of the given type
- Throws:
java.lang.IllegalArgumentException
- if the interpolated context variable cannot be converted to the given type
-
getContextValue
public <T> T getContextValue(java.lang.Class<T> clazz, java.lang.reflect.Type type, java.lang.String propertyName)
- Specified by:
getContextValue
in interfaceContextProvider
-
getContextKeys
public java.util.Set<java.lang.String> getContextKeys(boolean excludeSystem)
- Specified by:
getContextKeys
in interfaceContextProvider
-
hasEncrypter
public boolean hasEncrypter()
- Specified by:
hasEncrypter
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
decryptSecrets
public void decryptSecrets()
- Specified by:
decryptSecrets
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getLastOpenedTime
public final java.util.Date getLastOpenedTime()
- Specified by:
getLastOpenedTime
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
getUserPreferences
public UserPreferences getUserPreferences()
- Specified by:
getUserPreferences
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
setUserPreferences
public void setUserPreferences(UserPreferences userPreferences)
- Specified by:
setUserPreferences
in interfaceConfiguredObject<X extends ConfiguredObject<X>>
-
logOperation
protected void logOperation(java.lang.String operation)
-
logUpdated
protected void logUpdated(java.util.Map<java.lang.String,java.lang.Object> attributes, Outcome outcome)
-
logCreated
protected void logCreated(java.util.Map<java.lang.String,java.lang.Object> attributes, Outcome outcome)
-
logRecovered
protected void logRecovered(Outcome outcome)
-
logDeleted
protected void logDeleted(Outcome outcome)
-
attributesAsString
protected java.lang.String attributesAsString(java.util.Map<java.lang.String,java.lang.Object> attributes)
-
-