Package edu.sdsc.grid.io.srb

Examples of edu.sdsc.grid.io.srb.SRBAccount


            isENCRYPT1 = true;
        } else if (credential != null && !isENCRYPT1) {
            isGSI = true;
        }

        SRBAccount srb = null;
        try {
            if (isENCRYPT1) {
                log.debug("Create SRBAccount using ENCRYPT1");
                if (homeDir != null && mdasDomainName != null &&
                    defaultStorageResource != null && mcatZone != null) {
                    //
                    srb = new SRBAccount(host, port, username, password,
                        homeDir, mdasDomainName, defaultStorageResource, mcatZone);

                } else if (homeDir != null && mdasDomainName != null &&
                    defaultStorageResource != null) {
                    //
                    srb = new SRBAccount(host, port, username, password,
                        homeDir, mdasDomainName, defaultStorageResource);
                }

            } else if (isGSI) {         
                if (homeDir != null && defaultStorageResource != null) {
                    log.debug("Create SRBAccount using GSI with homeDir and storageResource");
                    srb = new SRBAccount(host, port, credential, homeDir,
                        defaultStorageResource, SRBAccount.GSI_AUTH);
                } else {
                    // uses special constructor that sets GSI_AUTH and
                    // implements a login procedure using the 'ticketuser' in
                    // order to get the users home directory
                    log.debug("Create SRBAccount using GSI ticket user");
                    srb = new SRBAccount(host, port, credential);
                }

            }
            // fall back to using local MdasFiles (true by default). 
            if (srb == null && useLocalMdasFiles) {
                log.debug("Create SRBAccount using local MDAS files");
                // Load some stuff from ~/.srb/.MdasEnv and .MdasAuth files
                // (use default location unless otherwise specified).
                if (mdasUserInfoDirectory == null) {
                    srb = new SRBAccount();
                } else {
                    srb = new SRBAccount(mdasUserInfoDirectory);
                }
            }

            // if SRBAccount is still null, then throw sensible error.
            if (srb == null){
                // Cannot create SRBAccount with given data
                throw new FileSystemException("vfs.provider.srb/connect.error", host);
            }

            // 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 (defaultStorageResource != null) {
                srb.setDefaultStorageResource(defaultStorageResource);
            }
            // return SRBAccount.
            return srb;

        } catch (Exception ex) {
View Full Code Here


  public static SRBAccount getAccount(String host, int port) {
        return accounts.get(host+port+"");
  }
 
  public static SRBAccount createAccount(String host, int port, String user, String pwd, String home, String domain, String defRes, String mcatZone) {
    return new SRBAccount(host, port, user, pwd, home, domain, defRes, mcatZone);
    }
View Full Code Here

          srbFileSystem = FileFactory.newFileSystem( new SRBAccount(host, port, user, pwd, home, domain, defRes, mcatZone));
          */
          //SRBAccount account = SRBAccounts.getAccount(host, port);

            SRBAccount account = buildSRBAccount(rootName, opts);
            srbFileSystem = new SRBFileSystem(account);//FileFactory.newFileSystem(account);
            //attribs.put(HOME_DIRECTORY, account.getHomeDirectory());
            //attribs.put(SRB_FILESYSTEM, srbFileSystem);
            attribs.put(SRB_ACCOUNT, account);

View Full Code Here

    protected SRBVfsFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions) throws FileSystemException {
        super(rootName, null, fileSystemOptions);

        try {
            SRBFileSystemConfigBuilder configurations = SRBFileSystemConfigBuilder.getInstance();
            SRBAccount srbAccount = configurations.getAccount(fileSystemOptions);
            srbFileSystem = new SRBFileSystem(srbAccount);
            attribs.put(SRB_ACCOUNT, srbFileSystem.getAccount());
        } catch (Throwable e) {
            throw new FileSystemException(e);
    }
View Full Code Here

        try {
            SRBFileSystemConfigBuilder configurations = SRBFileSystemConfigBuilder.getInstance();
            //SRBAccount would have been created at this point in time.  It's stored in
            //the FileSystemOptions key ACCOUNT.
            SRBAccount srbAccount = configurations.getAccount(fileSystemOptions);
            srbFileSystem = new SRBFileSystemExt(srbAccount);
            attribs.put(ACCOUNT, srbFileSystem.getAccount());
            attribs.put(FILESYSTEM, srbFileSystem);
            attribs.put(HOME_DIRECTORY, srbAccount.getHomeDirectory());
            attribs.put(DEFAULT_RESOURCE, srbAccount.getDefaultStorageResource());
            attribs.put(MCAT_ZONE, srbAccount.getMcatZone());
            attribs.put(MDAS_DOMAIN, srbAccount.getDomainName());
        } catch (Throwable e) {
            throw new FileSystemException(e);
    }
    }
View Full Code Here

     */
    private SRBFileSystemExt createSrbFileSystem(GenericFileName rootName,
        FileSystemOptions opts) throws FileSystemException {
        try {
            log.debug("before srbAccount creation ");
            SRBAccount srbAccount = SRBVfsFileSystem.createSrbAccount(rootName, opts);
            SRBFileSystemExt _srbFileSystem = new SRBFileSystemExt(srbAccount);
            log.debug("after srbAccount creation");
            // update the firewall port range
            Integer portMin = SRBFileSystemConfigBuilder.getInstance().getFileWallPortMin(opts);
            Integer portMax = SRBFileSystemConfigBuilder.getInstance().getFileWallPortMax(opts);
View Full Code Here

            isENCRYPT1 = true;
        } else if (credential != null && !isENCRYPT1) {
            isGSI = true;
        }

        SRBAccount srb = null;
        try {
            if (isENCRYPT1) {
                log.debug("Create SRBAccount using ENCRYPT1");
                if (homeDir != null && mdasDomainName != null &&
                    defaultStorageResource != null && mcatZone != null) {
                    //
                    srb = new SRBAccount(host, port, username, password,
                        homeDir, mdasDomainName, defaultStorageResource, mcatZone);

                } else if (homeDir != null && mdasDomainName != null &&
                    defaultStorageResource != null) {
                    //
                    srb = new SRBAccount(host, port, username, password,
                        homeDir, mdasDomainName, defaultStorageResource);
                }

            } else if (isGSI) {
                if (homeDir != null && defaultStorageResource != null) {
                    log.debug("Create SRBAccount using GSI with homeDir and storageResource");
                    srb = new SRBAccount(host, port, credential, homeDir,
                        defaultStorageResource, SRBAccount.GSI_AUTH);
                } else {
                    // uses special constructor that sets GSI_AUTH and
                    // implements a login procedure using the 'ticketuser' in
                    // order to get the users home directory
                    log.debug("Create SRBAccount using GSI ticket user");
                    srb = new SRBAccount(host, port, credential);
                }

            }
            // fall back to using local MdasFiles (true by default).
            if (srb == null && useLocalMdasFiles) {
                log.debug("Create SRBAccount using local MDAS files");
                // Load some stuff from ~/.srb/.MdasEnv and .MdasAuth files
                // (use default location unless otherwise specified).
                if (mdasUserInfoDirectory == null) {
                    srb = new SRBAccount();
                } else {
                    srb = new SRBAccount(mdasUserInfoDirectory);
                }
            }

            // if SRBAccount is still null, then throw sensible error.
            if (srb == null){
                // Cannot create SRBAccount with given data
                throw new FileSystemException("vfs.provider.srb/connect.error", host);
            }

            // 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 (defaultStorageResource != null) {
                srb.setDefaultStorageResource(defaultStorageResource);
            }
            // return SRBAccount.
            return srb;

        } catch (Exception ex) {
View Full Code Here

public class TestVFS {
  FileSystemManager fsManager = null;
 
  public TestVFS () throws FileSystemException {
    fsManager = VFS.getManager();
        SRBAccount account = new SRBAccount("ngdata.hpc.jcu.edu.au", 5544, "cima", "cima!2006!", "hpc.jcu.edu.au", "hpc.jcu.edu.au", "", "hpc.jcu.edu.au");
    }
View Full Code Here

  }
 
  private void directSRBList() throws IOException, FileNotFoundException
  {
    //uses the ~/.srb/MdasEnv user info file
      SRBAccount acct = new SRBAccount();

      edu.sdsc.grid.io.srb.SRBFileSystem fs =
        (edu.sdsc.grid.io.srb.SRBFileSystem) FileFactory.newFileSystem( acct );
     
      SRBFile f = (SRBFile)FileFactory.newFile(fs, acct.getHomeDirectory());
       
    System.out.println("MCAT Zone:" + acct.getMcatZone() + " Dom:" + acct.getDomainName() );
    System.out.println("Home:" + acct.getHomeDirectory() + " Def res:" + acct.getDefaultStorageResource());
   
    String[] children = f.list();
   
    for (int i = 0; i < children.length; i++) {
      System.out.println(children[i]);
View Full Code Here

  private void uriSRBTest() throws URISyntaxException, IOException, FileNotFoundException
   {
 
    String uri = "srb://vsilva.NCC:secret@ebony:5544/nccZone/home/vsilva.NCC";
    SRBFile f = (SRBFile)FileFactory.newFile(new URI(uri));
    SRBAccount acct = (SRBAccount)f.getFileSystem().getAccount();

    System.out.println("MCAT Zone:" + acct.getMcatZone() + " Dom:" + acct.getDomainName() );
    System.out.println("Home:" + acct.getHomeDirectory() + " Def res:" + acct.getDefaultStorageResource());
   
    String[] children = f.list();
   
    for (int i = 0; i < children.length; i++) {
      System.out.println(children[i]);
View Full Code Here

TOP

Related Classes of edu.sdsc.grid.io.srb.SRBAccount

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.