Search in sources :

Example 6 with VFSClient

use of nl.uva.vlet.vfs.VFSClient in project lobcder by skoulouzis.

the class GridHelper method initGridProxy.

public static void initGridProxy(String vo, String password, VRSContext context, boolean destroyCert) throws Exception {
    InitGlobalVFS();
    if (context == null) {
        context = new VFSClient().getVRSContext();
    // context = VRS.getDefaultVRSContext();
    }
    GridProxy gridProxy = context.getGridProxy();
    if (destroyCert) {
        gridProxy.destroy();
        gridProxy = null;
    }
    if (gridProxy == null) {
        // || gridProxy.isValid() == false) {
        // context.setProperty("grid.proxy.location", Constants.PROXY_FILE);
        // context.setProperty("grid.certificate.location", Global.getUserHome() + "/.globus");
        // context.setProperty("grid.proxy.lifetime", "100");
        // context.setProperty("grid.proxy.voName", vo);
        gridProxy = context.getGridProxy();
        // if (gridProxy.isValid() == false) {
        // gridProxy.setEnableVOMS(true);
        // gridProxy.setDefaultVOName(vo);
        gridProxy.createWithPassword(password);
        if (gridProxy.isValid() == false) {
            throw new VlException("Created Proxy is not Valid!");
        // }
        }
    }
    if (!new File(Constants.PROXY_FILE).exists()) {
        gridProxy.saveProxyTo(Constants.PROXY_FILE);
    }
}
Also used : VFSClient(nl.uva.vlet.vfs.VFSClient) GridProxy(nl.uva.vlet.util.cog.GridProxy) VlException(nl.uva.vlet.exception.VlException) File(java.io.File)

Example 7 with VFSClient

use of nl.uva.vlet.vfs.VFSClient in project lobcder by skoulouzis.

the class StorageSiteClient method initVFS.

private void initVFS() throws Exception {
    this.vrsClient = new VFSClient();
    VRSContext context = vrsClient.getVRSContext();
    context.setProperty(GlobalConfig.TCP_CONNECTION_TIMEOUT, "20000");
    // Bug in sftp: We have to put the username in the url
    ServerInfo info = context.getServerInfoFor(vrl, true);
    String authScheme = info.getAuthScheme();
    if (StringUtil.equals(authScheme, ServerInfo.GSI_AUTH)) {
        GridHelper.initGridProxy(username, password, context, destroyCert);
    // copyVomsAndCerts();
    // GridProxy gridProxy = context.getGridProxy();
    // if (destroyCert) {
    // gridProxy.destroy();
    // gridProxy = null;
    // }
    // if (gridProxy == null || gridProxy.isValid() == false) {
    // context.setProperty("grid.proxy.location", Constants.PROXY_FILE);
    // // Default to $HOME/.globus
    // context.setProperty("grid.certificate.location", Global.getUserHome() + "/.globus");
    // String vo = username;
    // context.setProperty("grid.proxy.voName", vo);
    // context.setProperty("grid.proxy.lifetime", "200");
    // gridProxy = context.getGridProxy();
    // if (gridProxy.isValid() == false) {
    // gridProxy.setEnableVOMS(true);
    // gridProxy.setDefaultVOName(vo);
    // gridProxy.createWithPassword(password);
    // if (gridProxy.isValid() == false) {
    // throw new VlException("Created Proxy is not Valid!");
    // }
    // gridProxy.saveProxyTo(Constants.PROXY_FILE);
    // //                    proxyCache.put(password, gridProxy);
    // }
    // }
    }
    if (StringUtil.equals(authScheme, ServerInfo.PASSWORD_AUTH) || StringUtil.equals(authScheme, ServerInfo.PASSWORD_OR_PASSPHRASE_AUTH) || StringUtil.equals(authScheme, ServerInfo.PASSPHRASE_AUTH)) {
        // String username = storageSite.getCredential().getStorageSiteUsername();
        if (username == null) {
            throw new NullPointerException("Username is null!");
        }
        info.setUsername(username);
        // String password = storageSite.getCredential().getStorageSitePassword();
        if (password == null) {
            throw new NullPointerException("password is null!");
        }
        info.setPassword(password);
    }
    info.setAttribute(ServerInfo.ATTR_DEFAULT_YES_NO_ANSWER, true);
    // if(getVrl().getScheme().equals(VRS.SFTP_SCHEME)){
    // patch for bug with ssh driver
    info.setAttribute("sshKnownHostsFile", System.getProperty("user.home") + "/.ssh/known_hosts");
    // }
    // context.setProperty("chunk.upload", doChunked);
    // info.setAttribute(new VAttribute("chunk.upload", true));
    info.store();
}
Also used : VRSContext(nl.uva.vlet.vrs.VRSContext) VFSClient(nl.uva.vlet.vfs.VFSClient) ServerInfo(nl.uva.vlet.vrs.ServerInfo)

Example 8 with VFSClient

use of nl.uva.vlet.vfs.VFSClient in project lobcder by skoulouzis.

the class GridHelper method initGridProxy.

public static void initGridProxy(String vo, String password, VRSContext context, boolean destroyCert) throws Exception {
    InitGlobalVFS();
    if (context == null) {
        context = new VFSClient().getVRSContext();
    // context = VRS.getDefaultVRSContext();
    }
    GridProxy gridProxy = context.getGridProxy();
    if (destroyCert) {
        gridProxy.destroy();
        gridProxy = null;
    }
    if (gridProxy == null || gridProxy.isValid() == false) {
        // context.setProperty("grid.proxy.location", Constants.PROXY_FILE);
        // context.setProperty("grid.certificate.location", Global.getUserHome() + "/.globus");
        // context.setProperty("grid.proxy.lifetime", "100");
        context.setProperty("grid.proxy.voName", vo);
        gridProxy = context.getGridProxy();
        // if (gridProxy.isValid() == false) {
        gridProxy.setEnableVOMS(true);
        gridProxy.setDefaultVOName(vo);
        gridProxy.createWithPassword(password);
        if (gridProxy.isValid() == false) {
            throw new VlException("Created Proxy is not Valid!");
        // }
        }
    }
    if (!new File(Constants.PROXY_FILE).exists()) {
        gridProxy.saveProxyTo(Constants.PROXY_FILE);
    }
}
Also used : VFSClient(nl.uva.vlet.vfs.VFSClient) GridProxy(nl.uva.vlet.util.cog.GridProxy) VlException(nl.uva.vlet.exception.VlException) File(java.io.File)

Aggregations

VFSClient (nl.uva.vlet.vfs.VFSClient)8 GridProxy (nl.uva.vlet.util.cog.GridProxy)5 VRSContext (nl.uva.vlet.vrs.VRSContext)5 VRL (nl.uva.vlet.vrl.VRL)4 ServerInfo (nl.uva.vlet.vrs.ServerInfo)4 VlException (nl.uva.vlet.exception.VlException)3 File (java.io.File)2 JDBCatalogue (nl.uva.cs.lobcder.catalogue.JDBCatalogue)1 Credential (nl.uva.cs.lobcder.resources.Credential)1 PDRIDesc (nl.uva.cs.lobcder.tests.TestREST.PDRIDesc)1 BdiiService (nl.uva.vlet.util.bdii.BdiiService)1 StorageArea (nl.uva.vlet.util.bdii.StorageArea)1