Package org.apache.cocoon.portal.coplet

Examples of org.apache.cocoon.portal.coplet.CopletData


    public void resetValue(Object object) {
        ((CopletDataManager) object).getCopletData().clear();
    }

    public void setValue(Object object, Object value) {
        CopletData data = (CopletData) value;
        ((CopletDataManager) object).getCopletData().put(data.getId(), data);
    }
View Full Code Here


        this.parameters = parameters;
        this.request = ObjectModelHelper.getRequest(objectModel);

        this.copletInstanceData = getInstanceData(this.manager, objectModel, parameters);

        final CopletData copletData = this.copletInstanceData.getCopletData();

        final String startURI = (String)copletData.getAttribute(START_URI);

        this.link = (String) this.copletInstanceData.getTemporaryAttribute(LINK);

        this.documentBase = (String) this.copletInstanceData.getAttribute(DOCUMENT_BASE);

        if (this.link == null) {
            this.link = startURI;
        }

        if (documentBase == null) {
            this.documentBase = this.link.substring(0, this.link.lastIndexOf('/') + 1);
            copletInstanceData.setAttribute(DOCUMENT_BASE, this.documentBase);
        }

        this.configuredEncoding = encodingConstantFromString((String)copletData.getAttribute("encoding"));
        this.userAgent = (String)copletData.getAttribute("user-agent");
        this.envelopeTag = parameters.getParameter(ENVELOPE_TAG_PARAMETER, this.defaultEnvelopeTag);

        if (envelopeTag == null) {
            throw new ProcessingException("Can not initialize ProxyTransformer - sitemap parameter 'envelope-tag' missing");
        }
View Full Code Here

            copletInstanceDataManager = (CopletInstanceDataManager) adapter.loadProfile(map, parameters);

            CopletFactory copletFactory = service.getComponentManager().getCopletFactory();
            Iterator iterator = copletDataManager.getCopletData().values().iterator();
            while (iterator.hasNext()) {
                CopletData cd = (CopletData) iterator.next();
                copletFactory.prepare(cd);
            }
            iterator = copletInstanceDataManager.getCopletInstanceData().values().iterator();
            while (iterator.hasNext()){
                CopletInstanceData cid = (CopletInstanceData) iterator.next();
View Full Code Here

      if(val.booleanValue()) {
        coplets.add(row.getChild("coplet").getValue());
      }
    }
    for(Iterator it = lets.iterator(); it.hasNext();) {
      CopletData cd = (CopletData) it.next();
      String cdid = cd.getId();
      for(Iterator it2 = coplets.iterator(); it2.hasNext();) {
        String cdidTmp = (String) it2.next();
        if(cdidTmp.equals(cdid))
          copletDatas.add(cd);
      }
    }
   
    for(Iterator it = copletDatas.iterator(); it.hasNext();) {
      CopletData cd = (CopletData) it.next();
     
      try {
        CopletInstanceData cinst = cf.newInstance(cd);
        CopletLayout lay = (CopletLayout) lf.newInstance("coplet");
        lay.setCopletInstanceData(cinst);
View Full Code Here

    CopletDataManager manager = (CopletDataManager)object;
   
    this.deltaApplied = true;

    Iterator iterator = manager.getCopletData().values().iterator();
    CopletData data, delta;
    while (iterator.hasNext()) {
      delta = (CopletData)iterator.next();
      data = this.getCopletData(delta.getId());
      if (data == null) {
        this.putCopletData(delta);
      } else {
        data.applyDelta(delta);
      }
    }
   
    return true;
  }
View Full Code Here

   */
  public void adjustReferences(Object object) {
    CopletDataManager manager = (CopletDataManager)object;
   
    Iterator iterator = this.copletData.values().iterator();
    CopletData data, other;
    while (iterator.hasNext()) {
      data = (CopletData)iterator.next();
      if (!data.deltaApplied()) {
        other = manager.getCopletData(data.getId());
        if (other != null) {
          this.putCopletData(other);
        }
      }
    }
View Full Code Here

     * @see org.apache.cocoon.portal.coplet.adapter.impl.AbstractCopletAdapter#login(org.apache.cocoon.portal.coplet.CopletInstanceData)
     */
    public void login(CopletInstanceData coplet) {
        super.login(coplet);

        final CopletData copletData = coplet.getCopletData();

        // get the producer
        final String producerId = (String) copletData.getAttribute("producer-id");
        if ( producerId == null ) {
            // if the producer can't be found, we simply return
            this.getLogger().error("Producer not configured in wsrp coplet " + copletData.getId());
            return;           
        }
        final Producer producer = consumerEnvironment.getProducerRegistry().getProducer(producerId);
        if ( producer == null ) {
            // if the producer can't be found, we simply return
            this.getLogger().error("Producer with id " + producerId + " not found.");
            return;
        }

        // get the wsrp user and store it as an attribute on the instance
        final String currentUserID = this.service.getComponentManager().getProfileManager().getUser().getUserName();      
        User user = this.consumerEnvironment.getUserRegistry().getUser(currentUserID);
        if ( user == null ) {
            // create a new user
            user = new UserImpl(currentUserID);
            user.setUserContext(this.userContextProvider.createUserContext(currentUserID));
            this.consumerEnvironment.getUserRegistry().addUser(user);
        }
        coplet.setTemporaryAttribute(ATTRIBUTE_NAME_USER, user);

        // get the portlet handle
        final String portletHandle = (String) copletData.getAttribute("portlet-handle");
        if ( portletHandle == null ) {
            // if the portlet handle can't be found, we simply return
            this.getLogger().error("Portlet handle not configured in wsrp coplet " + copletData.getId());
            return;           
        }

        // get the wsrp portlet
        final PortletKey portletKey = new PortletKeyImpl(portletHandle, producerId);
View Full Code Here

        ((LayoutFactory)factory).prepareLayout((Layout)object);
      } else if (object instanceof CopletDataManager) {
        CopletFactory copletFactory = (CopletFactory)factory;
        Iterator iterator = ((CopletDataManager)object).getCopletData().values().iterator();
        while (iterator.hasNext()) {
          CopletData cd = (CopletData)iterator.next();
          copletFactory.prepare(cd);
        }
      } else if (object instanceof CopletInstanceDataManager) {
        CopletFactory copletFactory = (CopletFactory)factory;
        Iterator iterator = ((CopletInstanceDataManager)object).getCopletInstanceData().values().iterator();
View Full Code Here

     * Get a configuration value
     * First the coplet data is queried and if it doesn't provide an
     * attribute with the given name, the coplet base data is used.
     */
    protected Object getConfiguration(CopletInstanceData coplet, String key) {
        CopletData copletData = coplet.getCopletData();
        Object data = copletData.getAttribute( key );
        if ( data == null) {
            data = copletData.getCopletBaseData().getCopletConfig().get( key );
        }
        return data;
    }
View Full Code Here

        ProfileManager profileManager = null;
        try {
            profileManager =
                (ProfileManager) this.manager.lookup(ProfileManager.ROLE);

            CopletData copletData = coplet.getCopletData();

            LayoutFactory lfac =
                (LayoutFactory) this.manager.lookup(LayoutFactory.ROLE);

            CopletLayout copletLayout =
View Full Code Here

TOP

Related Classes of org.apache.cocoon.portal.coplet.CopletData

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.