Package org.jasig.portal

Examples of org.jasig.portal.ChannelRuntimeData


  }

  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.CImage").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


  /**
   * No-argument constructor for CSnoop.
   */
  public CSnoop () {
    this.runtimeData = new ChannelRuntimeData ();
  }
View Full Code Here

   * </iframe>
   */
  public void renderXML (ContentHandler out, String uid) throws PortalException {
    ChannelState channelState = (ChannelState)channelStateMap.get(uid);
    ChannelStaticData staticData = channelState.getStaticData();
    ChannelRuntimeData runtimeData = channelState.getRuntimeData();

    // Obtain url and height, both static parameters
    String srcUrl = staticData.getParameter("url"); // the url for the IFrame content
    String frameHeight = staticData.getParameter("height"); // the height of the IFrame in pixels

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

    // Create XML doc
    Element iframeE = doc.createElement("iframe");
    Element urlE = doc.createElement("url");
    urlE.appendChild(doc.createTextNode(srcUrl));
    iframeE.appendChild(urlE);
    Element heightE = doc.createElement("height");
    heightE.appendChild(doc.createTextNode(frameHeight));
    iframeE.appendChild(heightE);
    doc.appendChild(iframeE);

    XSLT xslt = XSLT.getTransformer(this, runtimeData.getLocales());
    xslt.setXML(doc);
    xslt.setXSL(sslLocation, getStylesheetTitle(runtimeData.getBrowserInfo().getUserAgent()), 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.CInlineFrame").append(": ");
    sbKey.append("xslUri:");
    try {
      String sslUrl = ResourceLoader.getResourceAsURLString(this.getClass(), sslLocation);
      String ssTitle = getStylesheetTitle(runtimeData.getBrowserInfo().getUserAgent());
      sbKey.append(XSLT.getStylesheetURI(sslUrl, ssTitle, 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

  private static final String sslLocation = "CPersonAttributes/CPersonAttributes.ssl";

  public void renderXML (ContentHandler out, String uid) throws PortalException {
    ChannelState channelState = (ChannelState)channelStateMap.get(uid);
    ChannelStaticData staticData = channelState.getStaticData();
    ChannelRuntimeData runtimeData = channelState.getRuntimeData();
    IPerson person = staticData.getPerson();
    Document doc = DocumentFactory.getNewDocument();

    Element attributesE = doc.createElement("attributes");
   
    IPersonAttributeDao pa = PersonDirectory.getPersonAttributeDao();
    Set possibleAttrs = pa.getPossibleUserAttributeNames();
   
    if (possibleAttrs != null)
        possibleAttrs = new HashSet(possibleAttrs);
    else
        possibleAttrs = new HashSet();
   
    for (Enumeration attribs = person.getAttributeNames(); attribs.hasMoreElements(); ) {
      // Get the attribute name
      String attName = (String) attribs.nextElement();
     
      // Remove this attr from the list of possible attrs
      possibleAttrs.remove(attName);
     
      // Set the attribute
      Element attributeE = doc.createElement("attribute");

      Element nameE = doc.createElement("name");
      nameE.appendChild(doc.createTextNode(attName));
      attributeE.appendChild(nameE);

      // Get the IPerson attribute value for this eduPerson attribute name
      if (person.getAttributeValues(attName) != null) {
        Object[] values = person.getAttributeValues(attName);
        for (int i = 0; i < values.length; i++) {
           if (log.isTraceEnabled())
               log.trace("type of value["+i+"] is " + values[i].getClass().getName());
           String value = values[i].toString();
           Element valueE = doc.createElement("value");
           valueE.appendChild(doc.createTextNode(value));
           attributeE.appendChild(valueE);
        }
      }

      attributesE.appendChild(attributeE);
    }
   
    //Sort the set of possible attributes
    possibleAttrs = new TreeSet(possibleAttrs);
   
    //Add the unknown attributes to the element list.
    for (Iterator attribs = possibleAttrs.iterator(); attribs.hasNext(); ) {
        // Get the attribute name
        String attName = (String) attribs.next();
       
        // Set the attribute
        Element attributeE = doc.createElement("attribute");

        Element nameE = doc.createElement("name");
        nameE.appendChild(doc.createTextNode(attName));
        attributeE.appendChild(nameE);

        attributesE.appendChild(attributeE);
    }

    doc.appendChild(attributesE);

    XSLT xslt = XSLT.getTransformer(this, runtimeData.getLocales());
    xslt.setXML(doc);
    xslt.setStylesheetParameter("baseActionURL",runtimeData.getBaseActionURL());
    xslt.setStylesheetParameter("downloadWorkerURL",
                                 runtimeData.getBaseWorkerURL(UPFileSpec.FILE_DOWNLOAD_WORKER,true));
    xslt.setXSL(sslLocation, runtimeData.getBrowserInfo());
    xslt.setTarget(out);
    xslt.transform();
  }
View Full Code Here

        // In the future however, we may need a way to deliver different
        // attributes as differenct mimetypes (e.g certs).
        //
        String mimetype;
        ChannelState channelState = (ChannelState)channelStateMap.get(uid);
        ChannelRuntimeData runtimeData = channelState.getRuntimeData();
        // runtime parameter "attribute" determines which attribute to return when
        // called as an IMimeResponse.
        String attrName = runtimeData.getParameter("attribute");

        if ("jpegPhoto".equals(attrName)) {
            mimetype="image/jpeg";
        }
        else {
View Full Code Here

     * Returns null if the code needs the OutputStream object
     */
    public java.io.InputStream getInputStream (String uid) throws IOException {
        ChannelState channelState = (ChannelState)channelStateMap.get(uid);
        ChannelStaticData staticData = channelState.getStaticData();
        ChannelRuntimeData runtimeData = channelState.getRuntimeData();

        String attrName = runtimeData.getParameter("attribute");
        IPerson person = staticData.getPerson();

        if ( attrName == null ) {
            attrName = "";
        }
View Full Code Here

    public java.lang.String getName (String uid) {
        // As noted above the only attribute we support right now is "image/jpeg" for
        // the jpegPhoto attribute.

        ChannelState channelState = (ChannelState)channelStateMap.get(uid);
        ChannelRuntimeData runtimeData = channelState.getRuntimeData();
        String payloadName;
        if ("jpegPhoto".equals(runtimeData.getParameter("attribute")))
            payloadName = "image.jpg";
        else
            payloadName = "unknown";
        return payloadName;
    }
View Full Code Here

                    + channelSubscribeId);
            if (chFate != null) {
                // a fate has been chosen
                if (chFate.equals("retry")) {
                    // clean things up for the channel
                    ChannelRuntimeData crd = (ChannelRuntimeData) this.runtimeData
                            .clone();
                    crd.clear(); // Remove parameters
                    try {
                        if (this.the_channel instanceof IPrivilegedChannel)
                            ((IPrivilegedChannel) this.the_channel)
                                    .setPortalControlStructures(this.portcs);
                        this.the_channel.setRuntimeData(crd);
                        ChannelManager cm = this.portcs.getChannelManager();
                        cm.setChannelInstance(channelSubscribeId,
                                this.the_channel);
                        this.the_channel.renderXML(out);
                        return;
                    } catch (Exception e) {
                        // if any of the above didn't work, fall back to the
                        // error channel
                        resetCError(ErrorCode.SET_RUNTIME_DATA_EXCEPTION, e,
                                channelSubscribeId, this.the_channel,
                                "Channel failed a refresh attempt.");
                    }
                } else if (chFate.equals("restart")) {

                    ChannelManager cm = this.portcs.getChannelManager();

                    ChannelRuntimeData crd =
                        (ChannelRuntimeData) this.runtimeData.clone();
                    crd.clear();
                    try {
                        if ((this.the_channel = cm
                                .instantiateChannel(channelSubscribeId)) == null) {
                            resetCError(ErrorCode.GENERAL_ERROR, null,
                                    channelSubscribeId, null,
View Full Code Here

            if (chFate != null) {
                // a fate has been chosen
                if (chFate.equals("retry")) {
                    log.debug("CError:renderCharacters() : going for retry");
                    // clean things up for the channel
                    ChannelRuntimeData crd = (ChannelRuntimeData) this.runtimeData
                            .clone();
                    crd.clear(); // Remove parameters
                    try {
                        if (this.the_channel instanceof IPrivilegedChannel)
                            ((IPrivilegedChannel) this.the_channel)
                                    .setPortalControlStructures(this.portcs);
                        this.the_channel.setRuntimeData(crd);
                        ChannelManager cm = this.portcs.getChannelManager();
                        cm.setChannelInstance(channelSubscribeId,
                                this.the_channel);
                        if (this.the_channel instanceof ICharacterChannel) {
                            ((ICharacterChannel) this.the_channel)
                                    .renderCharacters(out);
                        } else {
                            ThemeStylesheetDescription tsd = this.portcs
                                    .getUserPreferencesManager()
                                    .getThemeStylesheetDescription();
                            BaseMarkupSerializer serOut = MEDIAMANAGER
                                    .getSerializerByName(tsd
                                            .getSerializerName(), out);
                            this.the_channel.renderXML(serOut);
                        }
                        return;
                    } catch (Exception e) {
                        // if any of the above didn't work, fall back to the
                        // error channel
                        resetCError(ErrorCode.SET_RUNTIME_DATA_EXCEPTION, e,
                                channelSubscribeId, this.the_channel,
                                "Channel failed a refresh attempt.");
                    }
                } else if (chFate.equals("restart")) {
                    log
                            .debug("CError:renderCharacters() : going for reinstantiation");

                    ChannelManager cm = this.portcs.getChannelManager();

                    ChannelRuntimeData crd = (ChannelRuntimeData) this.runtimeData
                            .clone();
                    crd.clear();
                    try {
                        this.the_channel = cm
                        .instantiateChannel(channelSubscribeId);
                        if (this.the_channel == null) {
                            resetCError(ErrorCode.GENERAL_ERROR, null,
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.