com.github.dynamicextensionsalfresco.messages.MessagesRegistrar Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alfresco-integration Show documentation
Show all versions of alfresco-integration Show documentation
Adds an OSGi container to alfresco repository supporting dynamic code reloading, classpath isolation and a bunch of other useful features
package com.github.dynamicextensionsalfresco.messages;
import com.github.dynamicextensionsalfresco.resources.BootstrapService;
import com.github.dynamicextensionsalfresco.resources.ContentCompareStrategy;
import com.github.dynamicextensionsalfresco.resources.ResourceHelper;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.dictionary.RepositoryLocation;
import org.alfresco.repo.i18n.MessageService;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.transaction.TransactionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAsSystem;
/**
* Service that scans a Dynamic Extension for translations in {@link MessagesRegistrar#BUNDLE_MESSAGES}. It stores them
* in the Data Dictionary and makes them available in the MessageService.
*
* @author Thijs Lemmens
*/
public class MessagesRegistrar implements InitializingBean {
private static final String BUNDLE_MESSAGES = "osgibundle:/META-INF/alfresco/messages/*.properties";
private static final String MESSAGES_TARGET = "/app:company_home/app:dictionary/app:messages";
private final static Logger logger = LoggerFactory.getLogger(MessagesRegistrar.class);
@Autowired
protected BootstrapService bootstrapService;
@Autowired @javax.annotation.Resource(name = "messageService")
protected MessageService messageService;
@Autowired
private ResourceHelper resourceHelper;
@Autowired
private TransactionService transactionService;
@Override
public void afterPropertiesSet() throws Exception {
runAsSystem(new AuthenticationUtil.RunAsWork
© 2015 - 2025 Weber Informatics LLC | Privacy Policy