Search in sources :

Example 6 with GridProxy

use of nl.uva.vlet.util.cog.GridProxy in project lobcder by skoulouzis.

the class GridHelper method isGridProxyInt.

public static boolean isGridProxyInt() {
    try {
        File proxyFile = new File(Constants.PROXY_FILE);
        if (!proxyFile.exists()) {
            return false;
        }
        GridProxy p = GridProxy.loadFrom(Constants.PROXY_FILE);
        return p.isValid();
    } catch (VlException ex) {
        return false;
    }
}
Also used : GridProxy(nl.uva.vlet.util.cog.GridProxy) VlException(nl.uva.vlet.exception.VlException) File(java.io.File)

Example 7 with GridProxy

use of nl.uva.vlet.util.cog.GridProxy 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

GridProxy (nl.uva.vlet.util.cog.GridProxy)7 VlException (nl.uva.vlet.exception.VlException)5 VFSClient (nl.uva.vlet.vfs.VFSClient)5 File (java.io.File)4 VRL (nl.uva.vlet.vrl.VRL)3 ServerInfo (nl.uva.vlet.vrs.ServerInfo)3 VRSContext (nl.uva.vlet.vrs.VRSContext)3