ij-16.png   inspectorJ -- JavaTM Profiler
sf project site browse source checkout source
SourceForge.net Logo



src/inspectorj/client/connectionmanager.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   inspectorJ - java profiler                                            *
00003  *   Copyright (C) 2007 by James May
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00027 #ifndef CONNECTION_MANAGER_H
00028 #define CONNECTION_MANAGER_H
00029  
00030 #include <QDir>
00031 #include <QObject>
00032 #include <QProcess>
00033 #include <QStringList>
00034 #include <QtGui/QAction>
00035 #include "inspectorj/client/clientpackethandler.h"
00036 #include "inspectorj/client/sessionprofile.h"         
00037         
00038 using namespace inspectorj::jdwp;
00039         
00040 namespace inspectorj {
00041 namespace client {   
00042          
00049 class ConnectionManager : public QObject
00050 {
00051     Q_OBJECT
00052             
00053     public:
00054         ConnectionManager(QObject *parent, QMap<QString, SessionProfile>&, QProcess&);
00055         bool startAttachTimer(int, ijConnection);
00056         void getJDWPError(int errCode, QString &s);
00057         bool isAttached(); 
00058         void sendRequest(JDWPCommand*, JDWPAction*);
00059         void sendRequest(JDWPCommand*, QList<JDWPAction*>&); 
00060         void setExiting(bool);
00061                    
00062     public slots:
00063         void closeConnection();
00064         void stopJavaApp();
00065         
00066     signals:
00067         void connected(bool, QString &msg);
00068         
00069     private slots:
00070         void attachToLaunchedServer();
00071         void readPacket();
00072         void sendHandshake();
00073         bool attachToServer();
00074         void launchJavaApp();
00075         void connectionClosedByServer();
00076         void error(QAbstractSocket::SocketError);
00077         
00078     private:
00079         void receiveHandshake();
00080         bool okToConnect();
00081         bool okToLaunch();
00082         bool exiting;
00083         ijConnection connection;
00084         QString buildCmdString(SessionProfile &profile, QString&);
00085         
00086         QObject *parent;
00087         
00089         QMap<QString, SessionProfile> &profiles;
00090         
00092         QProcess &javaAppProcess;
00093         
00095         ClientPacketHandler handler;    
00096             
00098         QTcpSocket tcpSocket;
00099         
00106         bool attached;
00107 };                    
00108        
00109 } // end namespace client
00110 } // end namespace inspectorj
00111 
00112 #endif

Generated on Sun Aug 19 17:07:53 2007 for inspectorJ by  doxygen 1.5.1