Package org.jasig.portal

Examples of org.jasig.portal.ChannelRuntimeData


  /** Constructs a CNumberGuess.
   */
  public CNumberGuess ()
  {
    this.staticData = new ChannelStaticData ();
    this.runtimeData = new ChannelRuntimeData ();
  }
View Full Code Here


   * @param uid a unique ID used to identify the state of the channel
   */
  public void renderXML (ContentHandler out, String uid) throws PortalException {
    ChannelState channelState = (ChannelState)channelStateMap.get(uid);
    ChannelStaticData staticData = channelState.getStaticData();
    ChannelRuntimeData runtimeData = channelState.getRuntimeData();

    Document doc = null;
    try {
      doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
    } catch (ParserConfigurationException pce) {
      log.error("Error obtaining a Document", pce);
      throw new GeneralRenderingException(pce);
    }

    // Create XML doc
    Element appletE = doc.createElement("applet");
    appletE.setAttribute("code", staticData.getParameter("code"));
    appletE.setAttribute("codebase", staticData.getParameter("codeBase"));
    appletE.setAttribute("width", staticData.getParameter("width"));
    appletE.setAttribute("height", staticData.getParameter("height"));
    appletE.setAttribute("align", "top");
    appletE.setAttribute("border", "0");
    appletE.setAttribute("archive", staticData.getParameter("archive"));

    // Take all parameters whose names start with "APPLET." and pass them
    // to the applet (after stripping "APPLET.")
    java.util.Enumeration allKeys = staticData.keys ();
    while (allKeys.hasMoreElements()) {
      String p = (String)allKeys.nextElement();
      if (p.startsWith ("APPLET.")) {
        Element paramE = doc.createElement("param");
        paramE.setAttribute("name", p.substring(7) /*skip "APPLET."*/);
        paramE.setAttribute("value", (String)staticData.getParameter(p));
        appletE.appendChild(paramE);
      }
    }

    doc.appendChild(appletE);

    XSLT xslt = XSLT.getTransformer(this, runtimeData.getLocales());
    xslt.setXML(doc);
    xslt.setXSL(sslLocation, "main", runtimeData.getBrowserInfo());
    xslt.setTarget(out);
    xslt.transform();
  }
View Full Code Here

  }

  private String getKey(String uid) {
    ChannelState channelState = (ChannelState)channelStateMap.get(uid);
    ChannelStaticData staticData = channelState.getStaticData();
    ChannelRuntimeData runtimeData = channelState.getRuntimeData();

    StringBuffer sbKey = new StringBuffer(1024);
    sbKey.append("org.jasig.portal.channels.CApplet").append(": ");
    sbKey.append("xslUri:");
    try {
      String sslUrl = ResourceLoader.getResourceAsURLString(this.getClass(), sslLocation);
      sbKey.append(XSLT.getStylesheetURI(sslUrl, runtimeData.getBrowserInfo())).append(", ");
    } catch (PortalException pe) {
      sbKey.append("Not available, ");
    }
    sbKey.append("staticData:").append(staticData.toString());
    sbKey.append("locales:").append(LocaleManager.stringValueOf(runtimeData.getLocales()));

    return sbKey.toString();
  }
View Full Code Here


  public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    if (initialized) {
      // construct runtime data object
      ChannelRuntimeData rd = new ChannelRuntimeData();
      rd.setBrowserInfo(new BrowserInfo(req));

      for (Enumeration en = req.getParameterNames(); en.hasMoreElements();) {
        String pName = (String)en.nextElement();
        if (!pName.startsWith("uP_")) {
          String[] val = (String[])req.getParameterValues(pName);
          rd.put(pName, val);
        }
      }

      try {
          rd.setUPFile(new UPFileSpec(null,UPFileSpec.RENDER_METHOD,"servletRoot","singlet",null));
      } catch (PortalException pe) {
        LOG.error("unable to construct a UPFile !",pe);
      }
     
      if (channel instanceof IPrivilegedChannel) {
View Full Code Here

  protected IUserLayoutStore ulsdb;
  private boolean initialized=false;
  UserProfile editedProfile=null;

  public CUserPreferences() throws PortalException {
    this.runtimeData = new ChannelRuntimeData();
    this.set = new StylesheetSet(this.getClass().getResource(sslLocation).toString());
    this.set.setMediaProps("/properties/media.properties");

    manageProfiles = new ManageProfilesState(this);
    ulsdb = UserLayoutStoreFactory.getUserLayoutStoreImpl();
View Full Code Here

    * @throws PortalException
    */
   public void renderXML (ContentHandler out, String uid) throws PortalException {
      Utility.logMessage("DEBUG", this.getClass().getName() + "::renderXML(): this = " + this);
      CGroupsManagerSessionData sessionData = getSessionData(uid);
      ChannelRuntimeData runtimeData= sessionData.runtimeData;
      long time1 = Calendar.getInstance().getTime().getTime();
      long time2 = 0;
      Document viewDoc = null;
      try {
         if (sessionData.servantChannel != null) {
            ((IChannel)sessionData.servantChannel).renderXML(out);
            Utility.logMessage("DEBUG", this.getClass().getName() + ".renderXML(): Defering to servant render");
         }
         else {
            viewDoc = sessionData.model;
            time2 = Calendar.getInstance().getTime().getTime();
            XSLT xslt = XSLT.getTransformer(this, runtimeData.getLocales());
            xslt.setXML(viewDoc);
            xslt.setTarget(out);
            xslt.setStylesheetParameter("baseActionURL", sessionData.runtimeData.getBaseActionURL());
           if (sessionData.isAdminUser) {
               xslt.setStylesheetParameter("ignorePermissions", "true");
            }
            if (sessionData.customMessage !=null) {
               xslt.setStylesheetParameter("customMessage", sessionData.customMessage);
            }
            xslt.setStylesheetParameter("mode", sessionData.mode);
            xslt.setStylesheetParameter("page", String.valueOf(sessionData.currentPage));
            if (sessionData.highlightedGroupID != null) {
               xslt.setStylesheetParameter("highlightedGroupID", sessionData.highlightedGroupID);
            }
            if (sessionData.rootViewGroupID != null) {
               xslt.setStylesheetParameter("rootViewGroupID", sessionData.rootViewGroupID);
            }
            else if (sessionData.defaultRootViewGroupID != null){
              xslt.setStylesheetParameter("rootViewGroupID", sessionData.defaultRootViewGroupID);
            }
            if (sessionData.feedback != null) {
               xslt.setStylesheetParameter("feedback", sessionData.feedback);
               sessionData.feedback = null;
            }
            if (sessionData.servantMode) {
               xslt.setStylesheetParameter("grpServantMode", "true");
            }
            if (!sessionData.allowFinish) {
              xslt.setStylesheetParameter("blockFinishActions", "true");
            }
            // now handled in the permissions policy
            //if (sessionData.blockEntitySelect) {
            //  xslt.setStylesheetParameter("blockEntitySelect", "true");
            //}
            try {
               //Utility.logMessage("DEBUG", this.getClass().getName()
               //        + ".renderXML(): grpView=" + runtimeData.getParameter("grpView"));
               xslt.setXSL(sslLocation, "main", sessionData.runtimeData.getBrowserInfo());
               xslt.transform();
            }
            catch (PortalException pe){
               Utility.logMessage("ERROR", pe.toString(), pe);
               if (pe.getCause()!=null){
                Utility.logMessage("ERROR", pe.getCause().toString(), pe.getCause());
               }
            }
            catch (Exception e) {
               Utility.logMessage("ERROR", e.toString(), e);
            }
            //Utility.printDoc(viewDoc, "viewXMl ready:\n");

            Utility.logMessage("DEBUG","CGroupsManager::renderXML(): Servant services complete");
            /* @todo remove following print statement */
            Utility.printDoc(viewDoc, "CGroupsManager::renderXML(): Final document state:");
         }
      } catch (Exception e) {
         Utility.logMessage("ERROR", e.toString(), e);
      }
      //Utility.logMessage("DEBUG", this.getClass().getName() + "::renderXML(): Finished with Groups Management");
      //Utility.logMessage("DEBUG", this.getClass().getName() + "::renderXML(): =-+_=-+_=-+_=-+_=-+_=-+_=-+_=-+_ XXXXXXXXXXXXXX _=-+_=-+_=-+_=-+_=-+_=-+_=-+_=-+_");
      long time3 = Calendar.getInstance().getTime().getTime();
      Utility.logMessage("DEBUG", this.getClass().getName() + ".renderXML() timer: "
            + String.valueOf((time3 - time1)) + " ms total, xsl took " + String.valueOf((
            time3 - time2)) + " ms for view " + runtimeData.getParameter("grpView"));
      Utility.logMessage("DEBUG", this.getClass().getName() + ".renderXML() time since setRD: "
            + String.valueOf((time3 - sessionData.startRD)));
      return;
   }
View Full Code Here

    */
   public void setRuntimeData (ChannelRuntimeData rd, String uid) {
      Utility.logMessage("DEBUG", this.getClass().getName() + "::setRuntimeData(): this = " + this);
      CGroupsManagerSessionData sessionData = getSessionData(uid);
      sessionData.runtimeData = rd;
      ChannelRuntimeData runtimeData= sessionData.runtimeData;
      sessionData.startRD = Calendar.getInstance().getTime().getTime();
      if(sessionData.servantChannel == null){
        if (Utility.hasValue(runtimeData.getParameter("grpCommand"))) {
            String theCommand = runtimeData.getParameter("grpCommand");
            Utility.logMessage("DEBUG", this.getClass().getName() + "::renderXML(): COMMAND PROCESS About to get the'"
                  + theCommand + "' command");
            IGroupsManagerCommand c = GroupsManagerCommandFactory.get(theCommand);
            Utility.logMessage("DEBUG", this.getClass().getName() + "::renderXML(): Got the '"
                  + theCommand + "' command = " + (c != null));
            if (c != null) {
               Utility.logMessage("DEBUG", this.getClass().getName() + "::renderXML(): setup parms and about to execute command");
               try{
                c.execute(sessionData);
               }
               catch(Exception e){
                  Utility.logMessage("ERROR", e.toString(), e);
                  sessionData.feedback = "Error executing command "+theCommand+": "+e.getMessage();
               }
            }
         }
         if (Utility.hasValue(runtimeData.getParameter("grpPageForward"))){
            sessionData.currentPage += Integer.parseInt(runtimeData.getParameter("grpPageForward"));
         }
         if (Utility.hasValue(runtimeData.getParameter("grpPageBack"))){
            sessionData.currentPage -= Integer.parseInt((String)runtimeData.getParameter("grpPageBack"));
         }
      }

      if (sessionData.servantChannel != null) {
         try {
            Utility.logMessage("DEBUG", this.getClass().getName() + ".setRuntimeData(): Setting Servant runtimedata");
            ((IChannel)sessionData.servantChannel).setRuntimeData(sessionData.runtimeData);
            if (sessionData.servantChannel.isFinished()) {
               sessionData.servantChannel = null;
               // flushing runtimedata for case where GroupsManager is master and servant, to prevent dirtiness
               Enumeration rd2 = runtimeData.keys();
               while (rd2.hasMoreElements()) {
                  runtimeData.remove(rd2.nextElement());
               }
               Utility.logMessage("DEBUG", this.getClass().getName() +
                     ".setRuntimeData(): removed servant");
            }
            else {
View Full Code Here

    * @return boolean
    */
   public boolean isCacheValid (Object validity, String uid) {
      Utility.logMessage("DEBUG", this.getClass().getName() + "::isCacheValid(): this = " + this);
      CGroupsManagerSessionData sessionData = getSessionData(uid);
      ChannelRuntimeData runtimeData= sessionData.runtimeData;
      boolean valid = false;
      if (sessionData.servantChannel == null) {
         if (validity != null) {
            if (validity.equals(vKey(uid)) && runtimeData.get("grpCommand") == null) {
               valid = true;
            }
         }
         long time3 = Calendar.getInstance().getTime().getTime();
         Utility.logMessage("DEBUG", this.getClass().getName() + ".isCacheValid() time since setRD: "
View Full Code Here

        }
    }
       
    protected void initPortletWindow(String uid) throws PortalException {
        ChannelState channelState = (ChannelState)channelStateMap.get(uid);
        ChannelRuntimeData rd = channelState.getRuntimeData();
        ChannelStaticData sd = channelState.getStaticData();
        ChannelData cd = channelState.getChannelData();
        PortalControlStructures pcs = channelState.getPortalControlStructures();
       
        try {
View Full Code Here

            final StringWriter sw = new StringWriter();
            HttpServletResponse wrappedResponse = ServletObjectAccess.getStoredServletResponse(pcs.getHttpServletResponse(), new PrintWriter(sw));
          
                                               
            //Use the parameters from the last request so the portlet maintains it's state
            final ChannelRuntimeData rd = channelState.getRuntimeData();
            final String sessionParamsKey = REQUEST_PARAMS_KEY + "." + uid;
            if (!rd.isTargeted()) {
                final HttpSession portalSession = pcs.getHttpServletRequest().getSession(false);
               
                final Map requestParams;
                if (portalSession != null) {
                    requestParams = (Map)portalSession.getAttribute(sessionParamsKey);
View Full Code Here

TOP

Related Classes of org.jasig.portal.ChannelRuntimeData

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.