cancel
Showing results for 
Search instead for 
Did you mean: 

How to structure share dashlets that use the repository

patorjk
Champ in-the-making
Champ in-the-making
I'm building a dashlet that lets users search for folders. It correctly works, but now my aim is to make it a simple package. To learn how to create dashlets, I initially just created the files in the Alfresco source. I ended up having to create an Alfresco web script and a Share web script, since I wasn't able to access repository functions from within the dashlet. These were the locations of the scripts:

C:\Alfresco\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\dashlets
C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\templates\webscripts\foldersearch

Based on the share examples I've seen, I was able to construct and build a jar, which I placed into the WEB-INF/lib directory of the share.jar file.

The dashlet came up correctly, and I can place it on my dashboard (once integrated into share.war), but it doesn't work correctly. I get these errors:


2011-09-26 20:50:59,309  ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 0826
0004 Read-Write transaction started within read-only transaction
org.alfresco.error.AlfrescoRuntimeException: 08260004 Read-Write transaction started within read-only transaction
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:309)

2011-09-26 20:51:06,434  ERROR [extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 08260001 Script url /inteldocs/folder-search does not map to a Web Script.
org.springframework.extensions.webscripts.WebScriptException: 08260001 Script url /inteldocs/folder-search does not map to a Web Script.

My guess is because I'm placing the Alfresco web script in the Share war (in the \templates\webscripts\foldersearch path) . The simple solution is to have the build.xml file output two jars (one to integrate into alfresco.war and one to integrate into share.war). However, I don't see any other projects structured like this. Am I missing something (my alfresco webscript makes use of search.luceneSearch), or do people typically not structure the alfresco webscript part of their dashlet with the share part?

Anyway, my main question is to make sure I'm developing this correctly. I can create two jars and add them into the different wars, but since I don't see anyone else doing that, I want to make sure I'm not doing something wrong.

- Pat
1 REPLY 1

patorjk
Champ in-the-making
Champ in-the-making
In case anyone stumbles across this with the same question, what I ended up doing:

  • I created a separate workspace for Alfresco modules (currently using Eclipse) and created a "search" webscript that allows for parameters which restrict searching on just folders.

  • In my Dashlet workspace I left the module mostly as is, but removed the Alfresco web script portion.

  • Each module has its own build.xml which creates its own jar, and then a separate build script merges them into the correct war file (either alfresco.war or share.war).
I like this approach in that the Alfresco part is reusable in other web scripts, though it feels wrong to have a share webscript that requires on the custom Alfresco one already being installed. It works though. However, I did notice this in the share web script example build.xml:

Assemble the configuration and resource files in a JAR file structure. This mechanism
    was introduced in Alfresco 3.3 and allows Share extensions containing both repository and
    web-tier web scripts, Spring/Surf configuration and static assets to be added to the servlet
    container as a single library.

Which seems to indicate that what I previously wanted to do was possible, though I was unable to get it working.

- Pat
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.