List of usage examples for com.liferay.portal.kernel.util HashMapDictionary HashMapDictionary
public HashMapDictionary()
From source file:com.liferay.adaptive.media.image.processor.test.FileEntryImageAdaptiveMediaURLItemSelectorReturnTypeResolverTest.java
License:Open Source License
private void _addTestVariant() throws IOException { Configuration configuration = _configurationAdmin .getConfiguration("com.liferay.adaptive.media.image.internal.configuration." + "ImageAdaptiveMediaCompanyConfiguration", null); Dictionary<String, Object> properties = configuration.getProperties(); if (properties == null) { properties = new HashMapDictionary<>(); }// w ww. ja va 2s . c o m properties.put("imageVariants", new String[] { "small:uuid0:width=100;height=100", "big:uuid1:width=1200;height=800", "medium:uuid2:width=800;height=600", "extra:uuid3:width=2400;height=1800" }); configuration.update(properties); }
From source file:com.liferay.adaptive.media.image.processor.test.ImageAdaptiveMediaProcessorTest.java
License:Open Source License
private void _addTestVariant() throws IOException { Configuration configuration = _configurationAdmin .getConfiguration("com.liferay.adaptive.media.image.internal.configuration." + "ImageAdaptiveMediaCompanyConfiguration", null); Dictionary<String, Object> properties = configuration.getProperties(); if (properties == null) { properties = new HashMapDictionary<>(); }/*from w w w . ja v a 2s. c o m*/ properties.put("imageVariants", new String[] { "small:0:width=100;height=100" }); configuration.update(properties); }
From source file:com.liferay.adaptive.media.internal.messaging.AdaptiveMediaMessagingConfigurator.java
License:Open Source License
@Activate public void activate(BundleContext bundleContext) { DestinationConfiguration destinationConfiguration = new DestinationConfiguration( DestinationConfiguration.DESTINATION_TYPE_SERIAL, AdaptiveMediaDestinationNames.ADAPTIVE_MEDIA_PROCESSOR); Destination destination = _destinationFactory.createDestination(destinationConfiguration); Dictionary<String, Object> dictionary = new HashMapDictionary<>(); dictionary.put("destination.name", destination.getName()); _serviceRegistration = bundleContext.registerService(Destination.class, destination, dictionary); }
From source file:com.liferay.adaptive.media.internal.messaging.AMMessagingConfigurator.java
License:Open Source License
@Activate public void activate(BundleContext bundleContext, Map<String, Object> properties) { _amConfiguration = ConfigurableUtil.createConfigurable(AMConfiguration.class, properties); DestinationConfiguration destinationConfiguration = new DestinationConfiguration( DestinationConfiguration.DESTINATION_TYPE_PARALLEL, AMDestinationNames.ADAPTIVE_MEDIA_PROCESSOR); destinationConfiguration.setWorkersCoreSize(_amConfiguration.workersCoreSize()); destinationConfiguration.setWorkersMaxSize(_amConfiguration.workersMaxSize()); Destination destination = _destinationFactory.createDestination(destinationConfiguration); Dictionary<String, Object> dictionary = new HashMapDictionary<>(); dictionary.put("destination.name", destination.getName()); _serviceRegistration = bundleContext.registerService(Destination.class, destination, dictionary); }
From source file:com.liferay.adaptive.media.web.internal.background.task.BackgroundTaskExecutorConfigurator.java
License:Open Source License
protected void registerBackgroundTaskExecutor(BundleContext bundleContext, BackgroundTaskExecutor backgroundTaskExecutor) { Dictionary<String, Object> properties = new HashMapDictionary<>(); Class<?> clazz = backgroundTaskExecutor.getClass(); properties.put("background.task.executor.class.name", clazz.getName()); ServiceRegistration<BackgroundTaskExecutor> serviceRegistration = bundleContext .registerService(BackgroundTaskExecutor.class, backgroundTaskExecutor, properties); _serviceRegistrations.add(serviceRegistration); }
From source file:com.liferay.application.list.adapter.PortletPanelAppAdapterServiceTrackerCustomizer.java
License:Open Source License
@Override public PanelApp addingService(ServiceReference<Portlet> serviceReference) { String portletId = (String) serviceReference.getProperty("javax.portlet.name"); if (Validator.isNull(portletId)) { return null; }//from www. j a v a 2s .c om String controlPanelCategory = (String) serviceReference .getProperty("com.liferay.portlet.control-panel-entry-category"); if (Validator.isNull(controlPanelCategory)) { return null; } PanelApp portletPanelAppAdapter = new PortletPanelAppAdapter(portletId); Dictionary<String, Object> panelAppProperties = new HashMapDictionary<>(); panelAppProperties.put("panel.category.key", PortletCategoryUtil.getPortletCategoryKey(controlPanelCategory)); Integer serviceRanking = getServiceRanking(serviceReference); if (serviceRanking != null) { panelAppProperties.put("service.ranking", serviceRanking); } ServiceRegistration<PanelApp> serviceRegistration = _bundleContext.registerService(PanelApp.class, portletPanelAppAdapter, panelAppProperties); _serviceRegistrations.put(serviceReference, serviceRegistration); return portletPanelAppAdapter; }
From source file:com.liferay.application.list.deploy.hot.LegacyPortletPanelAppHotDeployListener.java
License:Open Source License
protected List<Dictionary<String, Object>> getPropertiesList(HotDeployEvent hotDeployEvent) throws DocumentException, IOException { ServletContext servletContext = hotDeployEvent.getServletContext(); String xml = _http.URLtoString(servletContext.getResource("/WEB-INF/liferay-portlet.xml")); if (xml == null) { return Collections.emptyList(); }//from w w w .ja v a 2 s .com List<Dictionary<String, Object>> propertiesList = new ArrayList<>(); Document document = UnsecureSAXReaderUtil.read(xml, true); Element rootElement = document.getRootElement(); Iterator<Element> iterator = rootElement.elementIterator("portlet"); while (iterator.hasNext()) { Element portletElement = iterator.next(); String controlPanelEntryCategory = portletElement.elementText("control-panel-entry-category"); if (Validator.isNull(controlPanelEntryCategory)) { continue; } controlPanelEntryCategory = PortletCategoryUtil.getPortletCategoryKey(controlPanelEntryCategory); Dictionary<String, Object> properties = new HashMapDictionary<>(); String portletName = portletElement.elementText("portlet-name"); String portletId = getPortletId(hotDeployEvent.getServletContextName(), portletName); properties.put("panel.app.portlet.id", portletId); properties.put("panel.category.key", controlPanelEntryCategory); String controlPanelEntryWeight = portletElement.elementText("control-panel-entry-weight"); if (Validator.isNotNull(controlPanelEntryWeight)) { int panelAppOrder = (int) Math.ceil(GetterUtil.getDouble(controlPanelEntryWeight) * 100); properties.put("panel.app.order", panelAppOrder); } propertiesList.add(properties); } return propertiesList; }
From source file:com.liferay.application.list.my.account.permissions.test.PanelAppMyAccountPermissionsTest.java
License:Open Source License
private void _registerTestPanelApp(String portletId) { _serviceRegistrations.add(_bundleContext.registerService(PanelApp.class, new TestPanelApp(portletId), new HashMapDictionary<String, String>() { {//from w w w . j a va 2s . com put("panel.category.key", PanelCategoryKeys.USER_MY_ACCOUNT); } })); }
From source file:com.liferay.application.list.my.account.permissions.test.PanelAppMyAccountPermissionsTest.java
License:Open Source License
private void _registerTestPortlet(final String portletId) throws Exception { _serviceRegistrations.add(_bundleContext.registerService(Portlet.class, new TestPortlet(), new HashMapDictionary<String, String>() { {/* w ww . j a va 2 s . c o m*/ put("javax.portlet.name", portletId); } })); }
From source file:com.liferay.arquillian.portal.activator.PortalURLBundleActivator.java
License:Open Source License
@Override public void start(BundleContext context) throws Exception { _companyLocalServiceServiceReference = context.getServiceReference(CompanyLocalService.class); CompanyLocalService companyLocalService = null; if (_companyLocalServiceServiceReference == null) { throw new IllegalStateException("Can not access CompanyLocalService"); }//from w w w . ja v a2s. c om companyLocalService = context.getService(_companyLocalServiceServiceReference); _groupLocalServiceServiceReference = context.getServiceReference(GroupLocalService.class); GroupLocalService groupLocalService = null; if (_groupLocalServiceServiceReference == null) { throw new IllegalStateException("Can not access GroupLocalService"); } groupLocalService = context.getService(_groupLocalServiceServiceReference); _layoutLocalServiceServiceReference = context.getServiceReference(LayoutLocalService.class); LayoutLocalService layoutLocalService = null; if (_layoutLocalServiceServiceReference == null) { throw new IllegalStateException("Can not access LayoutLocalService"); } layoutLocalService = context.getService(_layoutLocalServiceServiceReference); _portletPreferencesLocalServiceServiceReference = context .getServiceReference(PortletPreferencesLocalService.class); PortletPreferencesLocalService portletPreferencesLocalService = null; if (_portletPreferencesLocalServiceServiceReference == null) { throw new IllegalStateException("Can not access PortletPreferencesLocalService"); } portletPreferencesLocalService = context.getService(_portletPreferencesLocalServiceServiceReference); _userLocalServiceServiceReference = context.getServiceReference(UserLocalService.class); UserLocalService userLocalService = null; if (_userLocalServiceServiceReference == null) { throw new IllegalStateException("Can not access UserLocalService"); } userLocalService = context.getService(_userLocalServiceServiceReference); PortalURLServlet portalURLServlet = new PortalURLServlet(companyLocalService, groupLocalService, layoutLocalService, portletPreferencesLocalService, userLocalService); Dictionary<String, Object> properties = new HashMapDictionary<>(); properties.put("osgi.http.whiteboard.servlet.name", "Install Portlet Servlet"); properties.put("osgi.http.whiteboard.servlet.pattern", "/install-portlet-servlet/*"); _servletServiceRegistration = context.registerService(Servlet.class, portalURLServlet, properties); }