What is the use of a component in alfresco?

Showing results for 
Search instead for 
Did you mean: 
Active Member II

What is the use of a component in alfresco?

I am currently looking at bootstrapping my content model and live search within my project. I am using the AIO sample project for reference as well.

Can you please tell me what is the purpose of the DemoComponent below? I dont seem to need the below bean for bootstrapping my content model and live search files. My customizations seem to work fine without the DemoComponent. What is the purpose of such a component and when do you use it in your projects?

<bean id="com.mycomp.alfresco.DemoComponent" class="com.mycomp.alfresco.platformsample.DemoComponent" parent="module.baseComponent" >
    <property name="moduleId" value="alfresco-bootstrap-platform-jar" />  <!-- See module.properties -->
    <property name="name" value="DemoComponent" />
    <property name="description" value="A demonstration component" />
    <property name="sinceVersion" value="1.0" />
    <property name="appliesFromVersion" value="0.99" /> <!-- 1.0 would not work here when using SNAPSHOT version in project  -->
    <property name="nodeService" ref="NodeService" />
    <property name="nodeLocatorService" ref="nodeLocatorService" />
1 Reply

Re: What is the use of a component in alfresco?

A component (or rather "ModuleComponent" as the interface is called) is a logic component that Alfresco will run when starting / initialising a "module", i.e. the state of an addon / extension built using the SDK or other means. It can be used to bootstrap content structures that the extension requires for operation, or load some external data into memory... The most commonly used module component is the ImporterModuleComponent which allows boostrapping content / node structures.

I find it to be bad style that the SDK always generates projects with those dummy components, because very few people actually delete those and it just adds a bit of garbage (harmless) to the system.