001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * The utility for the resource remote service. This utility wraps {@link com.liferay.portal.service.impl.ResourceServiceImpl} and is the primary access point for service operations in application layer code running on a remote server.
023     *
024     * <p>
025     * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see ResourceService
030     * @see com.liferay.portal.service.base.ResourceServiceBaseImpl
031     * @see com.liferay.portal.service.impl.ResourceServiceImpl
032     * @generated
033     */
034    public class ResourceServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.ResourceServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040            public static com.liferay.portal.model.Resource getResource(
041                    long companyId, java.lang.String name, int scope,
042                    java.lang.String primKey)
043                    throws com.liferay.portal.kernel.exception.PortalException,
044                            com.liferay.portal.kernel.exception.SystemException {
045                    return getService().getResource(companyId, name, scope, primKey);
046            }
047    
048            public static ResourceService getService() {
049                    if (_service == null) {
050                            _service = (ResourceService)PortalBeanLocatorUtil.locate(ResourceService.class.getName());
051    
052                            ReferenceRegistry.registerReference(ResourceServiceUtil.class,
053                                    "_service");
054                            MethodCache.remove(ResourceService.class);
055                    }
056    
057                    return _service;
058            }
059    
060            public void setService(ResourceService service) {
061                    MethodCache.remove(ResourceService.class);
062    
063                    _service = service;
064    
065                    ReferenceRegistry.registerReference(ResourceServiceUtil.class,
066                            "_service");
067                    MethodCache.remove(ResourceService.class);
068            }
069    
070            private static ResourceService _service;
071    }