Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Components integration in Ariane portal

Ariane portal offers differents tools to help you to integrate your own webapp. You can already check some examples in the current Ariane components. Bellow the list :


Components modules 

If you already navigate into the GitHub repositories to check how are implemented the existing Ariane components you may notice that most of the component has following modules :

  • base module for backend data model, persistence and so one
  • wat module for shared controller, iPojo consumers, JSF and REST toolings which links the component to the Ariane portal web application context.

All these modules are OSGI modules which lets you define clearly dependencies in the maven pom file. All Ariane components are sharing the same web application context hold by the Ariane portal wab module. In order to integrate a new component into this web app context you need to add your components views, managed bean and rest endpoint to this servlet context.


Add managed bean to shared web application context

A good example could be found with the Ariane Directory component bootstrap.

In order to expose your Faces Managed Bean to the Ariane portal shared web application context :

  • you need to consume the Ariane Portal Plugin Faces Managed Bean Registry. Bellow how you can do that with iPojo :

    Code Block
    themeRDark
    languagejava
    @Requires(from="ArianePortalFacesMBeanRegistry")
    private FacesMBeanRegistry portalPluginFacesMBeanRegistry = null;
    
    
    @Bind
    public void bindPortalPluginFacesMBeanRegistry(FacesMBeanRegistry r) {
        log.debug("Bound to portal plugin faces managed bean registry...");
        portalPluginFacesMBeanRegistry = r;
    }
    @Unbind
    public void unbindPortalPluginFacesMBeanRegistry() {
        log.debug("Unbound from portal plugin faces managed bean registry...");
        portalPluginFacesMBeanRegistry = null;
    }
  • then in your component startup phase you need to register your Managed Bean like that :

    Code Block
    themeRDark
    portalPluginFacesMBeanRegistry.registerPluginFacesMBeanConfig(DirectoryBootstrap.class.getResource(FACES_CONFIG_FILE_PATH)); 

    Note that the FACES_CONFIG_FILE_PATH is the path of the faces-config.xml file in your jar resource which define the Faces Managed Bean :

    Code Block
    themeRDark
    collapsetrue
    <?xml version="1.0"?>
    <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
                  version="2.0">
    
    
        <managed-bean>
            <managed-bean-name>directoryLayoutController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.DirectoryLayoutController</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>directoryMenuController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.DirectoryMenuController</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>directoryBreadCrumController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.DirectoryBreadCrumController</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>directoryDashboardController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.DirectoryDashboardController</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>directoryViewUtils</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.DirectoryViewUtils</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
    
    
        <managed-bean>
            <managed-bean-name>applicationNewController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.organisational.application.ApplicationNewController</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>applicationsListController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.organisational.application.ApplicationsListController</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
    
    
        <managed-bean>
            <managed-bean-name>companyNewController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.organisational.company.CompanyNewController</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>companysListController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.organisational.company.CompanysListController</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
    
    
        <managed-bean>
            <managed-bean-name>environmentNewController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.organisational.environment.EnvironmentNewController</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>environmentsListController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.organisational.environment.EnvironmentsListController</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
    
    
        <managed-bean>
            <managed-bean-name>teamNewController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.organisational.team.TeamNewController</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>teamsListController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.organisational.team.TeamsListController</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
    
    
        <managed-bean>
            <managed-bean-name>datacenterNewController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.technical.network.datacenter.DatacenterNewController</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>datacentersListController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.technical.network.datacenter.DatacentersListController</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
    
    
        <managed-bean>
            <managed-bean-name>subnetNewController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.technical.network.subnet.SubnetNewController</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>subnetsListController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.technical.network.subnet.SubnetsListController</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
    
    
        <managed-bean>
            <managed-bean-name>multicastAreaNewController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.technical.network.multicastArea.MulticastAreaNewController</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>multicastAreasListController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.technical.network.multicastArea.MulticastAreasListController</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
    
    
        <managed-bean>
            <managed-bean-name>OSInstanceNewController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.technical.system.OSInstance.OSInstanceNewController</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>OSInstancesListController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.technical.system.OSInstance.OSInstancesListController</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
    
    
        <managed-bean>
            <managed-bean-name>OSTypeNewController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.technical.system.OSType.OSTypeNewController</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>OSTypesListController</managed-bean-name>
            <managed-bean-class>net.echinopsii.ariane.community.core.directory.wat.controller.technical.system.OSType.OSTypesListController</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
    
    
    </faces-config>
    
    

Add views to shared web application context

A good example could be found with the Ariane Directory component bootstrap.

In order expose JSF/PrimeFaces views to the Ariane portal shared web application context :

  • you need to implement the FaceletsResourceResolverService which targets the Ariane Portal Facelets Resource Resolver Service. Bellow how you can do that with iPojo :

    Code Block
    themeRDark
    languagejava
    @Component
    @Provides(properties= {@StaticServiceProperty(name="targetArianeComponent", type="java.lang.String", value="Portal")})
    @Instantiate
    public class DirectoryBootstrap implements FaceletsResourceResolverService {
    
    ...
     
        @Override
        public URL resolveURL(String path) {
            log.debug("Resolve {} from directory wat...", new Object[]{path});
            return DirectoryBootstrap.class.getResource(basePath + path);
        }
     
    ...
    }

Add REST endpoints to shared web application context

In order expose your REST endpoints to the Ariane portal shared web application context :

  • you need to consume the Ariane Portal REST resource registry. Bellow how you can do that with iPojo :

    Code Block
    themeRDark
    @Requires
    private RestResourceRegistry restResourceRegistry = null;
    
    @Bind
    public void bindRestResourceRegistry(RestResourceRegistry r) {
        log.debug("Bound to rest resource registry...");
        restResourceRegistry = r;
    }
    @Unbind
    public void unbindRestResourceRegistry() {
        log.debug("Bound to rest resource registry...");
        restResourceRegistry = null;
    } 
  • Then in your component startup phase you need to register your REST resources like that :

    Code Block
    themeRDark
    restResourceRegistry.registerPluginRestEndpoints(DirectoryBootstrap.class.getResource(REST_EP_FILE_PATH));


    Note that the REST_EP_FILE_PATH is the path of a file in your jar resources which define the REST endpoints like this :

    Code Block
    themeRDark
    collapsetrue
    net.echinopsii.ariane.community.core.directory.wat.rest.organisational.ApplicationEndpoint
    net.echinopsii.ariane.community.core.directory.wat.rest.organisational.CompanyEndpoint
    net.echinopsii.ariane.community.core.directory.wat.rest.technical.network.DatacenterEndpoint
    net.echinopsii.ariane.community.core.directory.wat.rest.organisational.EnvironmentEndpoint
    net.echinopsii.ariane.community.core.directory.wat.rest.technical.network.MulticastAreaEndpoint
    net.echinopsii.ariane.community.core.directory.wat.rest.technical.system.OSInstanceEndpoint
    net.echinopsii.ariane.community.core.directory.wat.rest.technical.system.OSTypeEndpoint
    net.echinopsii.ariane.community.core.directory.wat.rest.technical.network.SubnetEndpoint
    net.echinopsii.ariane.community.core.directory.wat.rest.organisational.TeamEndpoint

Register a main menu entity

The Ariane portal provides a service to register main menu entity depending on Ariane components needs. This menu is generated through Ariane shared view/controller.

In order to add a menu entity item you need first to use the shared portal main menu registry service consumer or implement a consumer to this service (you can check the shared provided consumer as an exemple).

Define a main menu entity

Rank number

Main menu entities are ordered and placed according to a defined rank number. This rank number are globally defined for the entire Ariane environment so to define your own rank number you first need to have a look to the current rank numbers in use, then define where you want to place you new entity and finally define your rank number and if needed changes the other one. 

Current rank numbers in use :

Rank number

Main menu entity

1

Dashboard (currently not implemented)

2

Directories

3

Injectors

4

Mapping

5

Spreadsheet (currently not implemented)

6

Help

7

Administration

8

Home

ID

The id is the primefaces menu item id. It must be unique. 

Value

The value is the primefaces menu item value (ie: the title you see in the menu bar). 

Type

There is three kind of supported main menu entity type defined here

Context address

Only for TYPE_MENU_ITEM menu item.

The context address is the address of your target view less scheme + "://" + server address + ":" + server port. 

Example: 

for the following view address http://localhost:6969/Ariane/views/mapping.jsf the context address will be : /Ariane/views/main.jsf

Parent

In the case of a menu item contained in the submenu you must set the parent of this menu item with the submenu item.

Usage example

You can find some usage example in the main menu entity registry test case.

Register user preferences

The Ariane portal provides a service to register Ariane components user preferences. These preferences are displayed in the user home view and can be retrieved by Ariane component through a shared controller.

In order to add user preferences you need first to use the shared portal user preferences registry service consumer or implement a consumer to this service (you can check the shared provided consumer as an exemple).

Define a user preference section

Name

Identify the section in the registry. Must be unique.

Description 

The section description is used in the section title display.

Type

There is three kind of supported section type defined here

Usage example

You can find some usage example in the user preference registry test case.

Anchor
tree
tree
Tree menu roots registry

The Ariane portal provides the tree menu roots registry interface and tree menu entity model to let Ariane components implements their own Tree menu roots registry service. 

   

You can then implements PrimeFaces controllers and views to display this menu the way you want.

Define a tree menu entity

ID

The tree menu entity id must be unique. It corresponds to the PrimeFaces component id.

Value

The tree menu entity value corresponds to the PrimeFaces value to be displayed.

Type

There is three kind of supported tree menu entity type defined here

Context address 

Only for TYPE_MENU_ITEM menu item.

The context address is the address of your target view less scheme + "://" + server address + ":" + server port. 

Example: 

for the following view address http://localhost:6969/Ariane/views/main.jsf the context address will be : /Ariane/views/main.jsf

Description

The tree menu entity description is the first help for end user. Fill free to define something minimalist but clear.

Icon

The tree menu entity icon is the primefaces component icon to display. You can choose any JQuery-UI or fontawesome icon.

Parent

The tree menu entity parent is null if the tree menu entity is a root of the tree menu roots registry.

Childs

Only final leaf of the tree doesn't have childs ...

Usage examples

Tree menu roots registry service implementation

Check the directory tree menu roots registry service implementation as a good example. 

Important note : don't forget to define an instance.name !

Bellow howto with iPojo :

Code Block
themeRDark
@Component
@Provides
@Instantiate(name="DirectoryMenuRootsTreeRegistryImpl")
public class DirectoryTreeMenuRootsRegistryImpl implements TreeMenuRootsRegistry 
Tree menu roots registry service consumer

Check the directory tree menu roots registry consumer as a good example.

Important note : don't forget to define the instance.name to consume !

Bellow howto with iPojo :

Code Block
themeRDark
@Requires(from="DirectoryMenuRootsTreeRegistryImpl")
private TreeMenuRootsRegistry treeMenuRootsRegistry = null;
Tree menu roots registry population 

Check the directory tree menu roots registry service unit test as a good example.

Check authentication and authorization in the views

Ariane Portal idmwat module provides a JSF taglib with some JSF API verbs definition which link the Ariane Portal views to the Ariane IDM Apache Shiro context. You can use any of this JSF method to check authentication or authorization from any of JSF views using the Ariane portal web context like the Ariane directory views

You just need to import the taglib in your JSF file by adding this line to your header : 

Code Block
themeRDark
xmlns:ccidmarianeidm="http://spectralechinopsii.comnet/ccariane/idm"

And then call the taglibs verbs like :

Code Block
themeRDark
<ui:fragment rendered="#{ccidmarianeidm:isAuthenticated() and ccidmarianeidm:hasPermission('ccDirComOrgApp:display')}">