code: public void deploy(Descriptor descriptor) throws Throwable
     {
        if (descriptor == null)
           throw new IllegalArgumentException("Descriptor is null");
  
        if (descriptor.getDescriptorName() == null)
           throw new IllegalArgumentException("Descriptor name is null");
  
        if (!(descriptor instanceof InputStreamDescriptor ||
              descriptor instanceof org.ironjacamar.embedded.dsl.datasources20.api.DatasourcesDescriptor ||
              descriptor instanceof org.ironjacamar.embedded.dsl.resourceadapters20.api.ResourceAdaptersDescriptor))
           throw new IllegalArgumentException("Unsupported descriptor: " + descriptor.getClass().getName());
  
        if (!started)
           throw new IllegalStateException("Container not started");
  
        File parentDirectory = new File(SecurityActions.getSystemProperty("java.io.tmpdir"));
        File descriptorFile = new File(parentDirectory, descriptor.getDescriptorName());
  
        if (descriptorFile.exists())
           recursiveDelete(descriptorFile);
  
        FileOutputStream os = new FileOutputStream(descriptorFile);
        BufferedOutputStream bos = new BufferedOutputStream(os, BUFFER_SIZE);
        try
        {
           descriptor.exportTo(bos);
           bos.flush();
        }
        finally
        {
           try
           {
              bos.close();
           }
           catch (IOException ignore)
           {
              // Ignore
           }
        }
  
        log.debugf("Deploying: %s", descriptorFile);
  
        kernel.getMainDeployer().deploy(descriptorFile.toURI().toURL());
     }
docs: {@inheritDoc}