Open topic with navigation

TIBCO® Enterprise Administrator 2.4.2

# Defining an Object Type in Interface Style

To define an object type in interface style, your agent code models a managed object as a Java class that implements appropriate interfaces. Then it registers an instance, which lets the agent library call the interface methods.

We present the general task of defining an object type that can have more than one instance. Singleton object types and top-level object types are special cases; to see how they differ from this general case, see Defining a Singleton Object Type in Interface Style and Defining a Top-Level Object Type in Interface Style.

Procedure
1. Define a class that models the managed object type. Your class must implement the interface TeaObject.
   For example, when modeling a car, we could define a class to represent the wheels.

       public class CarWheel implements TeaObject {

           public String getName() {
               // Return the name of the wheel instance,
              // for example, "Wheel 1"
           }

           public String getDescription() {
               // Return the description of the wheel instance,
               // for example, "Front-Left Wheel"
           }

           public String getKey() {
               // Return the key that corresponds to the wheel instance,
               // for example, "Wheel 1"
           }
       }

2. Define a corresponding provider class that implements the interface TeaObjectProvider.

       public class CarWheelProvider implements TeaObjectProvider<CarWheel> {

           public String getTypeName() {
               // Return the name of the wheel object type.
               return "Wheel";
           }

           public String getTypeDescription() {
               // Return the description of the wheel object type.
       	 return "Car wheel";
           }

           public TeaConcept getConcept() {
               // Return the concept type of wheels.
               return TeaConcept.RESOURCE;
           }

           public CarWheel getInstance(final String key) {
               // Return the wheel instance corresponding to the key argument.
               // For example, look-up the key in a hash table.
               ...
           }

       }

3. Register an instance of the provider class.

       CarAgentServer server = ...
       // Register other instances, including the top-level object type.
       CarWheelProvider myCarWheelProvider = new CarWheelProvider;server.registerInstance(myCarWheelProvider);
        ...
       server.start();

What to do next

To model aspects of object types in interface style, see these topics:

- Modeling State in Interface Style
- Modeling Configuration in Interface Style
- Modeling Members in Interface Style
- Defining Operations
- Defining References for Object Types with Interfaces

Subtopics

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO® Enterprise Administrator

Copyright © 1996-2025. Cloud Software Group, Inc. All Rights Reserved.