Class AbstractConfiguredObject<X extends ConfiguredObject<X>>

    • 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)
      • 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()
      • 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)
      • onValidate

        public void onValidate()
        Validation performed for configured object creation and opening.
        Throws:
        IllegalConfigurationException - indicates invalid configuration
      • onResolve

        protected void onResolve()
      • onOpen

        protected void onOpen()
      • attainState

        protected com.google.common.util.concurrent.ListenableFuture<java.lang.Void> attainState()
      • onCreate

        protected void onCreate()
      • 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 interface ConfiguredObject<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 interface ConfiguredObject<X extends ConfiguredObject<X>>
        Returns:
        the actual state of the object
      • setState

        protected void setState​(State state)
      • notifyStateChanged

        protected void notifyStateChanged​(State currentState,
                                          State desiredState)
      • 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 interface ConfiguredObject<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)
      • 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 interface ConfiguredObject<X extends ConfiguredObject<X>>
        Returns:
        the map with the attributes
      • 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 interface ConfiguredObject<X extends ConfiguredObject<X>>
        Returns:
        the collection of attribute names
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • 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()
      • 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
      • 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()
      • 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 interface ConfiguredObject<X extends ConfiguredObject<X>>
        Parameters:
        clazz - the class of the children to return
        Returns:
        the children
      • 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 interface ConfiguredObject<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 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 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)
      • 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 interface ConfiguredObject<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,
                                    java.util.Map<java.lang.String,​java.lang.Object> arguments)
                             throws java.security.AccessControlException
        Specified by:
        authorise in interface ConfiguredObject<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 interface ConfiguredObject<X extends ConfiguredObject<X>>
        Throws:
        java.security.AccessControlException
      • 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)
      • 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 interface ConfiguredObject<X extends ConfiguredObject<X>>
        Returns:
        the current statistics for the ConfiguredObject
      • 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 interface ContextProvider
        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 to
        propertyName - 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 interface ContextProvider
      • getContextKeys

        public java.util.Set<java.lang.String> getContextKeys​(boolean excludeSystem)
        Specified by:
        getContextKeys in interface ContextProvider
      • 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)