In this section, you define a class that is used as a Nucleus component, then configure the component.

Define the class

Define a simple Person class that has two properties: name (a String) and age (an integer):

public class Person {
  String name;
  int age;

  public Person () {}
  public String getName () { return name; }
  public void setName (String name) { = name; }
  public int getAge () { return age; }
  public void setAge (int age) { this.age = age; }

Put this class definition in your classes directory with the name The ATG platform includes an <ATG9dir>/home/locallib directory that you can use for any Java class files you create. This directory is included in the ATG CLASSPATH by default, so any classes stored there are picked up automatically.

Note: The locallib directory is intended for evaluation and development purposes only. For full deployment, you should package your classes in an application module, as described in Working with Application Modules.

Use the javac –d command to compile your source file and add the resulting .class files to the locallib directory:

javac -d <ATG9dir>/home/locallib

Configure a component

Now create an instance (or component) of a Person class,/test/services/Person. You can create this in two ways:

To create a component with the Components window:

To create a component with a configuration file:

You can now view the Person component in the Components window. Select test/services/Person and click Open Component. The Component Editor should display Person and its two properties.

loading table of contents...