001 package org.apache.ojb.broker;
002
003 /* Copyright 2002-2005 The Apache Software Foundation
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 import org.apache.ojb.broker.accesslayer.RelationshipPrefetcherFactory;
019 import org.apache.ojb.broker.core.QueryReferenceBroker;
020 import org.apache.ojb.broker.core.proxy.ProxyFactory;
021 import org.apache.ojb.broker.metadata.ClassDescriptor;
022
023 /**
024 * Extended version of the {@link PersistenceBroker} specifying additional functionality
025 * that is only relevant internally.
026 *
027 * @author Armin Waibel
028 * @version $Id: PersistenceBrokerInternal.java,v 1.1 2007-08-24 22:17:36 ewestfal Exp $
029 */
030 public interface PersistenceBrokerInternal extends PersistenceBroker
031 {
032 /**
033 * Determines whether this instance is handled by a managed
034 * environment, i.e. whether it is registered within a JTA transaction.
035 *
036 * @return <code>true</code> if this broker is managed
037 */
038 public boolean isManaged();
039
040 /**
041 * Specifies whether this instance is handled by a managed
042 * environment, i.e. whether it is registered within a JTA transaction.
043 * Note that on {@link #close()} this will automatically be reset
044 * to <em>false</em>.
045 *
046 * @param managed <code>true</code> if this broker is managed
047 */
048 public void setManaged(boolean managed);
049
050 /**
051 * Performs the real store work (insert or update) and is intended for use by
052 * top-level apis internally.
053 *
054 * @param obj The object to store
055 * @param oid The identity of the object to store
056 * @param cld The class descriptor of the object
057 * @param insert If <em>true</em> an insert operation will be performed, else update
058 * operation
059 * @param ignoreReferences Whether automatic storing of contained references/collections (except
060 * super-references) shall be suppressed (independent of the auto-update
061 * setting in the metadata)
062 */
063 public void store(Object obj, Identity oid, ClassDescriptor cld, boolean insert, boolean ignoreReferences);
064
065 /**
066 * Deletes the persistence representation of the given object in the underlying
067 * persistence system. This method is intended for use in top-level apis internally.
068 *
069 * @param obj The object to delete
070 * @param ignoreReferences Whether automatic deletion of contained references/collections (except
071 * super-references) shall be suppressed (independent of the auto-delete
072 * setting in the metadata)
073 */
074 public void delete(Object obj, boolean ignoreReferences) throws PersistenceBrokerException;
075
076 /**
077 * Returns the broker specifically for retrieving references via query.
078 *
079 * @return The query reference broker
080 */
081 public QueryReferenceBroker getReferenceBroker();
082
083 /**
084 * Refreshes the references of the given object whose <code>refresh</code>
085 * is set to <code>true</code>.
086 *
087 * @param obj The object to check
088 * @param oid The identity of the object
089 * @param cld The class descriptor for the object
090 */
091 public void checkRefreshRelationships(Object obj, Identity oid, ClassDescriptor cld);
092
093 /**
094 * Return the factory for creating relationship prefetcher objects.
095 *
096 * @return The factory
097 */
098 public RelationshipPrefetcherFactory getRelationshipPrefetcherFactory();
099
100 /**
101 * Return the factory for creating proxies.
102 *
103 * @return The factory
104 */
105 public ProxyFactory getProxyFactory();
106
107 /**
108 * Shortcut method for creating a proxy of the given type.
109 *
110 * @param proxyClass The proxy type
111 * @param realSubjectsIdentity The identity of the real subject
112 * @return The proxy
113 */
114 public Object createProxy(Class proxyClass, Identity realSubjectsIdentity);
115 }