connectionfactory.java

来自「基于jxta的P2P框架的系统」· Java 代码 · 共 37 行

JAVA
37
字号
package connex.core.net;

import net.jxta.peergroup.*;
import connex.core.WS.*;

public class ConnectionFactory {


    private static PeerGroup pg = WorkspaceManager.getInstance().
                                  getCurrentWorkspace().getPeerGroup();


    public static Connection newMemberConnection(Workspace ws,String peerId, String pipeId,
                                            ConnectionClient conc) {

        Connection Connection = new MemberConnection(ws, peerId, pipeId, conc);
        return Connection;

    }

    public static Connection newWorkspaceConnection(ConnectionClient conc) {
        Connection connection = new WorkspaceConnection(pg, conc);
        return connection;
    }
    public static Connection newWorkspaceConnection(Workspace ws,ConnectionClient conc) {
           Connection connection = new WorkspaceConnection(ws.getPeerGroup(), conc);
           return connection;
    }
    public static ConnectionServer newServer(Workspace ws,ConnectionServerListener conc) {
        ConnectionServer server = new ConnectionServer(ws,conc);
        return server;
    }



}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?