001: /*
002: * <copyright>
003: *
004: * Copyright 1997-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: package org.cougaar.planning.plugin.legacy;
028:
029: import java.util.Collection;
030: import java.util.Date;
031:
032: import org.cougaar.core.blackboard.SubscriberException;
033: import org.cougaar.core.blackboard.Subscription;
034: import org.cougaar.core.component.ServiceBroker;
035: import org.cougaar.core.domain.Factory;
036: import org.cougaar.core.mts.MessageAddress;
037: import org.cougaar.core.service.BlackboardService;
038: import org.cougaar.planning.ldm.ClusterServesPlugin;
039: import org.cougaar.planning.ldm.LDMServesPlugin;
040: import org.cougaar.planning.ldm.PlanningFactory;
041: import org.cougaar.util.UnaryPredicate;
042:
043: /**
044: * An interface for getting at the (normally) protected Plan API
045: * methods of a Plugin. Essentially all the of the protected Plan
046: * API methods of PluginAdapter can be accessed via these public
047: * methods.
048: * @see PluginAdapter#getDelegate()
049: **/
050:
051: public interface PluginDelegate {
052: BlackboardService getBlackboardService();
053:
054: /** Alias for getBlackboardService() **/
055: BlackboardService getSubscriber();
056:
057: ClusterServesPlugin getCluster();
058:
059: LDMServesPlugin getLDM();
060:
061: PlanningFactory getFactory();
062:
063: Factory getFactory(String domainname);
064:
065: MessageAddress getMessageAddress();
066:
067: void openTransaction();
068:
069: boolean tryOpenTransaction();
070:
071: void closeTransaction() throws SubscriberException;
072:
073: void closeTransactionDontReset() throws SubscriberException;
074:
075: /** @deprecated Use {@link #closeTransactionDontReset closeTransactionDontReset}
076: **/
077: void closeTransaction(boolean resetp) throws SubscriberException;
078:
079: boolean wasAwakened();
080:
081: void wake();
082:
083: long currentTimeMillis();
084:
085: Date getDate();
086:
087: Subscription subscribe(UnaryPredicate isMember);
088:
089: Subscription subscribe(UnaryPredicate isMember,
090: Collection realCollection);
091:
092: Subscription subscribe(UnaryPredicate isMember,
093: boolean isIncremental);
094:
095: Subscription subscribe(UnaryPredicate isMember,
096: Collection realCollection, boolean isIncremental);
097:
098: void unsubscribe(Subscription collection);
099:
100: Collection query(UnaryPredicate isMember);
101:
102: void publishAdd(Object o);
103:
104: void publishRemove(Object o);
105:
106: void publishChange(Object o);
107:
108: void publishChange(Object o, Collection changes);
109:
110: Collection getParameters();
111:
112: boolean didRehydrate();
113:
114: ServiceBroker getServiceBroker();
115:
116: /** Attempt to stake a claim on a logplan object, essentially telling
117: * everyone else that you and only you will be disposing, modifying, etc.
118: * it.
119: * Calls Claimable.tryClaim if the object is Claimable.
120: * @return true IFF success.
121: **/
122: boolean claim(Object o);
123:
124: /** Release an existing claim on a logplan object. This is likely to
125: * thow an exception if the object had not previously been (successfully)
126: * claimed by this plugin.
127: **/
128: void unclaim(Object o);
129: }
|