From e788fa906b968a298414e60cbb15cc7d6389b8a1 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Mon, 15 May 2017 22:34:43 +0300 Subject: Rename OSGi classes for Java naming conventions (#9320) - Rename OSGi to Osgi in class names. - Rename VaadinOSGiPortlet to OSGiVaadinPortlet for consistency with Spring, CDI etc. add-ons - Add missing javadoc --- .../com/vaadin/osgi/liferay/OSGiUIProvider.java | 59 ---------------------- .../osgi/liferay/OSGiVaadinPortletService.java | 59 ---------------------- .../com/vaadin/osgi/liferay/OsgiUIProvider.java | 59 ++++++++++++++++++++++ .../com/vaadin/osgi/liferay/OsgiVaadinPortlet.java | 50 ++++++++++++++++++ .../osgi/liferay/OsgiVaadinPortletService.java | 59 ++++++++++++++++++++++ .../liferay/PortletUIServiceTrackerCustomizer.java | 6 +-- .../com/vaadin/osgi/liferay/VaadinOSGiPortlet.java | 50 ------------------ .../vaadin/osgi/liferay/VaadinPortletProvider.java | 4 +- 8 files changed, 173 insertions(+), 173 deletions(-) delete mode 100644 liferay-integration/src/main/java/com/vaadin/osgi/liferay/OSGiUIProvider.java delete mode 100644 liferay-integration/src/main/java/com/vaadin/osgi/liferay/OSGiVaadinPortletService.java create mode 100644 liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiUIProvider.java create mode 100644 liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiVaadinPortlet.java create mode 100644 liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiVaadinPortletService.java delete mode 100644 liferay-integration/src/main/java/com/vaadin/osgi/liferay/VaadinOSGiPortlet.java (limited to 'liferay-integration/src') diff --git a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OSGiUIProvider.java b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OSGiUIProvider.java deleted file mode 100644 index ccbd2fd546..0000000000 --- a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OSGiUIProvider.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2000-2016 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.osgi.liferay; - -import org.osgi.framework.ServiceObjects; - -import com.vaadin.server.UIClassSelectionEvent; -import com.vaadin.server.UIProvider; -import com.vaadin.ui.UI; - -/** - * Vaadin {@link com.vaadin.server.UIProvider} that provides a single {@link UI} - * class provided through the registration of a {@link UI} as an OSGi service. - *

- * This only applies to Liferay Portal 7+ with OSGi support. - * - * @author Sampsa Sohlman - * - * @since 8.1 - */ -@SuppressWarnings("serial") -public class OSGiUIProvider extends UIProvider { - private Class uiClass; - - @SuppressWarnings("unchecked") - public OSGiUIProvider(ServiceObjects serviceObjects) { - super(); - UI ui = serviceObjects.getService(); - uiClass = (Class) ui.getClass(); - serviceObjects.ungetService(ui); - } - - @Override - public Class getUIClass(UIClassSelectionEvent event) { - return uiClass; - } - - public String getDefaultPortletName() { - return uiClass.getName(); - } - - public String getDefaultDisplayName() { - return uiClass.getSimpleName(); - } - -} diff --git a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OSGiVaadinPortletService.java b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OSGiVaadinPortletService.java deleted file mode 100644 index c203fc4f3c..0000000000 --- a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OSGiVaadinPortletService.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2000-2016 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.osgi.liferay; - -import com.vaadin.server.DeploymentConfiguration; -import com.vaadin.server.ServiceException; -import com.vaadin.server.VaadinPortlet; -import com.vaadin.server.VaadinPortletService; -import com.vaadin.server.VaadinPortletSession; -import com.vaadin.server.VaadinRequest; -import com.vaadin.server.VaadinSession; -import com.vaadin.ui.UI; - -/** - * {@link VaadinPortletService} class that uses the {@link OSGiUIProvider} to - * configure the {@link UI} class for a {@link VaadinPortlet}. - *

- * This only applies to Liferay Portal 7+ with OSGi support. - * - * @author Sampsa Sohlman - * - * @since 8.1 - */ -@SuppressWarnings("serial") -public class OSGiVaadinPortletService extends VaadinPortletService { - private OSGiUIProvider osgiUIProvider; - - public OSGiVaadinPortletService(VaadinPortlet portlet, - DeploymentConfiguration deploymentConfiguration, - OSGiUIProvider osgiUIProvider) throws ServiceException { - - super(portlet, deploymentConfiguration); - this.osgiUIProvider = osgiUIProvider; - } - - @Override - protected VaadinSession createVaadinSession(VaadinRequest request) - throws ServiceException { - - VaadinSession vaadinSession = new VaadinPortletSession(this); - vaadinSession.addUIProvider(osgiUIProvider); - - return vaadinSession; - } - -} diff --git a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiUIProvider.java b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiUIProvider.java new file mode 100644 index 0000000000..072dcbdc02 --- /dev/null +++ b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiUIProvider.java @@ -0,0 +1,59 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.osgi.liferay; + +import org.osgi.framework.ServiceObjects; + +import com.vaadin.server.UIClassSelectionEvent; +import com.vaadin.server.UIProvider; +import com.vaadin.ui.UI; + +/** + * Vaadin {@link com.vaadin.server.UIProvider} that provides a single {@link UI} + * class provided through the registration of a {@link UI} as an OSGi service. + *

+ * This only applies to Liferay Portal 7+ with OSGi support. + * + * @author Sampsa Sohlman + * + * @since 8.1 + */ +@SuppressWarnings("serial") +public class OsgiUIProvider extends UIProvider { + private Class uiClass; + + @SuppressWarnings("unchecked") + public OsgiUIProvider(ServiceObjects serviceObjects) { + super(); + UI ui = serviceObjects.getService(); + uiClass = (Class) ui.getClass(); + serviceObjects.ungetService(ui); + } + + @Override + public Class getUIClass(UIClassSelectionEvent event) { + return uiClass; + } + + public String getDefaultPortletName() { + return uiClass.getName(); + } + + public String getDefaultDisplayName() { + return uiClass.getSimpleName(); + } + +} diff --git a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiVaadinPortlet.java b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiVaadinPortlet.java new file mode 100644 index 0000000000..0d6c648fc8 --- /dev/null +++ b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiVaadinPortlet.java @@ -0,0 +1,50 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.osgi.liferay; + +import com.vaadin.server.DeploymentConfiguration; +import com.vaadin.server.ServiceException; +import com.vaadin.server.VaadinPortlet; +import com.vaadin.server.VaadinPortletService; +import com.vaadin.ui.UI; + +/** + * {@link VaadinPortlet} that uses an {@link OsgiUIProvider} to configure its + * {@link UI}. + *

+ * This only applies to Liferay Portal 7+ with OSGi support. + * + * @author Sampsa Sohlman + * + * @since 8.1 + */ +@SuppressWarnings("serial") +public class OsgiVaadinPortlet extends VaadinPortlet { + private OsgiUIProvider uiProvider; + + public OsgiVaadinPortlet(OsgiUIProvider uiProvider) { + this.uiProvider = uiProvider; + } + + @Override + protected VaadinPortletService createPortletService( + DeploymentConfiguration configuration) throws ServiceException { + OsgiVaadinPortletService osgiVaadinPortletService = new OsgiVaadinPortletService( + this, configuration, uiProvider); + osgiVaadinPortletService.init(); + return osgiVaadinPortletService; + } +} diff --git a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiVaadinPortletService.java b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiVaadinPortletService.java new file mode 100644 index 0000000000..38858ec12f --- /dev/null +++ b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiVaadinPortletService.java @@ -0,0 +1,59 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.osgi.liferay; + +import com.vaadin.server.DeploymentConfiguration; +import com.vaadin.server.ServiceException; +import com.vaadin.server.VaadinPortlet; +import com.vaadin.server.VaadinPortletService; +import com.vaadin.server.VaadinPortletSession; +import com.vaadin.server.VaadinRequest; +import com.vaadin.server.VaadinSession; +import com.vaadin.ui.UI; + +/** + * {@link VaadinPortletService} class that uses the {@link OsgiUIProvider} to + * configure the {@link UI} class for a {@link VaadinPortlet}. + *

+ * This only applies to Liferay Portal 7+ with OSGi support. + * + * @author Sampsa Sohlman + * + * @since 8.1 + */ +@SuppressWarnings("serial") +public class OsgiVaadinPortletService extends VaadinPortletService { + private OsgiUIProvider osgiUIProvider; + + public OsgiVaadinPortletService(VaadinPortlet portlet, + DeploymentConfiguration deploymentConfiguration, + OsgiUIProvider osgiUIProvider) throws ServiceException { + + super(portlet, deploymentConfiguration); + this.osgiUIProvider = osgiUIProvider; + } + + @Override + protected VaadinSession createVaadinSession(VaadinRequest request) + throws ServiceException { + + VaadinSession vaadinSession = new VaadinPortletSession(this); + vaadinSession.addUIProvider(osgiUIProvider); + + return vaadinSession; + } + +} diff --git a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/PortletUIServiceTrackerCustomizer.java b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/PortletUIServiceTrackerCustomizer.java index 0fc7c1eba8..077730d2a8 100644 --- a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/PortletUIServiceTrackerCustomizer.java +++ b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/PortletUIServiceTrackerCustomizer.java @@ -102,7 +102,7 @@ class PortletUIServiceTrackerCustomizer ServiceObjects serviceObjects = bundleContext .getServiceObjects(reference); - OSGiUIProvider uiProvider = new OSGiUIProvider(serviceObjects); + OsgiUIProvider uiProvider = new OsgiUIProvider(serviceObjects); Dictionary properties = null; if (configuration != null) { @@ -112,7 +112,7 @@ class PortletUIServiceTrackerCustomizer properties = createPortletProperties(reference); } - VaadinOSGiPortlet portlet = new VaadinOSGiPortlet(uiProvider); + OsgiVaadinPortlet portlet = new OsgiVaadinPortlet(uiProvider); ServiceRegistration serviceRegistration = bundleContext .registerService(Portlet.class, portlet, properties); @@ -123,7 +123,7 @@ class PortletUIServiceTrackerCustomizer } private Dictionary createPortletProperties( - OSGiUIProvider uiProvider, ServiceReference reference, + OsgiUIProvider uiProvider, ServiceReference reference, VaadinLiferayPortletConfiguration configuration) { Hashtable properties = new Hashtable(); diff --git a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/VaadinOSGiPortlet.java b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/VaadinOSGiPortlet.java deleted file mode 100644 index e604ec353c..0000000000 --- a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/VaadinOSGiPortlet.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2000-2016 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.osgi.liferay; - -import com.vaadin.server.DeploymentConfiguration; -import com.vaadin.server.ServiceException; -import com.vaadin.server.VaadinPortlet; -import com.vaadin.server.VaadinPortletService; -import com.vaadin.ui.UI; - -/** - * {@link VaadinPortlet} that uses an {@link OSGiUIProvider} to configure its - * {@link UI}. - *

- * This only applies to Liferay Portal 7+ with OSGi support. - * - * @author Sampsa Sohlman - * - * @since 8.1 - */ -@SuppressWarnings("serial") -public class VaadinOSGiPortlet extends VaadinPortlet { - private OSGiUIProvider uiProvider; - - public VaadinOSGiPortlet(OSGiUIProvider uiProvider) { - this.uiProvider = uiProvider; - } - - @Override - protected VaadinPortletService createPortletService( - DeploymentConfiguration configuration) throws ServiceException { - OSGiVaadinPortletService osgiVaadinPortletService = new OSGiVaadinPortletService( - this, configuration, uiProvider); - osgiVaadinPortletService.init(); - return osgiVaadinPortletService; - } -} diff --git a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/VaadinPortletProvider.java b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/VaadinPortletProvider.java index 046fc489ae..78d0bff383 100644 --- a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/VaadinPortletProvider.java +++ b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/VaadinPortletProvider.java @@ -23,7 +23,7 @@ import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Deactivate; import org.osgi.util.tracker.ServiceTracker; -import com.vaadin.osgi.resources.OSGiVaadinResources; +import com.vaadin.osgi.resources.OsgiVaadinResources; import com.vaadin.osgi.resources.VaadinResourceService; import com.vaadin.ui.UI; @@ -46,7 +46,7 @@ public class VaadinPortletProvider { @Activate void activate(ComponentContext componentContext) throws Exception { BundleContext bundleContext = componentContext.getBundleContext(); - VaadinResourceService service = OSGiVaadinResources.getService(); + VaadinResourceService service = OsgiVaadinResources.getService(); portletUIServiceTrackerCustomizer = new PortletUIServiceTrackerCustomizer( service); -- cgit v1.2.3