Examples of PortalService


Examples of org.apache.cocoon.portal.PortalService

    /* (non-Javadoc)
     * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)
     */
    public Object getAttribute(String name, Configuration modeConf, Map objectModel)
    throws ConfigurationException {
        PortalService portalService = null;
        try {

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

            int pos = name.indexOf('/');
            String path;
            if ( pos == -1 ) {
                path = null;
            } else {
                path = name.substring(pos + 1);
                name = name.substring(0, pos);
            }
            // is the layout key specified?
            pos = name.indexOf(':');
            String layoutKey = null;
            String layoutId = name;
            if ( pos != -1 ) {
                layoutKey = name.substring(0, pos);
                layoutId = name.substring(pos + 1);
            }

            // get the layout
            final Object layout = portalService.getComponentManager().getProfileManager().getPortalLayout(layoutKey, layoutId);
            Object value = layout;
            if ( layout != null && path != null ) {
                final JXPathContext jxpathContext = JXPathContext.newContext(layout);
                value = jxpathContext.getValue(path);
            }
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

    /* (non-Javadoc)
     * @see org.apache.cocoon.components.modules.input.InputModule#getAttribute(java.lang.String, org.apache.avalon.framework.configuration.Configuration, java.util.Map)
     */
    public Object getAttribute(String name, Configuration modeConf, Map objectModel)
    throws ConfigurationException {
        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) {
                return null;
            }
           
            // return the coplet id
            if ( name.equals("#") ) {
                return copletId;
            }
            JXPathContext jxpathContext = JXPathContext.newContext(portalService.getComponentManager().getProfileManager().getCopletInstanceData(copletId));
            Object value = jxpathContext.getValue(name);
               
            if (value == null) {
                return null;
            }
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

  /**
   * @see PortalManager#showPortal(ContentHandler, Parameters)
   */
  public void showPortal(ContentHandler contentHandler, Parameters parameters)
    throws SAXException {
        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);
            // first check for a full screen layout
            Layout portalLayout = service.getEntryLayout(null);
            if ( portalLayout == null ) {
                portalLayout = service.getComponentManager().getProfileManager().getPortalLayout(null, null);
            }

            Renderer portalLayoutRenderer = service.getComponentManager().getRenderer( portalLayout.getRendererName());      

            contentHandler.startDocument();
            portalLayoutRenderer.toSAX(portalLayout, service, contentHandler);
            contentHandler.endDocument();
        } catch (ServiceException ce) {
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

                      Parameters par)
    throws ProcessingException, SAXException, IOException {
        super.setup(resolver, objectModel, src, par);
       
        // instantiate the portal service for this request
        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);
           
            // This is a fix: if we don't use the link service here, we get
            // in some rare cases a wrong uri!
            service.getComponentManager().getLinkService().getRefreshLinkURI();
           
        } 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

     * Constructor
     */
    public PortletURLProviderImpl(PortletWindow portletWindow,
                                  ServiceManager manager) {
        this.portletWindow = portletWindow;
        PortalService service = null;
        try {
            service = (PortalService) manager.lookup(PortalService.ROLE);
            this.linkService = service.getComponentManager().getLinkService();
        } catch (ServiceException se) {
            throw new CascadingRuntimeException("Unable to lookup portal service.", se);
        } finally {
            manager.release(service);
        }
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

    public static CopletInstanceData getInstanceData(ServiceManager manager,
                                                     String copletID,
                                                     String portalName)
    throws ProcessingException {
        PortalService portalService = null;
        try {
            portalService = (PortalService) manager.lookup(PortalService.ROLE);
               
            ProfileManager profileManager = portalService.getComponentManager().getProfileManager();
            CopletInstanceData data = profileManager.getCopletInstanceData(copletID);
            return data;
        } catch (ServiceException e) {
            throw new ProcessingException("Error getting portal service.", e);
        } finally {
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

    public static CopletInstanceData getInstanceData(ServiceManager manager,
                                                     Map objectModel,
                                                     Parameters parameters)
    throws ProcessingException {

        PortalService portalService = null;
        try {
            portalService = (PortalService) 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);
                if (copletId == null) {
                    throw new ProcessingException("copletId must be passed as parameter or in the object model within the parent context.");
                }
            } else {
                try {
                    copletId = parameters.getParameter(COPLET_ID_PARAM);

                } catch (ParameterException e) {
                    throw new ProcessingException("copletId and portalName must be passed as parameter or in the object model within the parent context.");
                }
            }
            return portalService.getComponentManager().getProfileManager().getCopletInstanceData(copletId);
        } catch (ServiceException e) {
            throw new ProcessingException("Error getting portal service.", e);
        } finally {
            manager.release(portalService);
        }
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) {
        CopletData data = (CopletData) ((CopletDataEvent)e).getTarget();
        PortalService service = null;
        List instances = null;
        try {
            service = (PortalService) this.manager.lookup(PortalService.ROLE);
            ProfileManager profileManager = service.getComponentManager().getProfileManager();
            instances = profileManager.getCopletInstanceData(data);
        } catch (Exception ignore) {
            // ignore exception
        } finally {
            this.manager.release(service);
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

     * @param event  The event triggering the action
     * @param basket The basket
     */
    protected void processShowItemEvent(ShowItemEvent event) {
        if ( event.getItem() instanceof ContentItem ) {
            PortalService service = null;
            try {
                service = (PortalService) this.manager.lookup(PortalService.ROLE);
               
                ContentItem ci = (ContentItem)event.getItem();
                CopletLayout layout = (CopletLayout) event.getLayout();
                CopletInstanceData cid = null;
                if ( ci.isContent() ) {
                    CopletData copletData = service.getComponentManager().getProfileManager().getCopletData(event.getCopletDataId());
                    cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
                    cid.setAttribute("item-content", ci.getContent());               
                } else {
                    if ( ci.getURL() != null ) {
                        SourceResolver resolver = null;
                        Source source = null;
                        String url = null;
                        try {
                            resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
                            url = ci.getURL();
                            source = resolver.resolveURI(url);
                            CopletData copletData = service.getComponentManager().getProfileManager().getCopletData(event.getCopletDataId());
                            cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
                            cid.setAttribute("item-content", IOUtil.toByteArray(source.getInputStream()));
                        } catch (IOException se) {
                            this.getLogger().warn("Unable to get content for " + url, se);
                        } catch (ServiceException se) {
                            this.getLogger().warn("Unable to get source resolver.", se);
                        } finally {
                            if ( source != null ) {
                                resolver.release(source);
                            }
                            this.manager.release(resolver);
                        }
                       
                    } else {
                        final CopletInstanceData original = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
                        final CopletData copletData = original.getCopletData();
                        cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
                        Map attributes = (Map) ci.getAttribute("coplet-attributes");
                        Iterator i = attributes.entrySet().iterator();
                        while ( i.hasNext() ) {
                            Map.Entry entry = (Map.Entry)i.next();
                            cid.setAttribute(entry.getKey().toString(), entry.getValue());
View Full Code Here

Examples of org.apache.cocoon.portal.PortalService

                    try {
                        resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
                        url = ci.getURL();
                        if ( url == null ) {
                        // copy coplet attributes
                        PortalService service = null;
                        try {
                            service = (PortalService) this.manager.lookup(PortalService.ROLE);
                            CopletInstanceData cid = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
                            url = "coplet://" + ci.getCopletId();
                            Map attributes = new HashMap();
                            Iterator i = cid.getAttributes().entrySet().iterator();
                            while ( i.hasNext() ) {
                                Map.Entry entry = (Map.Entry)i.next();
                                attributes.put(entry.getKey(), entry.getValue());
                        }
                            i = cid.getCopletData().getAttributes().entrySet().iterator();
                            while ( i.hasNext() ) {
                                Map.Entry entry = (Map.Entry)i.next();
                                attributes.put(entry.getKey(), entry.getValue());
                            }
                            ci.setAttribute("coplet-attributes", attributes);
                        } catch (ServiceException se) {
                            this.getLogger().warn("Unable to lookup portal service.", se);
                        } finally {
                            this.manager.release(service);
                        }
                        }
                        source = resolver.resolveURI(url);
                        ci.setContent(IOUtil.toByteArray(source.getInputStream()));
                    } catch (IOException se) {
                        this.getLogger().warn("Unable to get content for " + url, se);
                    } catch (ServiceException se) {
                        this.getLogger().warn("Unable to get source resolver.", se);
                    } finally {
                        if ( source != null ) {
                            resolver.release(source);
                        }
                        this.manager.release(resolver);
                    }
                } else if ( ci.getURL() == null ) {
                    // copy coplet attributes
                    PortalService service = null;
                    try {
                        service = (PortalService) this.manager.lookup(PortalService.ROLE);
                        CopletInstanceData cid = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
                        Map attributes = new HashMap();
                        Iterator i = cid.getAttributes().entrySet().iterator();
                        while ( i.hasNext() ) {
                            Map.Entry entry = (Map.Entry)i.next();
                            attributes.put(entry.getKey(), entry.getValue());
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.