How to structure share dashlets that use the repository
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2011 05:22 PM
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:
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
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: 08260004 Read-Write transaction started within read-only transactionorg.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
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2011 03:19 PM
In case anyone stumbles across this with the same question, what I ended up doing:
Which seems to indicate that what I previously wanted to do was possible, though I was unable to get it working.
- Pat
- 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).
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
