FileDocCategorySizeDatePackage
WorkerEnv.javaAPI DocApache Tomcat 6.0.144244Fri Jul 20 04:20:36 BST 2007org.apache.jk.core

WorkerEnv

public class WorkerEnv extends Object
The controller object. It manages all other jk objects, acting as the root of the jk object model.
author
Gal Shachor
author
Henri Gomez [hgomez@apache.org]
author
Dan Milstein [danmil@shore.net]
author
Keith Wannamaker [Keith@Wannamaker.org]
author
Kevin Seguin
author
Costin Manolache

Fields Summary
Hashtable
properties
public static final int
ENDPOINT_NOTE
public static final int
REQUEST_NOTE
public static final int
SSL_CERT_NOTE
int[]
noteId
String[]
noteName
private Object[]
notes
Hashtable
handlersMap
JkHandler[]
handlersTable
int
handlerCount
String
home
int
localId
Constructors Summary
public WorkerEnv()

    
      
        for( int i=0; i<noteId.length; i++ ) {
            noteId[i]=7;
            noteName[i]=new String[20];
        }
    
Methods Summary
public voidaddHandler(java.lang.String name, JkHandler w)

        JkHandler oldH = getHandler(name);
        if(oldH == w) {
            // Already added
            return;
        }
        w.setWorkerEnv( this );
        w.setName( name );
        handlersMap.put( name, w );
        if( handlerCount > handlersTable.length ) {
            JkHandler newT[]=new JkHandler[ 2 * handlersTable.length ];
            System.arraycopy( handlersTable, 0, newT, 0, handlersTable.length );
            handlersTable=newT;
        }
        if(oldH == null) {
            handlersTable[handlerCount]=w;
            w.setId( handlerCount );
            handlerCount++;
        } else {
            handlersTable[oldH.getId()]=w;
            w.setId(oldH.getId());
        }

        // Notify all other handlers of the new one
        // XXX Could be a Coyote action ?
        for( int i=0; i< handlerCount ; i++ ) {
            handlersTable[i].addHandlerCallback( w );
        }
    
public final JkHandlergetHandler(java.lang.String name)

        return (JkHandler)handlersMap.get(name);
    
public final JkHandlergetHandler(int id)

        return handlersTable[id];
    
public final intgetHandlerCount()

        return handlerCount;
    
public javax.management.ObjectName[]getHandlersObjectName()

        
        ObjectName onames[]=new ObjectName[ handlerCount ];
        for( int i=0; i<handlerCount; i++ ) {
            onames[i]=handlersTable[i].getObjectName();
        }
        return onames;
    
public java.lang.StringgetJkHome()

        return home;
    
public intgetLocalId()

        return localId;
    
public final java.lang.ObjectgetNote(int i)

        return notes[i];
    
public intgetNoteId(int type, java.lang.String name)

        for( int i=0; i<noteId[type]; i++ ) {
            if( name.equals( noteName[type][i] ))
                return i;
        }
        int id=noteId[type]++;
        noteName[type][id]=name;
        return id;
    
public voidsetJkHome(java.lang.String s)

        home=s;
    
public voidsetLocalId(int id)

        localId=id;
    
public final voidsetNote(int i, java.lang.Object o)

        notes[i]=o;