00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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 }
00110 }
00111
00112 #endif