You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Emmanuel Lecharny <el...@gmail.com> on 2007/10/11 16:22:44 UTC

Using XBEAN

Hi,

here are some documentation about the way we are using XBeans in
ApacheDS, for peeps who want to use it in MINA :




Let's preview an explanation here to see if it explains enough.

1. Make sure xbean can find your interceptor by including
@org.apache.xbean.XBean in the class level javadoc.  Simple single-
valued configuration attributes don't need any special attention, but
collection-valued configuration attributes need additional info so
xbean can figure out the type:  @org.apache.xbean.Property
nestedType="org.apache.directory.server.core.partition.Partition"  on
a setter for instance.  I haven't figured out how to annotate
collection-valued constructor args yet.

2. If your interceptor is part of apacheds you just need to make sure
that the source jar for the module is a dependency of the apacheds-
xbean-spring module so xbean will process your annotations with all
the others.  If you are writing a 3rd-party interceptor you need to
configure the xbean maven plugin to produce the schema and property
files for your components.   If there's only one jar involved you
should configure the x-m-p in the module itself, whereas if there are
multiple jars involved you may wish to have maven compile source jars
and generate a single schema as in apacheds-xbean-spring so all
components share the same schema namespace.   A typical x-m-p
configuration would look like:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.xbean</groupId>
        <artifactId>maven-xbean-plugin</artifactId>
        <executions>
          <execution>
            <configuration>
              <namespace>http://my.project.com/config/1.0</namespace>
              <schema>target/xbean/${pom.artifactId}.xsd</schema>
            </configuration>
            <goals>
              <goal>mapping</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!--  lets ensure that the XSD gets deployed  -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${basedir}/target/xbean/$
{pom.artifactId}.xsd</file>
                  <type>xsd</type>
                </artifact>
                <artifact>
                  <file>${basedir}/target/xbean/$
{pom.artifactId}.xsd.html</file>
                  <type>xsd.html</type>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

Note the namespace that you should adjust to something appropriate
for your project.

3. To include and configure your interceptor you need to modify the
server.xml used by your server.  Here's the bit that configures the
interceptors with a mythical fooInterceptor from the mythical third
party project included:

        <interceptors>
          <normalizationInterceptor/>
          <authenticationInterceptor/>
          <referralInterceptor/>
          <aciAuthorizationInterceptor/>
          <defaultAuthorizationInterceptor/>
          <exceptionInterceptor/>
          <operationalAttributeInterceptor/>

          <!-- Uncomment to enable the password policy interceptor
          <passwordPolicyInterceptor/>
          <keyDerivationInterceptor/>
          -->
          <fooInterceptor size="1" color="blue" xmlns="http://
my.project.com/config/1.0">
              <bar>
                 <bar width="2000"/>
              </bar>
          </fooInterceptor>
          <schemaInterceptor/>
          <subentryInterceptor/>
          <collectiveAttributeInterceptor/>
          <eventInterceptor/>
          <triggerInterceptor/>

          <!-- Uncomment to enable replication interceptor
          <replicationInterceptor>
            <configuration>
              <replicationConfiguration serverPort="10390"
peerReplicas="instance_b@localhost:10392">
                <replicaId>
                  <replicaId id="instance_a"/>
                </replicaId>
              </replicationConfiguration>
            </configuration>
          </replicationInterceptor>
          -->
        </interceptors>

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com