当前位置: 首页>>代码示例>>Java>>正文


Java ServiceNotConnectedException类代码示例

本文整理汇总了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();
    }
}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:21,代码来源:ConnectionPluginClient.java

示例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);

}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:33,代码来源:ConnectionPluginClient.java

示例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();
    }
}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:28,代码来源:ConnectionPluginClient.java

示例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();
    }
}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:17,代码来源:ConnectionPluginClient.java

示例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();
    }
}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:20,代码来源:PluginClient.java

示例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();
    }


}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:21,代码来源:PluginClient.java

示例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);
    }
}
 
开发者ID:Sonelli,项目名称:juicessh-performancemonitor,代码行数:16,代码来源:MainActivity.java

示例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);
}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:6,代码来源:SftpPluginClient.java

示例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);
}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:6,代码来源:SftpPluginClient.java

示例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);
}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:6,代码来源:SftpPluginClient.java

示例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);
}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:6,代码来源:SftpPluginClient.java

示例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);
}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:6,代码来源:SftpPluginClient.java

示例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);
}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:6,代码来源:SftpPluginClient.java

示例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);
}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:6,代码来源:SftpPluginClient.java

示例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);
}
 
开发者ID:Sonelli,项目名称:juicessh-pluginlibrary,代码行数:6,代码来源:SftpPluginClient.java


注:本文中的com.sonelli.juicessh.pluginlibrary.exceptions.ServiceNotConnectedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。