Package edu.indiana.extreme.gfac.beanutils

Examples of edu.indiana.extreme.gfac.beanutils.ApplicationGlobalContext


              Map<String,String> userInfo = (Map) portletRequest.getAttribute(PortletRequest.USER_INFO);
              username = (userInfo!=null) ? (String) userInfo.get("user.name") : null;
              if (username == null) {
                  username = portletRequest.getRemoteUser();
              }
             context = new ApplicationGlobalContext();
              if(ProxyManager.getDefaultProxy(username) == null){
                HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
                PrintWriter out = response.getWriter();
                  out.println("<h3>Login to My Proxy server using Xregistry Interface's Proxy Configration link or ProxyManager Portlet!</h3><br>");
                  out.close();
                throw new GfacGUIException("Login to My Proxy server using Xregistry Interface's Proxy Configration link or ProxyManager Portlet");
              }
             context.setGssCredential(ProxyManager.getDefaultProxy(username));
             // to  create RegistryService instance
              context.load();
          facesContext.getExternalContext().getSessionMap().put("applicationGlobalContext", context);
          this.setContext(context);
          checkStatus = true;
            }else{
              UserInfo userInfo =  (UserInfo) facesContext.getExternalContext().getSessionMap().get("userInfo");
              String userName = userInfo.getUserName();
               GSSCredential credential = ProxyManager.getDefaultProxy(userName);
          if(credential != null){
            context = new ApplicationGlobalContext();
            context.setGssCredential(credential);
            context.load();
            facesContext.getExternalContext().getSessionMap().put("applicationGlobalContext", context);
            this.setContext(context);
              checkStatus = true;
View Full Code Here


   *
   */
  public AbstractBean() {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    if (facesContext != null) {
      ApplicationGlobalContext lcontext = (ApplicationGlobalContext) facesContext.getExternalContext().getSessionMap().get("applicationGlobalContext");
      if(lcontext == null){
        checkLogin();
      }
      this.setContext(lcontext);
    }
View Full Code Here

        System.out.println("Process Upload Called");
      try {
            FacesContext facesContext=FacesContext.getCurrentInstance();
            Application application = facesContext.getApplication();

              ApplicationGlobalContext context = (ApplicationGlobalContext)application.createValueBinding("#{applicationGlobalContext}").getValue(facesContext);
            System.out.println("File upload called");
              InputStream in = new BufferedInputStream(uploadedFile.getInputStream());
                    BufferedReader input =  new BufferedReader(new InputStreamReader(in));

              StringBuffer sb = new StringBuffer();
                try {
                    String line;
                    while ((line = input.readLine()) != null){
                      sb.append(line);
                      sb.append("\r\n");
                    }
                } finally {
                    in.close();
                }
                System.out.println("File upload called for "+ documentType );
              if(documentType.equals(ServiceConstants.SEARCH_HOST)){
                HostUtils.createObject(context.getRegService(), sb.toString());
                HostDescriptionType hostDesc = HostDescriptionDocument.Factory.parse(
                    sb.toString()).getHostDescription();
                documentName = hostDesc.getHostName();
                }else if(documentType.equals(ServiceConstants.SEARCH_APPLICATION)){
                ApplicationUtils.createObject(context.getRegService(), sb.toString());
                ApplicationDescriptionType appType = ApplicationDescriptionDocument.Factory.parse(sb.toString()).getApplicationDescription();
                documentName = appType.getApplicationName().getStringValue();
                }else if(documentType.equals(ServiceConstants.SEARCH_SERVICE)){
                ServiceUtils.createObject(context.getRegService(), sb.toString());
                ServiceMapType serviceMap =  ServiceMapDocument.Factory.parse(sb.toString()).getServiceMap();
                documentName = serviceMap.getService().getServiceName().getStringValue();
                }else{
                  throw new Exception("Document type passed '" + documentType + "' is not valid");
                }
View Full Code Here

    this.objectName = objectName;
  }

  public static void main(String[] args) {
    try {
      ApplicationGlobalContext context = new ApplicationGlobalContext();
      // Set MyProxy user password to run this
      context.login();
      CapabilityBean bean = new CapabilityBean();
      bean.setContext(context);
      String resourceid = "urn:hostdesc:bigred.teragrid.iu.edu";
      CapabilityToken[] capabilityTokens = bean
          .getCurrentCapabilities(resourceid);
View Full Code Here

      }else if(objectType.equals(ServiceConstants.SEARCH_SERVICE)){
        doctype = "ServiceDesc";
      }else {
        return ServiceConstants.ERROR_STATUS;
      }
        ApplicationGlobalContext context = (ApplicationGlobalContext)facesContext.getExternalContext().getSessionMap().get("applicationGlobalContext");
          StringBuffer resultsAsStr = new StringBuffer();
          resultsAsStr.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
      DocType type = XRegClientConstants.DocType.valueOf(doctype);
            switch (type) {
            case AppDesc:
              String [] splitNames = objectName.split("#");
            if(splitNames != null && splitNames.length == 2){
              resultsAsStr.append(context.getRegService().getAppDesc(splitNames[0], splitNames[1]));
            }else{
              throw new GfacException("Input is wrong. Send Application Name and Host Name concat by #",FaultCode.InvaliedLocalArgumnet);
            }
                break;
            case ServiceDesc:
              resultsAsStr.append(context.getRegService().getServiceMap(objectName));
                break;
            case HostDesc:
              resultsAsStr.append(context.getRegService().getHostDesc(objectName));
                break;
            default:
              return ServiceConstants.ERROR_STATUS;
            }
            System.out.println(resultsAsStr);
View Full Code Here

  public ServiceParam[] getOutPrm() {
    return outPrm;
  }
  public static void main(String[] args) {
    try {
      ApplicationGlobalContext context = new ApplicationGlobalContext();
      // Set MyProxy user password to run this
    //  context.setMyproxyUserID("");
    //  context.setMyproxyPass("");
      context.login();
      ServiceBean bean = new ServiceBean(context);
      System.out.println(bean.applicationOptions);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

    }

  }
  public static void main(String[] args) {
    try {
      ApplicationGlobalContext context = new ApplicationGlobalContext();
      // Set MyProxy user password to run this

      context.login();

      HostBean bean = new HostBean(context);
      bean.setHostName("bigred.teragrid.iu.edu");
      bean.setTmpDir("/N/dc/projects/lead/scratch/pub-workdirs/");
      //need to fix this after asking raman
View Full Code Here

TOP

Related Classes of edu.indiana.extreme.gfac.beanutils.ApplicationGlobalContext

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.