/** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.liferay.portal.scheduler.internal.portal.profile; import com.liferay.portal.kernel.scheduler.SchedulerEngineHelper; import com.liferay.portal.kernel.util.GetterUtil; import com.liferay.portal.kernel.util.HashMapDictionary; import com.liferay.portal.kernel.util.Props; import com.liferay.portal.kernel.util.PropsKeys; import com.liferay.portal.kernel.util.ProxyFactory; import com.liferay.portal.profile.BaseDSModulePortalProfile; import com.liferay.portal.profile.PortalProfile; import com.liferay.portal.scheduler.internal.SchedulerEngineHelperImpl; import com.liferay.portal.scheduler.internal.messaging.config.SchedulerProxyMessagingConfigurator; import com.liferay.portal.scheduler.internal.verify.SchedulerHelperPropertiesVerifyProcess; import java.util.Collections; import java.util.HashSet; import java.util.Set; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; /** * @author Tina Tian */ @Component(immediate = true, service = PortalProfile.class) public class ModulePortalProfile extends BaseDSModulePortalProfile { @Activate public void activate(ComponentContext componentContext) { Set<String> supportedPortalProfileNames = null; if (GetterUtil.getBoolean(_props.get(PropsKeys.SCHEDULER_ENABLED))) { supportedPortalProfileNames = new HashSet<>(); supportedPortalProfileNames.add( PortalProfile.PORTAL_PROFILE_NAME_CE); supportedPortalProfileNames.add( PortalProfile.PORTAL_PROFILE_NAME_DXP); } else { supportedPortalProfileNames = Collections.emptySet(); BundleContext bundleContext = componentContext.getBundleContext(); bundleContext.registerService( SchedulerEngineHelper.class, ProxyFactory.newDummyInstance(SchedulerEngineHelper.class), new HashMapDictionary<String, Object>()); } init( componentContext, supportedPortalProfileNames, SchedulerEngineHelperImpl.class.getName(), SchedulerHelperPropertiesVerifyProcess.class.getName(), SchedulerProxyMessagingConfigurator.class.getName()); } @Reference(unbind = "-") protected void setProps(Props props) { _props = props; } private Props _props; }