BEA Systems, Inc.

WebLogic Server 5.1.0 API Reference

weblogic.time.common
Interface TriggerDef


public interface TriggerDef
extends Triggerable

Exteneded interface for user-written triggers. A TriggerDef object differs from a Triggerable in that it can be initialized with a ParamSet, and has access to T3Server services. This makes it particularly suitable for T3Clients that instantiate scheduled triggers on the WebLogic Server. Since the object is constructed remotely via its default constructor, any initial state information must be supplied via the initialization method triggerInit(). Parameters are supplied via the weblogic.common.time.Trigger wrapper object.

Here's an example of a simple implementation of this interface.

package tutorial.time;
 import weblogic.common.*;
 import mypackage.MyConnection;
 import java.util.*;

 class TimeTest implements Schedulable, TriggerDef {

 private String username = "";
 private T3ServicesDef services;

 public void setServices(T3ServicesDef services) {
   this.services = services;
 }

 public void triggerInit(ParamSet ps) throws ParamSetException {
   username = ps.getParam("username");
 }

 public long schedule(long currentMillis) {
   return currentMillis + interval;
 }

 // TriggerDef
 public void trigger() {
   makeMyConnection(username);
   System.out.println("trigger called");
 }

A TriggerDef object can access other WebLogic services via the services stub passed to the user-defined setServices() method.

Author:
Copyright (c) 1996-1998, WebLogic, Inc. All Rights Reserved., Copyright (c) 1999 by BEA WebXpress. All Rights Reserved.
Copyright © 2000 BEA Systems, Inc. All Rights Reserved.
See Also:
Trigger, Schedulable, TimeServicesDef

Method Summary
 void setServices(T3ServicesDef services)
          Sets the services stub, which allows runtime access to WebLogic services that may be accessed.
 void triggerInit(ParamSet params)
          Passes a set of initialization parameters to the TriggerDef object.
 
Methods inherited from interface weblogic.time.common.Triggerable
trigger
 

Method Detail

setServices

public void setServices(T3ServicesDef services)
Sets the services stub, which allows runtime access to WebLogic services that may be accessed. Since this object is set at instantiation, the services object may reference either a client-side or a server-side implementation, depending upon the runtime context.

Parameters:
services - T3ServicesDef object

triggerInit

public void triggerInit(ParamSet params)
                 throws ParamSetException
Passes a set of initialization parameters to the TriggerDef object. Since dynamically loaded classes cannot pass arguments in a constructor, this method is used to pass registration parameters to the newly-constructed TriggerDef object.

Parameters:
ParamSet - of name/value pairs
Throws:
ParamSetException - if the ParamSet cannot be found or is invalid

Documentation is available at
http://www.weblogic.com/docs51