<?xml version="1.0" encoding="UTF-8"?>
<chapter id="usage">
   <title>Usage</title>

   <section id="usage_kernel">
     <title>Basic usage</title>

      <para>The Fungal kernel is constructed and started using</para>

      <programlisting>
import com.github.fungal.api.Kernel;
import com.github.fungal.api.KernelFactory;
import com.github.fungal.api.configuration.KernelConfiguration;
import com.github.fungal.api.deployer.MainDeployer;

// Create a kernel configuration and start the kernel
KernelConfiguration kernelConfiguration = new KernelConfiguration();
kernelConfiguration = kernelConfiguration.name("jboss.jca");
kernelConfiguration = kernelConfiguration.remoteAccess(false);
kernelConfiguration = kernelConfiguration.hotDeployment(false);

Kernel kernel = KernelFactory.create(kernelConfiguration);
kernel.startup();

// Get the reference to the main deployer
MainDeployer mainDeployer = kernel.getMainDeployer();

// Reference to my deployment
URL myDeployment = ...;

mainDeployer.deploy(myDeployment);
      </programlisting>

      <para>where the <code>KernelConfiguration</code> object allows you to
        configure the kernel setup. The <code>MainDeployer</code> allows you
        to deploy and undeploy deployment units that are supported.</para>

      <para>The kernel is stopped using</para>

      <programlisting>
kernel.shutdown();
      </programlisting>

      <para>See the JavaDoc for additional details.</para>

   </section>

</chapter>
