# About implementing logic in BeanShell

BeanShell scripts will typically be used to orchestrate method execution for objects defined in the configuration document.

However, scripts can also implement logic, instantiating objects to provide a simple point of extension for developers to implement new logic without compiling additional Java classes.

For example, the following script excerpt demonstrates how a method can be defined and referenced in a script:

    <script id="Status">
        <bean-shell-script>
          <![CDATA[

            // define function for printing component status
            import com.Endeca.soleng.eac.toolkit.component.Component;
            void printStatus( Component component ) {
              log.info(component.getAppName() + "." +
                component.getElementId() + ": " +
                component.getStatus().toString() );
            }

            // print status of forge, dgidx, logserver
            printStatus( Forge );
            printStatus( Dgidx );
            printStatus( LogServer );

            // print status for dgraph cluster
            dgraphs = DgraphCluster.getDgraphs().iterator();
            while( dgraphs.hasNext() ) {
              printStatus( dgraphs.next() );
            }

          ]]>
        </bean-shell-script>
      </script>