Package edu.sdsc.grid.io.irods

Examples of edu.sdsc.grid.io.irods.IRODSAccount


        super(rootName, opts);

        try {
            IRODSFileSystemConfigBuilder configurations = IRODSFileSystemConfigBuilder.getInstance();
            IRODSAccount irodsAccount = configurations.getAccount(opts);

            if(irodsAccount == null)
            {
                fileSystem = this.createIRODSFileSystem(rootName, opts);
                irodsAccount = (IRODSAccount)(fileSystem.getAccount());
            }
            else
            {
                fileSystem = new IRODSFileSystem(irodsAccount);
            }

            attribs.put(ACCOUNT, fileSystem.getAccount());
            attribs.put(FILESYSTEM, fileSystem);
            attribs.put(HOME_DIRECTORY, irodsAccount.getHomeDirectory());
            attribs.put(DEFAULT_RESOURCE, irodsAccount.getDefaultStorageResource());
            attribs.put(ZONE, irodsAccount.getZone());
        }
        catch (Throwable e)
        {
            throw new FileSystemException(e);
    }
View Full Code Here


    }

    private IRODSFileSystem createIRODSFileSystem(final GenericFileName rootName, final FileSystemOptions optsthrows FileSystemException
    {
        try {
            IRODSAccount irodsAccount = (IRODSAccount)(createAccount(rootName, opts, IRODSFileSystemConfigBuilder.getInstance()));
            IRODSFileSystem irodsFileSystem = new IRODSFileSystem(irodsAccount);
            return irodsFileSystem;

        } catch (Exception ex) {
            throw new FileSystemException("vfs.provider.irods/connect.error", rootName, ex);
View Full Code Here

    protected RemoteAccount createEncryptAccount(String host, int port, String userInfoDir,
                                                          String zone, String defaultStorageResource,
                                                          String homeDir, char[] username, char[] password,
                                                          FileSystemOptions opts)
    {
        IRODSAccount irods = null;

        if (homeDir != null &&  defaultStorageResource != null && zone != null) {
            irods = new IRODSAccount(host, port, new String(username), new String(password),
                homeDir, zone, defaultStorageResource);

        }

        return irods;
View Full Code Here

    protected RemoteAccount createGsiAccount(String host, int port, String zone,
                                                      GSSCredential credential, String homeDir,
                                                      String defaultStorageResource) throws FileSystemException
    {
        IRODSAccount tmpAccount;

        String defResource = defaultStorageResource;

        if(defResource == null)
            defResource = "";

        if(credential != null)
        {
            IRODSAccount realAccount = new IRODSAccount(host, port, "", "", homeDir, zone, defResource);
            realAccount.setGSSCredential(credential);

            return realAccount;
        }
        return null;
    }
View Full Code Here

    }

    protected RemoteAccount createAccountFromConfig(String userInfoDir, String defaultStorage) throws java.io.FileNotFoundException, java.io.IOException
    {

        IRODSAccount irods = null;

        if (userInfoDir == null) {
            irods = new IRODSAccount();
        }

        /*
        There doesn't seem to be a way to specify the user info directory/file for IRODSAccounts:
        IRODSAccount(GeneralFile userInfoDirectory)
          Creates an object to hold iRODS account information.
        IRODSAccount(GeneralFile envFile, GeneralFile authFile)
          Creates an object to hold iRODS account information.

         GeneralFile is only package visibility, so we can't use it!
         */

        // Always try to specify the default storage resource - this is required so that
        // uploads are targeted to the correct default storage resource, otherwise, any
        // srb storage resource may be used and that can cause firewall block
        // (remeber, that the srb uses multiple storage resources).
        //srb.setDefaultStorageResource("ral-ngs1");
        if (defaultStorage != null) {
            irods.setDefaultStorageResource(defaultStorage);
        }


        return irods;
    }
View Full Code Here

        super(rootName, opts);
       
        try
        {
            IRODSFileSystemConfigBuilder configurations = IRODSFileSystemConfigBuilder.getInstance();
            IRODSAccount account = configurations.getAccount(opts);
            irodsFileSystem = new IRODSFileSystem(account);
            attribs.put(ACCOUNT, account);
            attribs.put(FILESYSTEM, irodsFileSystem);
        }
        catch (Exception e)
View Full Code Here

        GSSCredential cert = new GlobusGSSCredentialImpl(gCert, GSSCredential.INITIATE_AND_ACCEPT);
        //SRBAccount srbAccount = new SRBAccount("srbdev.sf.utas.edu.au",
        //                    5544,
        //                    cert);

        IRODSAccount irodsAccount = new IRODSAccount("srbdev.vpac.org", 1247,
                                                    "", "", "",
                                                    "srbdev.vpac.org", "datafabric.srbdev.vpac.org");


        irodsAccount.setGSSCredential(cert);

        //FileSystemOptions irodsOpts = new FileSystemOptions();
        //IRODSFileSystemConfigBuilder irodsBuilder = IRODSFileSystemConfigBuilder.getInstance();
        //irodsBuilder.setAccount(irodsAccount, irodsOpts);
        //IRODSVfsFileSystem vfsFileSystem = (IRODSVfsFileSystem) VFS.getManager().resolveFile(getURIString(irodsAccount), irodsOpts).getFileSystem();
        //IRODSFileSystem irodsFs = (IRODSFileSystem) vfsFileSystem.getAttribute(IRODSVfsFileSystem.FILESYSTEM);
        try
        {
            IRODSFileSystem irodsFS = new IRODSFileSystem(irodsAccount);
            System.out.println("after constructor - about to query with GSI");

            MetaDataRecordList[] recordList = null;

            try
            {
                recordList = irodsFS
                .query(
                        new MetaDataCondition[] {
                                MetaDataSet
                                .newCondition(
                                        IRODSMetaDataSet.USER_DN,
                                        MetaDataCondition.EQUAL,
                                        "/C=AU/O=APACGrid/OU=TPAC/CN=Pauline Mak")
                        },
                        new MetaDataSelect[] { MetaDataSet
                                .newSelection(IRODSMetaDataSet.USER_NAME) });
            }
            catch (IOException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            if(recordList == null)
            {
                System.out.println("getiRODSUsernameByDN: no result");
            }
            else
            {
                System.out.println("getiRODSUsernameByDN: " + recordList.length);
            }

            if(recordList != null&&recordList.length>0)
            {
                System.out.println("result: " + (String)recordList[0].getValue(IRODSMetaDataSet.USER_NAME));
            }

            System.out.println("account 1 info: " + irodsAccount.getUserName());

            IRODSAccount irodsAccount2 = new IRODSAccount("srbdev.vpac.org", 1247,
                                                    "paulinemak1", "", "/srbdev.vpac.org/home/paulinemak1",
                                                    "srbdev.vpac.org", "datafabric.srbdev.vpac.org");

            irodsAccount2.setGSSCredential(cert);

            System.out.println("acount 2");
           
            FileSystemOptions irodsOpts = new FileSystemOptions();
            IRODSFileSystemConfigBuilder irodsBuilder = IRODSFileSystemConfigBuilder.getInstance();
            irodsBuilder.setAccount(irodsAccount2, irodsOpts);
           
            System.out.println("Account 2 URI: " + getURIString(irodsAccount2) + " " + irodsAccount2.getUserName());


            IRODSFileSystem irodsFS2 = (IRODSFileSystem)(VFS.getManager().
                    resolveFile(getURIString(irodsAccount2), irodsOpts)
                    .getFileSystem().getAttribute(IRODSVfsFileSystem.FILESYSTEM));
View Full Code Here

TOP

Related Classes of edu.sdsc.grid.io.irods.IRODSAccount

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.