Class ComponentBase

    • Field Detail

      • LOG

        protected static final Logger LOG
      • myBundleContext

        protected org.osgi.framework.BundleContext myBundleContext
    • Constructor Detail

      • ComponentBase

        public ComponentBase()
    • Method Detail

      • getId

        public String getId()
        Description copied from interface: Component
        Return the identifier for this component.
        Specified by:
        getId in interface Component
        Returns:
        a string identifier
      • getTypeId

        public String getTypeId()
        Description copied from interface: Component
        Return the identifier for this components type.
        Specified by:
        getTypeId in interface Component
        Returns:
        a string identifier
      • onStart

        public void onStart()
        Description copied from interface: Component
        Can be implemented by components for attaching logic to a start event.
        Specified by:
        onStart in interface Component
      • internalDoStart

        public final void internalDoStart()
        Call-back method used by the dependency manager.
      • onStop

        public void onStop()
        Description copied from interface: Component
        Can be implemented by components for attaching logic to a stop event.
        Specified by:
        onStop in interface Component
      • internalDoStop

        public final void internalDoStop()
        Call-back method used by the dependency manager.
      • onInit

        public void onInit()
        Description copied from interface: Component
        Can be implemented by components for attaching logic to a init event.
        Specified by:
        onInit in interface Component
      • onDestroy

        public void onDestroy()
        Description copied from interface: Component
        Can be implemented by components for attaching logic to a destroy event.
        Specified by:
        onDestroy in interface Component
      • onInstall

        public void onInstall()
        Description copied from interface: Component
        Can be implemented by components for attaching logic to an install event.
        Specified by:
        onInstall in interface Component
      • onUpdate

        public void onUpdate()
        Description copied from interface: Component
        Can be implemented by components for attaching logic to an update event.
        Specified by:
        onUpdate in interface Component
      • purgeContent

        @Deprecated
        public void purgeContent()
        Deprecated.
        This method is deprecated. Use onPurge() instead.
        Specified by:
        purgeContent in interface Component
      • onPurge

        public boolean onPurge()
        Description copied from interface: Component
        Can be implemented by components for attaching logic to a purge event. Note that the WCB containing the component needs to be ACTIVE in order for the onPurge to be invoked.
        Specified by:
        onPurge in interface Component
        Returns:
        true if the install succeeded, false otherwise. If false is returned, the WCB will not be purged.
      • onUninstall

        public boolean onUninstall()
        Description copied from interface: Component
        Can be implemented by components for attaching logic to an uninstall event Note that the WCB containing the component needs to be ACTIVE in order for the onUninstall to be invoked.
        Specified by:
        onUninstall in interface Component
        Returns:
        true if the uninstallation succeeded, false otherwise. If false is returned, the WCB will not be uninstalled.
      • getComponentDefinition

        public ComponentDefinition getComponentDefinition()
        Description copied from interface: Component
        Returns the definition containing all metadata describing this component.
        Specified by:
        getComponentDefinition in interface Component
        Returns:
        the definition containing all metadata describing this component
      • setComponentDefinition

        public void setComponentDefinition​(ComponentDefinition componentDefinition)
        Description copied from interface: Component
        Set the definition containing all metadata describing this component.
        Specified by:
        setComponentDefinition in interface Component
        Parameters:
        componentDefinition - Definition containing all metadata describing this component
      • getComponentBundle

        public ComponentBundle getComponentBundle()
        Description copied from interface: Component
        Returns the component bundle which contains this component.
        Specified by:
        getComponentBundle in interface Component
        Returns:
        the component bundle which contains this component
      • setComponentBundle

        public void setComponentBundle​(ComponentBundle componentBundle)
        Description copied from interface: Component
        Sets the component bundle which contains this component.
        Specified by:
        setComponentBundle in interface Component
        Parameters:
        componentBundle - Component bundle which contains this component
      • setBundleContext

        public void setBundleContext​(org.osgi.framework.BundleContext bundleContext)
        Description copied from interface: Component
        Sets the context of the OSGi bundle which contains this component.
        Specified by:
        setBundleContext in interface Component
        Parameters:
        bundleContext - Context of the OSGi bundle which contains this component
      • getBundleContext

        public org.osgi.framework.BundleContext getBundleContext()
        Returns the bundle context of the component.
        Returns:
        bundleContext of the component
      • dependencyAdded

        public final void dependencyAdded​(org.osgi.framework.ServiceReference serviceReference,
                                          Object serviceObject)
        This callback method for the dependencyManager adds all available declared dependencies for this component. TODO evaluate this is OK. Note it overwrites any old entries.
        Parameters:
        serviceReference - the serviceReference
        serviceObject - the serviceObject
      • dependencyRemoved

        public final void dependencyRemoved​(org.osgi.framework.ServiceReference serviceReference,
                                            Object serviceObject)
        This callback method for the dependencymanager removes all unavailable declared dependencies for this component.
        Parameters:
        serviceReference - the serviceReference
        serviceObject - the serviceObject
      • extensionAdded

        public final void extensionAdded​(org.osgi.framework.ServiceReference serviceReference,
                                         Object serviceObject)
        This callback method for the dependencymanager adds all available declared extensions for this component.
        Parameters:
        serviceReference - the serviceReference
        serviceObject - the serviceObject
      • extensionRemoved

        public final void extensionRemoved​(org.osgi.framework.ServiceReference serviceReference,
                                           Object serviceObject)
        This callback method for the dependencymanager removes all unavailable declared extensions for this component.
        Parameters:
        serviceReference - the serviceReference
        serviceObject - the serviceObject
      • getClassForName

        public Class<?> getClassForName​(String fullyQualifiedClassName)
        Description copied from interface: Component
        Returns the class for the given fully qualified class name. Return null if it can't be found.
        Specified by:
        getClassForName in interface Component
        Parameters:
        fullyQualifiedClassName - fully qualified class name
        Returns:
        the class for the given fully qualified class name. Return null if it can't be found.
      • getClassesFromBundle

        public Class<?>[] getClassesFromBundle()
        Description copied from interface: Component
        Retrieve all classes from the bundle.
        Specified by:
        getClassesFromBundle in interface Component
        Returns:
        an array of classes present in the bundle
      • getInstance

        public Object getInstance()
        Description copied from interface: Component
        Returns an instance of the component's class.
        Specified by:
        getInstance in interface Component
        Returns:
        an instance of the component's class
      • getInstanceForName

        public Object getInstanceForName​(String fullyQualifiedClassName)
        Description copied from interface: Component
        Returns an instance of the given class if it is serviced by this component's OSGi bundle.
        Specified by:
        getInstanceForName in interface Component
        Parameters:
        fullyQualifiedClassName - Fully qualified class name
        Returns:
        an instance of the given class if it is serviced by this component's OSGi bundle
      • getPrivateNode

        protected final javax.jcr.Node getPrivateNode()
        Retrieve a private node for this component.
        Returns:
        the private node
      • getPrivateNode

        public final javax.jcr.Node getPrivateNode​(String websiteIdentifier)
        Description copied from interface: Component
        Retrieve a private node for this panelcomponent. If websiteIdentifier!=null, then the webContainerNode is returned (specific for the current webinitiatif). Otherwise, the allContainerNode is returned (the same for all webinitiatifs).
        Specified by:
        getPrivateNode in interface Component
        Parameters:
        websiteIdentifier - the unique identifier of the cuurent webinitiatif, or null if the allContainerNode should be returned
        Returns:
        the private node
      • exportContent

        public void exportContent​(javax.jcr.Node node,
                                  boolean exportBinaries,
                                  OutputStream out)
                           throws ExportException
        Description copied from interface: Component
        Writes the repository content associated with the given Node to given OutputStream. The default implementation uses the JCR exportSystemView method and recursively exports the start node and all its subnodes. If the default implementation does not suffice, then any subclass can override it (i.e., a WCB developer can extend SimplePanelComponent and implement WCB-specific export functionality).
        Specified by:
        exportContent in interface Component
        Parameters:
        node - the root of the subtree to be serialized
        exportBinaries - whether binaries should be included
        out - The OutputStream to which the systemview on the content is exported.
        Throws:
        ExportException - on error
      • importContent

        public void importContent​(javax.jcr.Node targetNode,
                                  boolean importBinaries,
                                  InputStream in,
                                  int uuidbehavior)
                           throws ImportException
        Description copied from interface: Component
        Imports content into the JCR. The default implementation uses the JCR Session.importXML method. The choice to import binaries is ignored in the default implementation since the JCR importXML methods do not support it (binaries are always imported). If the default implementation does not suffice, then any subclass can override it (i.e., a WCB developer can extend SimplePanelComponent and implement WCB-specific import functionality).
        Specified by:
        importContent in interface Component
        Parameters:
        targetNode - the node under which the deserialized subtree is added
        importBinaries - whether binary content should be imported; ignored by the default implementation
        in - the inputstream from which the xml to deserialize is read
        uuidbehavior - a four-value flag that governs how incoming UUIDs are handled
        Throws:
        ImportException - on error
      • getComponentManager

        protected ComponentManager getComponentManager()
        Returns the component manager
        Returns:
        the component manager