Examples of PortalService


Examples of org.apache.cocoon.portal.PortalService

   
    /**
     * Get the current user
     */
    protected String getUser() {
        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);
            return service.getComponentManager().getProfileManager().getUser().getUserName();
        } catch (ServiceException ignore) {
            // ignore this
        } finally {
            this.manager.release(service);
        }
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

  /* (non-Javadoc)
   * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
   */
  public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)
    throws Exception {
        PortalService portalService = null;
        try {

            portalService = (PortalService)this.manager.lookup(PortalService.ROLE);

            if ( portalService.getPortalName() == null ) {
                final String portalName = parameters.getParameter("portal-name",
                                              (String)objectModel.get(Constants.PORTAL_NAME_KEY));
                portalService.setPortalName(portalName);
            }
            return EMPTY_MAP;
       
        } catch (ServiceException e) {
            throw new ProcessingException("Unable to lookup portal service.", e);
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

    public void streamContent(final CopletInstanceData coplet,
                               final String uri,
                               final ContentHandler contentHandler)
    throws SAXException {
    Source copletSource = null;
    PortalService portalService = null;
    try {
      if (uri.startsWith("cocoon:")) {
                portalService = (PortalService)this.manager.lookup(PortalService.ROLE);

                Boolean handlePars = (Boolean)this.getConfiguration( coplet, "handleParameters");
               
                String sourceUri = uri;
               
                if ( handlePars != null && handlePars.booleanValue() ) {
                    List list = (List) portalService.getTemporaryAttribute(URICopletAdapter.class.getName());
                    if ( list != null && list.contains( coplet )) {
                        // add parameters
                        if ( uri.startsWith("cocoon:raw:") ) {
                            sourceUri = "cocoon:" + uri.substring(11);
                        }
                    } else {
                        // remove parameters
                        if (!uri.startsWith("cocoon:raw:") ) {
                            sourceUri = "cocoon:raw:" + uri.substring(7);
                        }
                    }
                }
               
        HashMap par = new HashMap();
        par.put(Constants.PORTAL_NAME_KEY, portalService.getPortalName());
        par.put(Constants.COPLET_ID_KEY, coplet.getId());
           
        copletSource = this.resolver.resolveURI(sourceUri, null, par);
      } else {
        copletSource = this.resolver.resolveURI(uri);
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

    /* (non-Javadoc)
     * @see org.apache.cocoon.portal.event.Subscriber#inform(org.apache.cocoon.portal.event.Event)
     */
    public void inform(Event e) {
        CopletInstanceEvent event = (CopletInstanceEvent)e;
        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);
            List list = (List)service.getTemporaryAttribute(URICopletAdapter.class.getName());
            if ( list == null ) {
                list = new ArrayList();
            }
            list.add(event.getTarget());
            service.setTemporaryAttribute(URICopletAdapter.class.getName(), list);
        } catch (ServiceException ignore ) {           
            // ignore
        } finally {
            this.manager.release(service);
        }
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

                                   ", objectModel="+objectModel+
                                   ", source="+source+
                                   ", par="+par);
        }

        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);
            service.getComponentManager().getProfileManager().saveUserProfiles(null);
        } catch (ServiceException ce) {
            throw new ProcessingException("Unable to lookup portal service.", ce);
        } finally {
            this.manager.release(service);
        }
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

            }
            this.configuration = null;
        }
        DefaultEventAspectContext context = new DefaultEventAspectContext(this.chain);
        EventConverter converter = null;
        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);
            converter = (EventConverter) this.manager.lookup(EventConverter.ROLE);
            Publisher publisher = this.getPublisher();
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

        if (this.configurationFile != null) {
            loadConfig();
        }

        Map result;
        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);

            PortalManager portalManager = null;
            try {
                portalManager = (PortalManager) this.manager.lookup(PortalManager.ROLE);
                portalManager.process();
            } finally {
                this.manager.release(portalManager);
            }
           
            final Request request = ObjectModelHelper.getRequest(objectModel);
            final Session session = request.getSession(false);
            final List events = new ArrayList();
           
            // is the history invoked?
            final String historyValue = request.getParameter(this.historyParameterName);
            if ( historyValue != null && session != null) {
                // get the history
                final List history = (List)session.getAttribute("portal-history");
                if ( history != null ) {
                    final int index = Integer.parseInt(historyValue);
                    final List state = (List)history.get(index);
                    if ( state != null ) {
                        final Iterator iter = state.iterator();
                        while ( iter.hasNext() ) {
                            Mapping m = (Mapping)iter.next();
                            events.add(m.getEvent(service, null));
                        }
                        while (history.size() > index ) {
                            history.remove(history.size()-1);
                        }
                    }
                }
            }
            Enumeration enumeration = request.getParameterNames();
            while (enumeration.hasMoreElements()) {
                String name = (String)enumeration.nextElement();
                String value = request.getParameter(name);
               
                Mapping m = (Mapping) this.eventMap.get(name);
                if ( m != null ) {
                    events.add(m.getEvent(service, value));
                }               
            }
            String uri = service.getComponentManager().getLinkService().getLinkURI(events);
            result = new HashMap();
            result.put("uri", uri.substring(uri.indexOf('?')+1));

        } catch (ServiceException ce) {
            throw new ProcessingException("Unable to lookup portal service.", ce);
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

     * @see org.apache.cocoon.portal.event.Subscriber#inform(org.apache.cocoon.portal.event.Event)
     */
    public void inform(Event event) {
        FullScreenCopletEvent e = (FullScreenCopletEvent) event;
        final Layout startingLayout = (CopletLayout)e.getLayout();
        PortalService portalService = null;
        try {
            portalService = (PortalService) this.manager.lookup(PortalService.ROLE);
            final Layout old = portalService.getEntryLayout(null);
            if ( old != null && old instanceof CopletLayout) {
                ((CopletLayout)old).getCopletInstanceData().setAspectData("fullScreen", Boolean.FALSE);
            }
            portalService.setEntryLayout( null, startingLayout );
            if ( startingLayout != null && startingLayout instanceof CopletLayout) {
                ((CopletLayout)startingLayout).getCopletInstanceData().setAspectData("fullScreen", Boolean.TRUE);
            }
        } catch (ServiceException ce) {
            // ignore
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

  /* (non-Javadoc)
   * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
   */
  public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)
    throws Exception {
        PortalService portalService = null;
        try {

            portalService = (PortalService)this.manager.lookup(PortalService.ROLE);

            // determine coplet id
            String copletId = null;           
            Map context = (Map)objectModel.get(ObjectModelHelper.PARENT_CONTEXT);
            if (context != null) {
                copletId = (String)context.get(Constants.COPLET_ID_KEY);
            } else {
                copletId = (String)objectModel.get(Constants.COPLET_ID_KEY);
            }
       
            if (copletId == null) {
                throw new ConfigurationException("copletId must be passed in the object model either directly (e.g. by using ObjectModelAction) or within the parent context.");
            }
       
            // now traverse parameters:
            // parameter name is path
            // parameter value is value
            // if the value is null or empty, the value is not set!
            final String[] names = parameters.getNames();
            if ( names != null ) {
                final Publisher publisher = portalService.getComponentManager().getEventManager().getPublisher();
                for(int i=0; i<names.length; i++) {
                    final String path = names[i];
                    final String value = parameters.getParameter(path, null );
                    if ( value != null && value.trim().length() > 0 ) {
                        final Event event = new CopletJXPathEvent(portalService.getComponentManager().getProfileManager().getCopletInstanceData(copletId),
                                path,
                                value);
                        publisher.publish(event);
                    }
                }
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

                AspectDescription adesc = DefaultAspectDescription.newInstance(aspectsConf[m]);
                desc.addAspectDescription( adesc );
            }
        }
        // now query all configured renderers for their aspects
        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);
            PortalComponentManager pcManager = service.getComponentManager();
           
            Iterator rendererIterator = desc.getRendererNames();
            while (rendererIterator.hasNext()) {
                final String rendererName = (String)rendererIterator.next();
                Renderer renderer = pcManager.getRenderer( rendererName );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.