Package org.apache.cocoon.portal.profile

Examples of org.apache.cocoon.portal.profile.ProfileLS


                                 boolean forcedLoad,
                                 PortalService service)
  throws Exception {
        final Map key = this.buildKey(service, parameters, layoutKey, true);

        ProfileLS adapter = null;
    try {
      adapter = (ProfileLS)this.manager.lookup(ProfileLS.ROLE);

      Object result = this.checkValidity(key, parameters, forcedLoad, adapter, service);
           
      if (!(result instanceof SourceValidity))
        return new Object[]{result, Boolean.FALSE};
      SourceValidity newValidity = (SourceValidity)result;

      this.lock.releaseReadLock();
      this.lock.writeLock();
     
      // check validity again in case of another thread has already loaded
      result = this.checkValidity(key, parameters, forcedLoad, adapter, service);
           
      if (!(result instanceof SourceValidity))
        return new Object[]{result, Boolean.FALSE};
      newValidity = (SourceValidity)result;

      Object object = adapter.loadProfile(key, parameters);
      this.prepareObject(object, factory);
      if (newValidity != null) {
                this.attributes.put(key, new Object[] {object, newValidity});
      }
View Full Code Here


  /**
   * Loads a profile.
   */
    protected Object loadProfile(Object key, Map map, Object factory)
  throws Exception {
        ProfileLS adapter = null;
    try {
      adapter = (ProfileLS) this.manager.lookup(ProfileLS.ROLE);

      Object object = adapter.loadProfile(key, map);
      this.prepareObject(object, factory);

      return object;
    } finally {
      this.manager.release((Component) adapter);
View Full Code Here

     * @see org.apache.cocoon.portal.profile.ProfileManager#getPortalLayout(String, String)
     */
    public Layout getPortalLayout(String layoutKey, String layoutID)
    {
        PortalService service = null;
        ProfileLS adapter = null;
        try
        {
            service = (PortalService) this.manager.lookup(PortalService.ROLE);

            if (layoutKey == null)
            {
                Layout l = getEntryLayout();
                if (null != l)
                {
                    return l;
                }
                layoutKey = getDefaultLayoutKey();
            }

            String serviceKey = LAYOUTKEY_PREFIX + layoutKey;
            Object[] objects = (Object[]) service.getAttribute(serviceKey);

            // check if the layout is already cached and still valid
            int valid = SourceValidity.INVALID;
            SourceValidity sourceValidity = null;
            if (objects != null)
            {
                sourceValidity = (SourceValidity) objects[1];
                valid = sourceValidity.isValid();
                Layout layout = null;
                if (valid == SourceValidity.VALID)
                    layout = (Layout) ((Map) objects[0]).get(layoutID);
                if (layout != null)
                    return layout;
            }

            CopletInstanceDataManager copletInstanceDataManager = getCopletInstanceDataManager(service);

            Map parameters = new HashMap();
            parameters.put("profiletype", "layout");
            parameters.put("objectmap", copletInstanceDataManager.getCopletInstanceData());

            Map map = new SequencedHashMap();
            map.put("base", this.profilesPath);
            map.put("portalname", service.getPortalName());
            map.put("profile", "layout");
            map.put("groupKey", layoutKey);

            adapter = (ProfileLS) this.manager.lookup(ProfileLS.ROLE);
            SourceValidity newValidity = adapter.getValidity(map, parameters);
            if (valid == SourceValidity.UNKNOWN)
            {
                if (sourceValidity.isValid(newValidity) == SourceValidity.VALID)
                {
                    return (Layout) ((Map) objects[0]).get(layoutID);
                }
            }

            // get Layout specified in the map
            Layout layout = (Layout) adapter.loadProfile(map, parameters);
            Map layouts = new HashMap();

            layouts.put(null, layout); //save root with null as key
            cacheLayouts(layouts, layout);

View Full Code Here

        CopletInstanceDataManager copletInstanceDataManager =
            (CopletInstanceDataManager) this.copletInstanceDataManagers.get(portalName);
        if (copletInstanceDataManager != null)
            return copletInstanceDataManager;

        ProfileLS adapter = null;
        try
        {
            adapter = (ProfileLS) this.manager.lookup(ProfileLS.ROLE);

            Map parameters = new HashMap();
            parameters.put("profiletype", "copletbasedata");
            parameters.put("objectmap", null);

            Map map = new SequencedHashMap();
            map.put("base", this.profilesPath);
            map.put("portalname", service.getPortalName());
            map.put("profile", "coplet");
            map.put("name", "basedata");
            CopletBaseDataManager copletBaseDataManager = (CopletBaseDataManager) adapter.loadProfile(map, parameters);

            //CopletData
            parameters.clear();
            parameters.put("profiletype", "copletdata");
            parameters.put("objectmap", copletBaseDataManager.getCopletBaseData());

            map.clear();
            map.put("base", this.profilesPath);
            map.put("portalname", service.getPortalName());
            map.put("profile", "coplet");
            map.put("name", "data");
            CopletDataManager copletDataManager = (CopletDataManager) adapter.loadProfile(map, parameters);

            //CopletInstanceData
            parameters.clear();
            parameters.put("profiletype", "copletinstancedata");
            parameters.put("objectmap", copletDataManager.getCopletData());

            map.clear();
            map.put("base", this.profilesPath);
            map.put("portalname", service.getPortalName());
            map.put("profile", "coplet");
            map.put("name", "instancedata");
            copletInstanceDataManager = (CopletInstanceDataManager) adapter.loadProfile(map, parameters);

            CopletFactory copletFactory = service.getComponentManager().getCopletFactory();
            Iterator iterator = copletDataManager.getCopletData().values().iterator();
            while (iterator.hasNext())
            {
View Full Code Here

TOP

Related Classes of org.apache.cocoon.portal.profile.ProfileLS

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.