Overview

Plexus embraces and extends Avalon's current component interfaces. In Plexus, Avalon components are called Anonymous Components . This is contrasted with Id'd Components . With an anonymous component there can only be one implementation of a component role in the system. However, id'd components allow multiple implementations of the same component. This is done by associating an id with each component which can then be used to retrieve it through the ServiceBroker interface.

Configuration file format

The plexus configuration file follows the following XML format:

<plexus>
  <load-on-start>
    <service role="org.codehaus.plexus.jetty.ServletContainer" id="jetty"/>
  </load-on-start>

  <!--
   |
   | Loggers
   | Sinks
   | 
   | Directing particular loggers to sinks.
   |
   -->

  <logging>
  
    <!-- LoggerManger -->
    <logger-manager-type>log4j</logger-manager-type>
  
    <!-- Loggers -->
    
    <logger>
      <id>root</id>
      <appender-id>default</appender-id>
      <priority>INFO</priority>
    </logger>
    
    <!-- Appenders -->
    
    <appender>
      <id>default</id>
      <type>file</type>
      <type-configuration>
        <file>${plexus.logs}/plexus.log</file>
        <append>true</append>
      </type-configuration>
      <threshold>INFO</threshold>
      <layout>pattern-layout</layout>
      <conversion-pattern>%-4r [%t] %-5p %c %x - %m%n</conversion-pattern>
    </appender>
  </logging>

  <resources>
    <component-repository>${plexus.home}/components</component-repository>
    <jar-repository>${plexus.home}/app-lib</jar-repository>
    <directory>${plexus.home}/conf</directory>
  </resources>

  <components>

    <!--
     |
     | Id'd Jetty ServletContainer component.
     |
     -->
    <component>
      <id>jetty</id>
      <role>org.codehaus.plexus.jetty.ServletContainer</role>
      <implementation>org.codehaus.plexus.jetty.JettyServletContainer</implementation>
      <version></version>
      <configuration>
        <!-- Component configuration -->
      </configuration>
    </component>

    <!--
     |
     | Anonymous Jetty ServletContainer component.
     |
     -->
    <component>
      <role>org.codehaus.plexus.jetty.ServletContainer</role>
      <implementation>org.codehaus.plexus.jetty.JettyServletContainer</implementation>
      <version></version>
      <configuration>
        <!-- Component configuration -->
      </configuration>
    </component>

  </components>
</plexus>
       

Resources

Resources are made available through the ResourceManager and are available through the PlexusClassLoader. The following resource types are supported:

Components

Components which do not include an > id/ < tag will be automatically configured as an anonymous component. Components with an id tag will be configured as an id'd component. These components are then available through the ServiceBroker interface.

Component Sets

A "component set" is a group of components within Plexus logically bound under an identifier. Components would not be required to participate in a group. There are two use cases that support the co ncept of a "component set" (these were discussed in #plexus on 05FEB2003):

  • During the avalonization of Summit, the following requirement arose: each configuration block of a summit component must include a "summit view identifier" (summit-view-id) which identifies the specific SummitView that utilizes this component. If component sets existed, each SummitView could have its own component set which identifies the components to be used.
  • The other use case is the need to provide one of the same benefits that the Abstract Factory (GOF) design pattern provides: defining a set of components designed to work together and the enforcement of this constraint. This would enable two components that are designed to work together to downcast and access implementation specific methods not available in their ROLEs.
  • Load on start

    Components included in the < load-on-start/ > tag will be loaded automatically upon startup.

    Dynamic component configuration

    Plexus will load components dynamically that are not included in the plexus configuration file. Directories which include these components are specified in the < resources > section of the configuration file with the tag < component-repository/ > in the plexus configurations.

    ComponentManager interface

    Component configurations are passed to the ComponentManager interface. The ComponentManager will dynamically load components from a Configuration. From this configuration it creates the components based upon the rules specified above.