FileDocCategorySizeDatePackage
MbeansDescriptorsSerSource.javaAPI DocApache Tomcat 6.0.143505Fri Jul 20 04:20:32 BST 2007org.apache.tomcat.util.modeler.modules

MbeansDescriptorsSerSource

public class MbeansDescriptorsSerSource extends ModelerSource

Fields Summary
private static org.apache.juli.logging.Log
log
org.apache.tomcat.util.modeler.Registry
registry
String
location
String
type
Object
source
List
mbeans
Constructors Summary
Methods Summary
public voidexecute()

        if( registry==null ) registry=Registry.getRegistry();
        long t1=System.currentTimeMillis();
        try {
            InputStream stream=null;
            if( source instanceof URL ) {
                stream=((URL)source).openStream();
            }
            if( source instanceof InputStream ) {
                stream=(InputStream)source;
            }
            if( stream==null ) {
                throw new Exception( "Can't process "+ source);
            }
            ObjectInputStream ois=new ObjectInputStream(stream);
            Thread.currentThread().setContextClassLoader(ManagedBean.class.getClassLoader());
            Object obj=ois.readObject();
            //log.info("Reading " + obj);
            ManagedBean beans[]=(ManagedBean[])obj;
            // after all are read without error
            for( int i=0; i<beans.length; i++ ) {
                mbeans.add(beans[i]);
            }

        } catch( Exception ex ) {
            log.error( "Error reading descriptors " + source + " " +  ex.toString(),
                    ex);
            throw ex;
        }
        long t2=System.currentTimeMillis();
        log.info( "Reading descriptors ( ser ) " + (t2-t1));
    
public java.util.ListloadDescriptors(org.apache.tomcat.util.modeler.Registry registry, java.lang.String location, java.lang.String type, java.lang.Object source)

        setRegistry(registry);
        setLocation(location);
        setType(type);
        setSource(source);
        execute();
        return mbeans;
    
public voidsetLocation(java.lang.String loc)

        this.location=loc;
    
public voidsetRegistry(org.apache.tomcat.util.modeler.Registry reg)


        
        this.registry=reg;
    
public voidsetSource(java.lang.Object source)

        this.source=source;
    
public voidsetType(java.lang.String type)
Used if a single component is loaded

param
type

       this.type=type;