Package org.apache.cocoon.portal

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) {
        } finally {
            this.manager.release(service);
        }
View Full Code Here


  /* (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);

            // are we running inside a coplet?
            final Map context = (Map)objectModel.get(ObjectModelHelper.PARENT_CONTEXT);
            if (context == null) {
                // set portal name
                portalService.setPortalName((String)objectModel.get(Constants.PORTAL_NAME_KEY));
            }
           
            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

    /**
     * Overridden from superclass.
     */
  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 ) {
                    // set portal name
                    portalService.setPortalName((String)objectModel.get(Constants.PORTAL_NAME_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

    /* (non-Javadoc)
     * @see org.apache.cocoon.portal.event.EventConverter#encode(org.apache.cocoon.portal.event.Event)
     */
    public String encode(Event event) {
        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);
            List list = (List)service.getAttribute(ENCODE_LIST);
            if ( null == list ) {
                list = new ArrayList();
                service.setAttribute(ENCODE_LIST, list);
            }
            int index = list.indexOf(event);
            if ( index == -1 ) {
                list.add(event);
                index = list.size() - 1;
View Full Code Here

    /* (non-Javadoc)
     * @see org.apache.cocoon.portal.event.EventConverter#decode(java.lang.String)
     */
    public Event decode(String value) {
        if (value != null) {
            PortalService service = null;
            try {
                service = (PortalService)this.manager.lookup(PortalService.ROLE);
                List list = (List)service.getAttribute(DECODE_LIST);
                if ( null != list ) {
                    int index = new Integer(value).intValue();
                    if (index < list.size()) {
                        return (Event)list.get(index);
                    }
View Full Code Here

    /* (non-Javadoc)
     * @see org.apache.cocoon.portal.event.EventConverter#start()
     */
    public void start() {
        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);
            List list = (List)service.getAttribute(ENCODE_LIST);
            if ( null != list ) {
                service.setAttribute(DECODE_LIST, list);
                service.removeAttribute(ENCODE_LIST);
            }
        } catch (ServiceException ce) {
            throw new CascadingRuntimeException("Unable to lookup component.", ce);           
        } finally {
            this.manager.release(service);
View Full Code Here

   
    /* (non-Javadoc)
     * @see org.apache.cocoon.portal.event.EventConverter#finish()
     */
    public void finish() {
        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);
            service.removeAttribute(DECODE_LIST);
        } catch (ServiceException ce) {
            throw new CascadingRuntimeException("Unable to lookup component.", ce);           
        } finally {
            this.manager.release(service);
        }
View Full Code Here

    }
   
    public void saveUserProfiles() {
        final String layoutKey = this.getDefaultLayoutKey();
    ProfileLS adapter = null;
    PortalService service = null;
    try {
      adapter = (ProfileLS) this.manager.lookup(ProfileLS.ROLE);
      service = (PortalService) this.manager.lookup(PortalService.ROLE);
           
            RequestState state = this.getRequestState();
            UserHandler handler = state.getHandler();

      HashMap parameters = new HashMap();
      parameters.put("type", "user");
            parameters.put("config", state.getApplicationConfiguration().getConfiguration("portal").getChild("profiles"));
            parameters.put("handler", handler);
            parameters.put("profiletype", "copletinstancedata");

      Map key = this.buildKey(service, parameters, layoutKey, false);
 
      // save coplet instance data
            CopletInstanceDataManager profileManager = ((CopletInstanceDataManager)service.getAttribute("CopletInstanceData:" + layoutKey));
      adapter.saveProfile(key, parameters, profileManager);

      // save coplet instance data
      parameters.put("profiletype", "layout");
            key = this.buildKey(service, parameters, layoutKey, false);
      Layout layout = (Layout)service.getAttribute("Layout:" + layoutKey);
      adapter.saveProfile(key, parameters, layout);
           
    } catch (Exception e) {
      // TODO
      throw new CascadingRuntimeException("Exception during save profile", e);
View Full Code Here

                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

        }
        layout.initialize( layoutName, id );
        layout.setDescription( layoutDescription );
        layout.setAspectDataHandler((AspectDataHandler)o[1]);

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

TOP

Related Classes of org.apache.cocoon.portal.PortalService

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.