001/* 002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Thomas Roger <troger@nuxeo.com> 016 */ 017 018package org.nuxeo.ecm.platform.video; 019 020import static org.jboss.seam.ScopeType.SESSION; 021 022import java.io.Serializable; 023 024import org.apache.commons.logging.Log; 025import org.apache.commons.logging.LogFactory; 026import org.jboss.seam.annotations.Destroy; 027import org.jboss.seam.annotations.Name; 028import org.jboss.seam.annotations.Scope; 029import org.jboss.seam.annotations.Unwrap; 030import org.nuxeo.ecm.platform.video.service.VideoService; 031import org.nuxeo.runtime.api.Framework; 032 033/** 034 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a> 035 * @since 5.5 036 */ 037@Name("videoService") 038@Scope(SESSION) 039public class VideoServiceBusinessDelegate implements Serializable { 040 041 private static final long serialVersionUID = 1L; 042 043 private static final Log log = LogFactory.getLog(VideoServiceBusinessDelegate.class); 044 045 protected VideoService videoService; 046 047 /** 048 * Acquires a new {@link VideoService} reference. The related service may be deployed on a local or remote 049 * AppServer. 050 */ 051 @Unwrap 052 public VideoService getService() { 053 if (videoService == null) { 054 videoService = Framework.getService(VideoService.class); 055 } 056 return videoService; 057 } 058 059 @Destroy 060 public void destroy() { 061 if (videoService != null) { 062 videoService = null; 063 } 064 log.debug("Destroyed the seam component"); 065 } 066 067}