24.4. Pet Store Example: Package, Imports, Globals and Dialect from PetStore.drl

package org.drools.examples

import org.drools.WorkingMemory
import org.drools.examples.petstore.PetStoreExample.Order
import org.drools.examples.petstore.PetStoreExample.Purchase
import org.drools.examples.petstore.PetStoreExample.Product
import java.util.ArrayList
import javax.swing.JOptionPane;

import javax.swing.JFrame 
        
global JFrame frame 
global javax.swing.JTextArea textArea
  • The first part of file PetStore.drl contains the standard package and import statements to make various Java classes available to the rules.
  • The two globals frame and textArea hold references to the Swing components JFrame and JTextArea components that were previously passed on by the Java code calling the setGlobal() method. These global variables retain their value for the lifetime of the Session.