001    /**
002     * Copyright (c) 2000-2013 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.security.pacl.permission;
016    
017    import java.security.BasicPermission;
018    
019    /**
020     * @author Brian Wing Shun Chan
021     */
022    public class PortalMessageBusPermission extends BasicPermission {
023    
024            public static void checkListen(String destinationName) {
025                    _pacl.checkListen(destinationName);
026            }
027    
028            public static void checkSend(String destinationName) {
029                    _pacl.checkSend(destinationName);
030            }
031    
032            public PortalMessageBusPermission(String name, String destinationName) {
033                    super(name);
034    
035                    _destinationName = destinationName;
036            }
037    
038            @Override
039            public String getActions() {
040                    return _destinationName;
041            }
042    
043            public String getDestinationName() {
044                    return _destinationName;
045            }
046    
047            public static interface PACL {
048    
049                    public void checkListen(String destinationName);
050    
051                    public void checkSend(String destinationName);
052    
053            }
054    
055            private static PACL _pacl = new NoPACL();
056    
057            private String _destinationName;
058    
059            private static class NoPACL implements PACL {
060    
061                    @Override
062                    public void checkListen(String destinationName) {
063                    }
064    
065                    @Override
066                    public void checkSend(String destinationName) {
067                    }
068    
069            }
070    
071    }