001package org.apache.fulcrum.security.torque.peer;
002/*
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *   http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied.  See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 */
020import java.sql.Connection;
021
022import org.apache.fulcrum.security.entity.Permission;
023import org.apache.fulcrum.security.entity.Role;
024import org.apache.fulcrum.security.model.turbine.entity.TurbinePermission;
025import org.apache.torque.TorqueException;
026
027/**
028 * This extension to the marker interface {@linkplain Peer} is to allow for swappable Peer implementations 
029 * in Turbine Torque Manager Implementations.  
030 * 
031 * 
032 * @author <a href="mailto:gk@apache.org">Georg Kallidis</a>
033 * @version $Id$
034 */
035public interface TurbineRolePermissionPeerMapper
036
037{
038        
039    /**
040     * Returns the associated TurbineRole object.
041     * If it was not retrieved before, the object is retrieved from
042     * the database
043     *
044     * @return the associated TurbineRole object
045     * @throws TorqueException  if any database error occurs when reading from the database fails.
046     */
047    Role getTurbineRole()
048        throws TorqueException;
049
050    /**
051     * Return the associated TurbineRole object
052     * If it was not retrieved before, the object is retrieved from
053     * the database using the passed connection
054     *
055     * @param connection the connection used to retrieve the associated object
056     *        from the database, if it was not retrieved before
057     * @return the associated TurbineRole object
058     * @throws TorqueException  if any database error occurs
059     */
060    Role getTurbineRole( Connection connection )
061        throws TorqueException;
062
063    /**
064     * Returns the associated TurbinePermission object.
065     * If it was not retrieved before, the object is retrieved from
066     * the database
067     *
068     * @return the associated TurbinePermission object
069     * @throws TorqueException when reading from the database fails.
070     */
071    Permission getTurbinePermission() throws TorqueException;
072    
073    /**
074     * Return the associated TurbinePermission object
075     * If it was not retrieved before, the object is retrieved from
076     * the database using the passed connection
077     *
078     * @param connection the connection used to retrieve the associated object
079     *        from the database, if it was not retrieved before
080     * @return the associated TurbinePermission object
081     * @throws TorqueException If a problem occurs with the get[$filedType] method.
082     */
083    public TurbinePermission getTurbinePermission(Connection connection)
084        throws TorqueException;
085
086}