001    /**
002     * Copyright (c) 2000-present 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.kernel.lock;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    
019    /**
020     * @author Tina Tian
021     */
022    public interface LockManager {
023    
024            public void clear();
025    
026            public Lock createLock(
027                    long lockId, long companyId, long userId, String userName);
028    
029            public Lock getLock(String className, long key) throws PortalException;
030    
031            public Lock getLock(String className, String key) throws PortalException;
032    
033            public Lock getLockByUuidAndCompanyId(String uuid, long companyId)
034                    throws PortalException;
035    
036            public boolean hasLock(long userId, String className, long key);
037    
038            public boolean hasLock(long userId, String className, String key);
039    
040            public boolean isLocked(String className, long key);
041    
042            public boolean isLocked(String className, String key);
043    
044            public Lock lock(
045                            long userId, String className, long key, String owner,
046                            boolean inheritable, long expirationTime)
047                    throws PortalException;
048    
049            public Lock lock(
050                            long userId, String className, String key, String owner,
051                            boolean inheritable, long expirationTime)
052                    throws PortalException;
053    
054            public Lock lock(String className, String key, String owner);
055    
056            public Lock lock(
057                    String className, String key, String expectedOwner,
058                    String updatedOwner);
059    
060            public Lock refresh(String uuid, long companyId, long expirationTime)
061                    throws PortalException;
062    
063            public void unlock(String className, long key);
064    
065            public void unlock(String className, String key);
066    
067            public void unlock(String className, String key, String owner);
068    
069    }