Where are stored the assets on an Usergrid server? - apigee

I want to know where the assets (files) are stored on an Usergrid server and how to change their location on the filesystem.

After some research it appears that by default they are stored in /tmp/usergrid
This is not optimal at all. It is possible to change the location by editing this file /stack/rest/src/main/resources/usergrid-rest-context.xml
From
<bean id="binaryStore" class="org.apache.usergrid.services.assets.data.LocalFileBinaryStore">
<property name="reposLocation" value="${usergrid.temp.files}"/>
</bean>
To
<bean id="binaryStore" class="org.apache.usergrid.services.assets.data.LocalFileBinaryStore">
<property name="reposLocation" value="/<customcation>"/>
</bean>

I put my static assets in a virtual path with my server.xml:
<Context docBase="/path/to/static/files" path="/static" />

Related

Modify Alfresco Thumbnail Resolution

I'm using Alfresco Community v5.2.0 to store some files (pdf, jpg/png essentially).
I'm creating a web app to retrieve this files.
I'm trying to create a grid of files from a specific folder in my application.
But when i'm retrieving the list of a specific folders with their thumbnails, the resolution of the thumbnail is very low (100x75).
How to configure Alfresco to generate a larger thumbnail ?
I tried to override the settings in :
C:\alfresco-community\tomcat\webapps\alfresco\cmisfs\stylesheets\
thumbnails.xsl
But this didn't work..
I'm using Alfresco on my computer (windows), with REST API call.
Where can i configure this resolution ?
Thanks in advance,
Julien
Lyon, FR.
Ok I found a way to ovveride the thumbnail definition :
I created a file
thumbnail-service-context.xml
in
[AlfrescoRootFolder]\tomcat\shared\classes\alfresco\extension\
In this file I wrote :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- Slingshot Document Library image thumbnail options -->
<!-- Note that this will auto-register with parent="baseThumbnailDefinition" in the future -->
<bean id="thumbnailDefinitionDoclib" class="org.alfresco.repo.thumbnail.ThumbnailDefinition">
<property name="name" value="doclib" />
<property name="mimetype" value="image/png"/>
<property name="transformationOptions">
<bean parent="defaultImageTransformationOptions">
<property name="resizeOptions">
<bean parent="defaultImageResizeOptions">
<property name="width" value="900"/>
<property name="height" value="900"/>
<property name="allowEnlargement" value="false" />
</bean>
</property>
</bean>
</property>
<property name="placeHolderResourcePath" value="alfresco/thumbnail/thumbnail_placeholder_doclib.png" />
<property name="mimeAwarePlaceHolderResourcePath" value="alfresco/thumbnail/thumbnail_placeholder_doclib{0}.png" />
<property name="runAs" value="System"/>
<property name="failureHandlingOptions" ref="standardFailureOptions"/>
</bean>
</beans>
And now I can retrieve a thumbnail by calling :
/alfresco/api/-default-/public/alfresco/versions/1/nodes/{idDocAlfresco}/renditions/doclib/content

how to understand that SpringMVC resource-chain includes resolvers that I have not set

My dispatcher.xml sets resource chain like below:
<mvc:resources location="/static/" mapping="/static/**" cache-period="31536000">
<mvc:resource-chain resource-cache="true">
<mvc:resolvers>
<!--<bean class="org.springframework.web.servlet.resource.GzipResourceResolver"/>-->
<bean class="org.springframework.web.servlet.resource.CachingResourceResolver">
<constructor-arg ref="staticResourceCache"/>
</bean>
<bean class="org.springframework.web.servlet.resource.VersionResourceResolver">
<property name="strategyMap">
<map>
<entry key="/**">
<bean class="org.springframework.web.servlet.resource.ContentVersionStrategy"/>
</entry>
</map>
</property>
</bean>
<bean class="org.springframework.web.servlet.resource.PathResourceResolver"/>
</mvc:resolvers>
<mvc:transformers>
<bean class="org.springframework.web.servlet.resource.CachingResourceTransformer">
<constructor-arg ref="staticResourceCache"/>
</bean>
<bean class="org.springframework.web.servlet.resource.CssLinkResourceTransformer">
<!--<property name="allowedLocations" value="/static"> </property>-->
</bean>
</mvc:transformers>
</mvc:resource-chain>
</mvc:resources>
when I debug the codes ,I find that the resource chains has two PathResourceResolver, why ?Thank you!
ResourceHttpRequestHanndler state
I suspect Spring is adding a default PathResourceResolver bean with the default id pathResourceResolver. You are explicitly declaring one but without an id, so you are ending up with 2.
The Spring Framework does this a lot - ie. it will create default beans for you unless you specify a bean with the same id.
You can test this theory by:
1) comment your PathResourceResolver out of your config? Do you end up with 1?
2) use your PathResourceResolver in your config, but give it the id pathResourceResolver? Do you end up with 1?
I have just find there exist note in the spring-mvc-4.3.xsd:
<xsd:documentation source="org.springframework.web.servlet.config.annotation.ResourceChainRegistration"><![CDATA[
Assists with the registration of resource resolvers and transformers.
Unless set to "false", the auto-registration adds default Resolvers (a PathResourceResolver) and Transformers
(CssLinkResourceTransformer, if a VersionResourceResolver has been manually registered).
The resource-cache attribute sets whether to cache the result of resource resolution/transformation;
setting this to "true" is recommended for production (and "false" for development).
A custom Cache can be configured if a CacheManager is provided as a bean reference
in the "cache-manager" attribute, and the cache name provided in the "cache-name" attribute.
]]></xsd:documentation>

Alfresco: Why is there no Scripts Extension folder, when there is a Web Script Extension folder?

When I learnt about web scripts, the tutorials said to leave the Web Scripts folder alone and instead to add my web script to the Web Scripts Extensions folder. My understanding is that this is so that I do not pollute Alfresco's out-of-the-box web scripts, and upgrading will be easier.
Why is there no equivalent extensions folder for the Scripts folder?
Or is my understanding of the reason for the Web Scripts vs Web Scripts Extensions folders wrong?
Extension folders provide a way to override default behavior. You can put your code there if you like, but doing so makes it more difficult to override it. I will use the repository as an example. Similiar logic applies to share.
Have a look at alfresco/WEB-INF/classes/alfresco/web-scripts-application-context.xml. It reads:
<bean name="webscripts.store.repo.extension" parent="webscripts.repostore">
<property name="store"><value>workspace://SpacesStore</value></property>
<property name="path"><value>/${spaces.company_home.childname}/${spaces.dictionary.childname}/cm:extensionwebscripts</value></property>
</bean>
<bean name="webscripts.store.repo" parent="webscripts.repostore">
<property name="mustExist"><value>true</value></property>
<property name="store"><value>workspace://SpacesStore</value></property>
<property name="path"><value>/${spaces.company_home.childname}/${spaces.dictionary.childname}/cm:webscripts</value></property>
</bean>
<bean id="webscripts.repoclasspathstore" class="org.alfresco.repo.web.scripts.RepoClassPathStore" abstract="true" />
<bean id="webscripts.store" parent="webscripts.repoclasspathstore">
<property name="mustExist"><value>false</value></property>
<property name="classPath"><value>webscripts</value></property>
</bean>
<bean id="webscripts.store.alfresco" parent="webscripts.repoclasspathstore">
<property name="mustExist"><value>false</value></property>
<property name="classPath"><value>alfresco/webscripts</value></property>
</bean>
<bean id="webscripts.store.client" parent="webscripts.repoclasspathstore">
<property name="mustExist"><value>true</value></property>
<property name="classPath"><value>alfresco/templates/webscripts</value></property>
</bean>
<bean id="webscripts.store.client.extension" parent="webscripts.classpathstore">
<property name="classPath"><value>alfresco/extension/templates/webscripts</value></property>
</bean>
<bean id="webscripts.searchpath" class="org.springframework.extensions.webscripts.SearchPath">
<property name="searchPath">
<list>
<ref bean="webscripts.store.repo.extension" />
<ref bean="webscripts.store.repo" />
<ref bean="webscripts.store.client.extension" />
<ref bean="webscripts.store.client" />
<ref bean="webscripts.store.alfresco" />
<ref bean="webscripts.store" />
</list>
</property>
</bean>
The searchPath property of webscripts.searchpath shows the search order. Search terminates as soon as it has a match. As you can see, it is no problem to put custom code in non extension locations as long as their path is unique.
I personally only put override webscripts in extension locations.
You can create a folder under Scripts called Extension and put all your script in that. Or just create different folders under Scripts for each function or project, it doesn't matter. They get picked up by Alfresco.

Configure an External LDAP User Store with WSO2 Identity Server

My Current configuration is
#
<UserManager>
<Realm>
<Configuration>
<AdminRole>admin</AdminRole>
<AdminUser>
<UserName>admin</UserName>
<Password>XXXXXX</Password>
</AdminUser>
<EveryOneRoleName>everyone</EveryOneRoleName> <!-- By default users in thsi role sees the registry root -->
<!-- <ReadOnly>false</ReadOnly> -->
<MaxUserNameListLength>500</MaxUserNameListLength>
<Property name="url">jdbc:h2:repository/database/WSO2CARBON_DB</Property>
<Property name="userName">wso2carbon</Property>
<Property name="password">wso2carbon</Property>
<Property name="driverName">org.h2.Driver</Property>
<Property name="maxActive">50</Property>
<Property name="maxWait">60000</Property>
<Property name="minIdle">5</Property>
</Configuration>
<UserStoreManager
class="org.wso2.carbon.user.core.ldap.LDAPUserStoreManager">
<Property name="ConnectionURL">ldap://localhost:389</Property>
<Property name="ConnectionName">cn=admin,dc=ysd,dc=com</Property>
<Property name="ConnectionPassword">admin32</Property>
<Property name="UserSearchBase">ou=People,dc=ysd,dc=com</Property>
<Property name="UserNameListFilter">(objectClass=person)</Property>
<Property name="UserNameAttribute">uid</Property>
<Property name="ReadLDAPGroups">false</Property>
<Property name="GroupSearchBase">ou=People,dc=ysd,dc=com</Property>
<Property name="GroupSearchFilter">(objectClass=groupOfNames)</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="MembershipAttribute">member</Property>
</UserStoreManager>
<AuthorizationManager
class="org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager">
</AuthorizationManager>
</Realm>
</UserManager>`
#
Iam geeting following error while starting server.
*ERROR {org.wso2.carbon.user.core.common.DefaultRealm} - Cannot create org.wso2.carbon.user.core.ldap.LDAPUserStoreManager . Error is : null
java.lang.reflect.InvocationTargetException*
..............
............
............
Caused by: org.wso2.carbon.user.core.UserStoreException: LDAPUserStoreManager is unable to operate in Read-Write mode. This is invalid configuration. It can only operate in ReadOnly mode
at org.wso2.carbon.user.core.ldap.LDAPUserStoreManager.(LDAPUserStoreManager.java:97)
... 25 more
What is your exact requirement ? Do you want the Identity Server to do Read-Write operation on the external LDAP or do you want to do only the Read operations ?
You get this exception because you are trying to use the read only ldap user store for both read-write operations. Set the parameter <ReadOnly>false</ReadOnly>to true, then this error would go away.
But if your requirement is to use IS for both read write operations use the ApacheDSUserStoreManager. You can use the LDAPUserStoreManager for that.

Unable to get FlowHandlerMapping working in Spring Webflow

I'm using SWF 2.1 with Spring 2.5.6. and am trying to get the default mapping strategy for 2.1 to work. I had previously been using the mapping strategy that was the 1.0 default (whereby the flow id was retrieved from the request parameters)
In spring MVC configuration, I'm using the simpleUrlMapping strategy (order = 1) and have declared the SimpleControllerHandlerAdapter bean.
<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>
SWF configuration:
<bean id="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
<property name="flowExecutor" ref="flowExecutor"/>
</bean><!--
Launches new flow executions and resumes existing executions. -->
<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
<webflow:flow-execution-repository max-executions="5" max-execution-snapshots="80"/>
</webflow:flow-executor>
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<!--
Creates the registry of flow definitions for this application -->
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF/flows">
<webflow:flow-location-pattern value="/**/*-flow.xml"/>
</webflow:flow-registry>
<webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="viewFactoryCreator" development="true"/>
<bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="viewResolvers">
<list>
<ref local="beanNameViewResolver"/>
<ref local="internalResourceViewResolver"/>
</list>
</property>
</bean>
<!-- Maps request paths to flows in the flowRegistry;
e.g. a path of /hotels/booking looks for a flow with id "hotels/booking" -->
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping" p:order="0">
<property name="flowRegistry" ref="flowRegistry"/>
</bean>
Here is the directory structure in the web folder:
/WEB-INF/flows/flow1-name/flow1-flow.xml
/WEB-INF/flows/flow2-name/flow2-flow.xml
/WEB-INF/flows/flow3-name/flow3-flow.xml
I have been trying to access the flows by going to
http://www.appdomain.com/flow1-name
the mapping does not work and I get a 404.
Also, how should I name subflows and where should I put them? I would like to be able to access the subflows from more than one top-level flow.
I don't know what your servlet mapping in web.xml looks like but http://www.appdomain.com/flow1-name doesn't seem to include the name of your webapp and possibly the name of your servlet mapping. Check if the DispatcherServlet is getting reached at all. You can do that by enabling the org.springframework.web and org.springframework.webflow logging categories and looking for the output.

Resources