001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *  http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    
021    package javax.servlet;
022    
023    import javax.servlet.annotation.ServletSecurity;
024    
025    /**
026     * @version $Rev: 901916 $ $Date: 2010-01-21 18:12:17 -0500 (Thu, 21 Jan 2010) $
027     * @since 3.0
028     */
029    public class HttpConstraintElement {
030        private final ServletSecurity.EmptyRoleSemantic emptyRoleSemantic;
031        private final String[] rolesAllowed;
032        private final ServletSecurity.TransportGuarantee transportGuarantee;
033    
034        public HttpConstraintElement() {
035            emptyRoleSemantic = ServletSecurity.EmptyRoleSemantic.PERMIT;
036            rolesAllowed = new String[] {};
037            transportGuarantee = ServletSecurity.TransportGuarantee.NONE;
038        }
039    
040        public HttpConstraintElement(ServletSecurity.EmptyRoleSemantic emptyRoleSemantic) {
041            this.emptyRoleSemantic = emptyRoleSemantic;
042            rolesAllowed = new String[] {};
043            transportGuarantee = ServletSecurity.TransportGuarantee.NONE;
044        }
045    
046        public HttpConstraintElement(ServletSecurity.EmptyRoleSemantic emptyRoleSemantic, ServletSecurity.TransportGuarantee transportGuarantee, String... rolesAllowed) {
047            this.emptyRoleSemantic = emptyRoleSemantic;
048            this.rolesAllowed = rolesAllowed;
049            this.transportGuarantee = transportGuarantee;
050        }
051    
052        public HttpConstraintElement(ServletSecurity.TransportGuarantee transportGuarantee, String... rolesAllowed) {
053            emptyRoleSemantic = ServletSecurity.EmptyRoleSemantic.PERMIT;
054            this.rolesAllowed = rolesAllowed;
055            this.transportGuarantee = transportGuarantee;
056        }
057    
058        public ServletSecurity.EmptyRoleSemantic getEmptyRoleSemantic() {
059            return emptyRoleSemantic;
060        }
061    
062        public String[] getRolesAllowed() {
063            return rolesAllowed;
064        }
065    
066        public ServletSecurity.TransportGuarantee getTransportGuarantee() {
067            return transportGuarantee;
068        }
069    }