1 package org.apache.fulcrum.security.torque.peer;
2 /*
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 */
20 import java.io.Serializable;
21
22 import org.apache.fulcrum.security.spi.AbstractEntityManager;
23 import org.apache.fulcrum.security.util.DataBackendException;
24
25
26 /**
27 * Use this manager in role-list, if you want to swap default peer classes.
28 * It gets automatically registered in {@literal TorqueTurbine<Type>ManagerImpl classes. <Types> are: <User>, <Group>, <Permission>, <Role>}.
29 * You have to register your {@literal <Type>PeerImpl classes} by adding the {@link TorqueTurbinePeer} interface.
30 *
31 * If generating your ORM-classes from a Torque schema, you may have to delete or provide your own baseClasses in the schema.
32 *
33 * @see <a href="http://db.apache.org/torque/torque-4.0/documentation/orm-reference/database-4-0.xsd" target=_blank>Torque 4.0 Schema</a>
34 * @see org.apache.fulcrum.security.torque.turbine TorqueTurbine<Type>ManagerImpl referencing manager classes.
35 *
36 * @author <a href="mailto:gk@apache.org">Georg Kallidis</a>
37 * @version $Id$
38 */
39 public interface PeerManager extends Serializable
40 {
41
42 String ROLE = PeerManager.class.getName();
43
44 /**
45 * Expects the class name of a Torque Peer class, which could be instantiated.
46 * {@link org.apache.fulcrum.security.spi.AbstractEntityManager#getClassName()}
47 *
48 * @param peerClassName the peerClassName
49 * @return a cached peer class instance
50 * @throws DataBackendException data backend exception
51 */
52 public abstract <P extends Peer> P getPeerInstance(String peerClassName)
53 throws DataBackendException;
54
55 /**
56 * This method is provided to get more helpful exception messages.
57 *
58 * @param peerClassName the peerClassName
59 * @param class1 expected class the peers should implement
60 * @param className target class, i.e. the data object class type of the Peer object. The data object for which the peer is provided.
61 * @return peer instance
62 * @throws DataBackendException data backend exception
63 */
64 public abstract <P extends Peer> P getPeerInstance( String peerClassName, Class<? extends Peer> class1, String className ) throws DataBackendException;
65
66
67 }