Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/connect
In directory usw-pr-cvs1:/tmp/cvs-serv19380
Added Files:
ConnectorManagerImpl.java
Log Message:
VirtualMachineManager renamed to ConnectorManager
by michal
--- NEW FILE: ConnectorManagerImpl.java ---
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License Version
* 1.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is available at http://www.sun.com/
*
* The Original Code is the Java Profiler module.
* The Initial Developers of the Original Code are Jan Stola, Pavel Vacha,
* Michal Pise, Petr Luner, Lukas Petru and Marek Przeczek.
* Portions created by Jan Stola are Copyright (C) 2000-2001. All Rights
Reserved.
* Portions created by Pavel Vacha are Copyright (C) 2000-2001. All Rights
Reserved.
* Portions created by Michal Pise are Copyright (C) 2000-2001. All Rights
Reserved.
* Portions created by Petr Luner are Copyright (C) 2000-2001. All Rights
Reserved.
* Portions created by Lukas Petru are Copyright (C) 2000-2001. All Rights
Reserved.
* Portions created by Marek Przeczek are Copyright (C) 2000-2001. All Rights
Reserved.
*
* Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner,
* Lukas Petru and Marek Przeczek.
*/
package net.sourceforge.javaprofiler.jpiimpl.connect;
import java.util.List;
import java.util.LinkedList;
import net.sourceforge.javaprofiler.jpi.connect.ConnectorManager;
import net.sourceforge.javaprofiler.jpi.connect.Connector;
import net.sourceforge.javaprofiler.jpiimpl.connect.*;
/**
* Implementation of Connector Manager.
*
* @see net.sourceforge.javaprofiler.jpi.ConnectorManager
* @author Jan Stola
*/
public class ConnectorManagerImpl implements ConnectorManager {
/**
* All connectors. The first item of this array should be default
* launching connector.
*/
private static final Connector[] allConnectors={new SocketLaunchConnector(),
new ShmemLaunchConnector(), new SocketAttachConnector(), new
ShmemAttachConnector(),
new SocketListenConnector()};
/**
* All VMs that are connected to the profiler.
* List of {@link net.sourceforge.javaprofiler.jpi.VirtualMachine} objects.
*/
private List allVMs;
/**
* Returns the list of all known
* {@link net.sourceforge.javaprofiler.jpi.connect.Connector} objects
* of the given <code>type</code>.
*
* @param type mask for the type of connectors that should be listed.
* @return a list of
* {@link net.sourceforge.javaprofiler.jpi.connect.Connector} objects.
*/
public List connectors(int type) {
List cons=new LinkedList();
for (int i=0; i<allConnectors.length; i++) {
if ((allConnectors[i].type()&type)!=0) {
cons.add(allConnectors[i]);
}
}
return cons;
}
/**
* Lists all target VMs which are connected to the profiler. The list
includes
* {@link net.sourceforge.javaprofiler.jpi.VirtualMachine} instances for any
target
* VMs which initiated a connection and any target VMs to which this manager
has
* initiated a connection. A target VM will remain in this list until it is
discarded
* through {@link net.sourceforge.javaprofiler.jpi.VirtualMachine#dispose()}
or until
* it stops, whichever happens first.
*
* @return a list of {@link net.sourceforge.javaprofiler.jpi.VirtualMachine}
objects,
* each mirroring a target VM.
*/
public List connectedVirtualMachines() {
return allVMs;
}
/**
* Identifies the default connector. This connector should be used as
* the launching connector when selection of a connector with specific
* characteristics is unnecessary.
*
* @return the default launching connector
* {@link
net.sourceforge.javaprofiler.jpi.connect.Connector#LAUNCHING_CONNECTOR}
*/
public Connector defaultConnector() {
return allConnectors[0];
}
}
/*
* $Log: ConnectorManagerImpl.java,v $
* Revision 1.1 2002/08/21 12:49:09 vachis
* VirtualMachineManager renamed to ConnectorManager
* by michal
*
* Revision 1.3 2002/05/16 11:37:20 stolis
* ShmemListenConnector removed and one small bug fixed.
*
* Revision 1.2 2001/09/29 21:01:33 stolis
* Plural added in licenses.
*
* Revision 1.1 2001/08/22 13:24:59 stolis
* First version of implementation of VirtualMachineManager.
*
*/
|