本文整理汇总了Java中com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException类的典型用法代码示例。如果您正苦于以下问题:Java ServiceNotConnectedException类的具体用法?Java ServiceNotConnectedException怎么用?Java ServiceNotConnectedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServiceNotConnectedException类属于com.sonelli.juicessh.pluginlibrary.exceptions包,在下文中一共展示了ServiceNotConnectedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ping
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
/**
* Sends a PING to the JuiceSSH Plugin Service.
* Internal use only.
* @throws com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException
*/
public void ping() throws ServiceNotConnectedException {
if(!isConnected())
throw new ServiceNotConnectedException();
try {
service.ping(new IPingListener.Stub() {
@Override
public void pong() throws RemoteException {
Log.d(TAG, "JuiceSSH Plugin: Got PONG");
}
});
} catch (RemoteException e){
throw new ServiceNotConnectedException();
}
}
示例2: connect
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
/**
* Launches a JuiceSSH connection either in the background or foreground.
* @param activity Activity context required for launching connection (may show authentication dialogs)
* @param id The UUID id of the connection in the JuiceSSH DB
* @param listener Callback for connected/disconnected events
* @throws ServiceNotConnectedException
*/
public void connect(Activity activity, UUID id, OnSessionStartedListener listener, int requestId) throws ServiceNotConnectedException {
if(!isConnected())
throw new ServiceNotConnectedException();
sessionStartedListeners.put(requestId, listener);
try {
// This is just for logging/auditing
service.connect(id.toString());
} catch (RemoteException e){
throw new ServiceNotConnectedException();
}
// Always start sessions in the background initially so that we can get them to return
// instantly with a sessionId & sessionKey. If a foreground session has been requested
// we can always do an resume/attach later.
Intent intent = new Intent(Intent.ACTION_VIEW);
//intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.setData(Uri.parse("ssh://" + id));
add_connect_intent_extras(intent);
activity.startActivityForResult(intent, requestId);
}
示例3: addSessionFinishedListener
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
/**
* Registers an OnSessionStartedListener to receive disconnect events for a session
* @param sessionId The integer session ID returned when the session was started
* @param sessionKey The session key returned when the session was started
* @param listener Listener to recieve disconnect events
* @throws ServiceNotConnectedException
*/
public void addSessionFinishedListener(final int sessionId, final String sessionKey, final OnSessionFinishedListener listener) throws ServiceNotConnectedException {
if(!isConnected())
throw new ServiceNotConnectedException();
try {
service.addSessionFinishedListener(sessionId, sessionKey, new ISessionFinishedListener.Stub() {
@Override
public void onSessionFinished() throws RemoteException {
handler.post(new Runnable() {
@Override
public void run() {
listener.onSessionFinished();
}
});
}
});
} catch (RemoteException e){
throw new ServiceNotConnectedException();
}
}
示例4: disconnect
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
/**
* Disconnects a previously started session.
* @param sessionId The integer session ID returned when the session was started
* @param sessionKey The session key returned when the session was started
* @throws ServiceNotConnectedException
*/
public void disconnect(final int sessionId, String sessionKey) throws ServiceNotConnectedException {
if(!isConnected())
throw new ServiceNotConnectedException();
try {
service.disconnect(sessionId, sessionKey);
} catch (RemoteException e){
throw new ServiceNotConnectedException();
}
}
示例5: writeToSession
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
/**
* Writes out a string to the sessions terminal window
*
* @param sessionId The integer session ID returned when the session was started
* @param sessionKey The session key returned when the session was started
* @param command The command(s) to write
* @throws ServiceNotConnectedException
*/
public void writeToSession(int sessionId, String sessionKey, String command) throws ServiceNotConnectedException {
if(!isConnected())
throw new ServiceNotConnectedException();
try {
service.writeToSession(sessionId, sessionKey, command);
} catch (RemoteException e){
throw new ServiceNotConnectedException();
}
}
示例6: attach
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
/**
* Brings a JuiceSSH session to the foreground.
* @param sessionId The integer session ID returned when the session was started
* @param sessionKey The session key returned when the session was started
* @throws ServiceNotConnectedException
*/
public void attach(int sessionId, String sessionKey) throws ServiceNotConnectedException {
if(!isConnected())
throw new ServiceNotConnectedException();
try {
// This is just for logging/auditing
service.attach(sessionId, sessionKey);
} catch (RemoteException e){
throw new ServiceNotConnectedException();
}
}
示例7: onDestroy
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
@Override
protected void onDestroy() {
super.onDestroy();
if(isClientStarted) {
if (isConnected){
try {
client.disconnect(sessionId, sessionKey);
} catch (ServiceNotConnectedException e) {
Log.e(TAG, "Failed to disconnect JuiceSSH session used performance monitor plugin");
}
}
client.stop(this);
}
}
示例8: cd
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
public void cd(int session_id, String session_key, String path, ICommandSuccessListener.Stub listener) throws ServiceNotConnectedException,RemoteException {
if(!isConnected())
throw new ServiceNotConnectedException();
service.cd(session_id, session_key, path, listener);
}
示例9: chgrp
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
public void chgrp(int sessionId, String sessionKey, int gid, String path, ICommandSuccessListener.Stub listener) throws ServiceNotConnectedException,RemoteException {
if(!isConnected())
throw new ServiceNotConnectedException();
service.chgrp(sessionId, sessionKey, gid, path, listener);
}
示例10: chmod
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
public void chmod(int sessionId, String sessionKey, int permissions, String path, ICommandSuccessListener.Stub listener) throws ServiceNotConnectedException,RemoteException {
if(!isConnected())
throw new ServiceNotConnectedException();
service.chmod(sessionId, sessionKey, permissions, path, listener);
}
示例11: chown
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
public void chown(int sessionId, String sessionKey, int uid, String path, ICommandSuccessListener.Stub listener) throws ServiceNotConnectedException,RemoteException {
if(!isConnected())
throw new ServiceNotConnectedException();
service.chown(sessionId, sessionKey, uid, path, listener);
}
示例12: get
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
public void get(int sessionId, String sessionKey, String src, ICommandSuccessListener.Stub listener) throws ServiceNotConnectedException,RemoteException {
if (!isConnected())
throw new ServiceNotConnectedException();
service.get(sessionId, sessionKey, src, listener);
}
示例13: lcd
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
public void lcd(int sessionId, String sessionKey, String path, ICommandSuccessListener.Stub listener) throws ServiceNotConnectedException,RemoteException {
if(!isConnected())
throw new ServiceNotConnectedException();
service.lcd(sessionId, sessionKey, path, listener);
}
示例14: lpwd
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
public void lpwd(int sessionId, String sessionKey, IStringResultListener.Stub listener) throws ServiceNotConnectedException,RemoteException {
if(!isConnected())
throw new ServiceNotConnectedException();
service.lpwd(sessionId, sessionKey, listener);
}
示例15: ls
import com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException; //导入依赖的package包/类
public void ls(int sessionId, String sessionKey, String path, ILsEntryListener.Stub listener) throws ServiceNotConnectedException,RemoteException {
if(!isConnected())
throw new ServiceNotConnectedException();
service.ls(sessionId, sessionKey, path, listener);
}