This tutorial covers the setup and use of the Battery Server for GemStone application. The Battery Server is used as a central hub on a network to distribute battery charges to client versions of GemStone. For more information on the use of software batteries see the tutorial How to Work with Software Batteries.
Setting up the Battery Server
Install the Battery Server on a computer that can be accessed by all of the GemStone Client computers. The client computers do not need to be in constant contact with the server; they periodically communicate with the server to get battery charges which allow the client software to read data files.
After installation of the Battery Server application is completed, there are a few steps necessary to prepare it to distribute charges:
1. Register the Battery Server.
2. Configure the Battery Server to distribute charges.
3. Charge the “software battery” for the server so that it can deliver charges to clients.
4. Optionally, configure the computer to automatically launch the Battery Server application.
Registering the Battery Server
When the application is first launched it will need to be registered. Read Registering your new software for instructions on how to register you software. After a successful registration, you are ready to configure the Battery Server.

Configure the Battery Server
You will be then presented with a couple dialogs that will assist in configuring the Battery server to distribute charges. The first dialog will ask you to enter a password. The Battery Server can be protected from unauthorized access by use of a password. Users will need to know this password when making battery requests.

The second dialog, will allow you to specify the port that the Battery Server will monitor for battery requests. In most cases, the default port selection should be used. If there is a conflict, a different port may be specified. If you do not use the default port, users making battery requests will need to know the port number you have chosen. They must modify the Battery Server Port specified in the Miscellaneous section of the Preferences. See Edit Preferences for additional details.

Firewall Alerts!
When the Battery Server attempts to monitor the IP port selected, firewall software on the computer may display an alert. This is because the Battery Server is attempting to listen for incoming requests on an IP port - something that firewall software is designed to prevent.
The Battery Server needs to monitor a port in order to service requests from GemStone Client users. Firewall software settings need to be adjusted to allow this.
Once the port is selected, the Battery Server will begin monitoring the port for battery requests. You should see a message indicating success.

Charging the Battery
The Battery Server’s battery can be charged using any of the options covered in the tutorial How to Work with Software Batteries. These options are found in the application’s Battery menu. Choose the appropriate method and charge the battery. For new installations, use the “Battery Certificate” that was included with the software. The Battery Certificate encodes a set of charges for the Battery Server. When the battery has been successfully charged you should see a success message. The battery meter in the bottom right of the application window will show that it is fully charged.
At this point, the Battery Server is ready to fulfill battery requests from GemStone Client software on other computers. This can be tested by requesting a battery from the Battery Server itself. To do this “self-request”, use the Request from Server option in the Battery Server’s Battery Menu, and use localhost in the Battery Server Name field. You should again see a success message and have a full battery.
Configuring the System to Automatically Run the Battery Server
The Battery Server should be available to GemStone Client installations at all times. The best way to ensure this is to set up the Battery Server to automatically launch when the computer is restarted. This allows the Battery Server to distribute charges without interaction on the part of the user. There are a few steps to set this up, depending on the operating system you are running.
Common Steps to Automatically Run the Battery Server
In order for the Battery Server to run automatically, the banner dialog and the user login need to be disabled. This can be done using the Preferences dialog. On the Mac, choose Preferences from the application menu. On Windows, choose Preferences from the Edit menu.
In the Edit Preferences dialog, choose the Miscellaneous section. Uncheck the Show Banner checkbox and choose Don’t Show for the User Login Option.

Automatically Run the Battery Server on Windows
If you are running Battery Server for GemStone on Windows, you will need to setup a scheduled task to launch GemStone each time the computer reboots. From the Control Panel, choose Scheduled Task, Add Scheduled Task.

This will start the Scheduled Task Wizard. Click Next.
Use the Browse button to navigate to the location where the Battery Server for GemStone was installed.
Choose the Battery Server for GemStone.exe application file. Note, you may or may not see the “.exe” extension. If you are unsure which entry is the application you can right click and choose Properties. The “Type of file” field for the application will specify Application.
Select to run the application “When my computer starts” and click Next.
In the next pane of the wizard, you will need to enter a user account and password under which the Battery Server task will be run. Use the Windows OS user and password that was used to register Battery Server for GemStone. This is the user name and password that you use to login to your computer.

Click Next.
There are a few additional settings to configure, so enable the “Open the advanced properties for this task when I click Finish”.

Select the Settings tab. Uncheck the Stop the task checkbox. Then click OK to finish the task.

At this point, the Battery Server for GemStone should run in the background each time your computer starts up. It will monitor the IP port and be able to fulfill battery requests from GemStone Client users even if no user is logged in to the computer. To ensure that the Battery Server will always be available when needed, the system should also be configured not to sleep after a certain period of time, unless network activity can wake it up (Power Options).
Automatically Run the Battery Server on Os X
If you are running Battery Server for GemStone on Macintosh OSX, you will need to add the Battery Server to a list of applications that start when a user logs in, and set that user to be automatically logged in when the system restarts. From the System menu choose System Preferences.

In the System Preferences, dialog click on the Accounts icon. From the list of users, select the user who preformed the Battery Server registration. Click the “Login Items” or “Startup Items” tab. Click the “+” button in the Login Items section, browse to and select the Battery Server for GemStone application file. If you want the Battery Server to run minimized check the Hide checkbox.

Now click on Login Options in the lower left. If the control is disabled you will need to click on the lock button in the lower left and authenticate to make the needed changes. In the Login Options section, check the Automatically Login As checkbox. Then choose the user that preformed the Battery Server registration. You may need to re-authenticate for this step as well.
At this point, the Battery Server for GemStone should run in the background each time your computer starts up. It will monitor the IP port and be able to fulfill battery requests from GemStone Client users even if no user is logged in to the computer. To ensure that the Battery Server will always be available when needed, the system should also be configured not to sleep after a certain period of time, unless network activity can wake it up (Energy Saver Settings). Also the user should not be logged out after a period of inactivity (Security Settings).
Using the Battery Server
When you need to interact directly with the battery server, you will need to log in to the operating system with the user login that was used to register the Battery Server.
If you are running the Battery Server on Windows and the server is configured to run automatically as outlined above, you will need to terminate the server background process, and then re-launch the Battery Server application directly after logging in to the operating system. To terminate the Battery Server process, you can run the “Stop_Battery_Server.bat” file that is installed in the same directory as the Battery Server for GemStone application.
You can view and adjust the server configuration using the Properties option in the Server menu. The server properties will show you the information needed by the user when making battery requests from the server. If changes need to be made to the Battery Server’s configuration they can be made here. You can also view the Battery Creation Log, which shows information about the batteries that have been generated and distributed. From the Server Menu you can satisfy an offline transfer request from a user by choosing the Transfer Charge option. You will need enter the needed information from the user into the Transfer Charge dialog and return to the user the battery transfer codes that are generated. For more information on these options see the Server Menu section.
Summary
In this tutorial we have considered the how to configure and use Battery Server for GemStone. This included registration, initial configuration, charging the battery, configuring the system to run the Battery Server automatically, and using the Battery Server directly after logging in to the computer on Windows.