Examples of AspectDescription


Examples of org.apache.cocoon.portal.aspect.AspectDescription

       
        // and now the aspects
        final Configuration[] aspectsConf = layoutConf.getChild("aspects").getChildren("aspect");
        if (aspectsConf != null) {
            for(int m=0; m < aspectsConf.length; m++) {
                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 );
               
                Iterator aspectIterator = renderer.getAspectDescriptions();
                while (aspectIterator.hasNext()) {
                    final AspectDescription adesc = (AspectDescription) aspectIterator.next();
                    desc.addAspectDescription( adesc );
                }
            }
        } catch (ServiceException ce ) {
            throw new ConfigurationException("Unable to lookup renderer selector.", ce);
View Full Code Here

Examples of org.apache.cocoon.portal.aspect.AspectDescription

    /**
     * Return the description for an aspect
     */
    public AspectDescription getAspectDescription(String name) {
        if ( name == null ) return null;
        AspectDescription desc = null;
        Iterator i = this.aspects.iterator();
        while (desc == null && i.hasNext() ) {
            AspectDescription current = (AspectDescription)i.next();
            if ( name.equals(current.getName())) {
                desc = current;
            }
        }
        return desc;
    }
View Full Code Here

Examples of org.apache.cocoon.portal.aspect.AspectDescription

    /**
     * Return the description for an aspect
     */
    public AspectDescription getInstanceAspectDescription(String name) {
        AspectDescription desc = null;
        Iterator i = this.instanceAspects.iterator();
        while (desc == null && i.hasNext() ) {
            AspectDescription current = (AspectDescription)i.next();
            if ( name.equals(current.getName())) {
                desc = current;
            }
        }
        return desc;
    }
View Full Code Here

Examples of org.apache.cocoon.portal.aspect.AspectDescription

    /* (non-Javadoc)
     * @see org.apache.cocoon.portal.aspect.AspectDataHandler#getAspectData(org.apache.cocoon.portal.aspect.Aspectalizable, java.lang.String)
     */
    public Object getAspectData(Aspectalizable owner, String aspectName) {
        // is this aspect allowed?
        AspectDescription aspectDesc = this.description.getAspectDescription( aspectName );
        if ( aspectDesc == null ) return null;
       
        // lookup storage
        AspectDataStore store = null;
        Object data = null;
        try {
            store = (AspectDataStore)this.storeSelector.select(aspectDesc.getStoreName());
            data = store.getAspectData(owner, aspectName);

            if ( data == null && aspectDesc.isAutoCreate() ) {
                data = AspectUtil.createNewInstance(aspectDesc);
                store.setAspectData( owner, aspectName, data );
            }

        } catch (ServiceException ce) {
            throw new CascadingRuntimeException("Unable to lookup aspect data store " + aspectDesc.getStoreName(), ce);
        } finally {
            this.storeSelector.release( store );
        }       

        return data;
View Full Code Here

Examples of org.apache.cocoon.portal.aspect.AspectDescription

     */
    public Map getAspectDatas(Aspectalizable owner)  {
        AspectDatasHashMap datas = new AspectDatasHashMap(owner, this);
        Iterator iter = this.description.getAspectDescriptions().iterator();
        while ( iter.hasNext() ) {
            AspectDescription current = (AspectDescription)iter.next();
            Object data = this.getAspectData(owner, current.getName());
            if ( data != null ) {
                datas.put( current.getName(), data );
            }
        }
        datas.initialize();
        return datas;
    }
View Full Code Here

Examples of org.apache.cocoon.portal.aspect.AspectDescription

     */
    public Map getPersistentAspectDatas(Aspectalizable owner)  {
        Map datas = new HashMap();
        Iterator iter = this.description.getAspectDescriptions().iterator();
        while ( iter.hasNext() ) {
            AspectDescription current = (AspectDescription)iter.next();

            // lookup storage
            AspectDataStore store = null;
            Object data = null;
            try {
                store = (AspectDataStore)this.storeSelector.select(current.getStoreName());
                if ( store.isPersistent() ) {
                    data = store.getAspectData(owner, current.getName());

                    if ( data == null && current.isAutoCreate() ) {
                        data = AspectUtil.createNewInstance(current);
                        store.setAspectData( owner, current.getName(), data );
                    }

                    if ( data != null ) {
                        datas.put( current.getName(), data );
                    }
                }

            } catch (ServiceException ce) {
                throw new CascadingRuntimeException("Unable to lookup aspect data store " + current.getStoreName(), ce);
            } finally {
                this.storeSelector.release( store );
            }       

        }
View Full Code Here

Examples of org.apache.cocoon.portal.aspect.AspectDescription

     */
    public void setAspectData(Aspectalizable owner,
                               String aspectName,
                               Object data) {
        // is this aspect allowed?
        AspectDescription aspectDesc = this.description.getAspectDescription( aspectName );
        if ( aspectDesc == null ) return;

        // lookup storage
        AspectDataStore store = null;
        try {
            store = (AspectDataStore)this.storeSelector.select(aspectDesc.getStoreName());
            store.setAspectData(owner, aspectName, AspectUtil.convert(aspectDesc, data));
        } catch (ServiceException ce) {
            throw new CascadingRuntimeException("Unable to lookup aspect data store " + aspectDesc.getStoreName(), ce);
        } finally {
            this.storeSelector.release( store );
        }       
    }
View Full Code Here

Examples of org.apache.cocoon.portal.aspect.AspectDescription

               
                // and now the aspects
                Configuration[] aspectsConf = copletsConf[i].getChild("coplet-data-aspects").getChildren("aspect");
                if (aspectsConf != null) {
                    for(int m=0; m < aspectsConf.length; m++) {
                        AspectDescription adesc = DefaultAspectDescription.newInstance(aspectsConf[m]);
                        desc.addAspectDescription( adesc );
                    }
                }

                // and now the aspects of the instances
                aspectsConf = copletsConf[i].getChild("coplet-instance-data-aspects").getChildren("aspect");
                if (aspectsConf != null) {
                    for(int m=0; m < aspectsConf.length; m++) {
                        AspectDescription adesc = DefaultAspectDescription.newInstance(aspectsConf[m]);
                        instanceDesc.addAspectDescription( adesc );
                    }
                }

                DefaultAspectDataHandler handler = new DefaultAspectDataHandler(desc, this.storeSelector);
View Full Code Here

Examples of org.apache.cocoon.portal.aspect.AspectDescription

       
        // and now the aspects
        final Configuration[] aspectsConf = layoutConf.getChild("aspects").getChildren("aspect");
        if (aspectsConf != null) {
            for(int m=0; m < aspectsConf.length; m++) {
                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 );
               
                Iterator aspectIterator = renderer.getAspectDescriptions();
                while (aspectIterator.hasNext()) {
                    final AspectDescription adesc = (AspectDescription) aspectIterator.next();
                    desc.addAspectDescription( adesc );
                }
            }
        } catch (ServiceException ce ) {
            throw new ConfigurationException("Unable to lookup renderer selector.", ce);
View Full Code Here

Examples of org.apache.cocoon.portal.aspect.AspectDescription

    /**
     * Return the description for an aspect
     */
    public AspectDescription getAspectDescription(String name) {
        if ( name == null ) return null;
        AspectDescription desc = null;
        Iterator i = this.aspects.iterator();
        while (desc == null && i.hasNext() ) {
            AspectDescription current = (AspectDescription)i.next();
            if ( name.equals(current.getName())) {
                desc = current;
            }
        }
        return desc;
    }
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.