KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > ejb > spi > distributed > DistributedReadOnlyBeanService


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.ejb.spi.distributed;
25
26 /**
27  * DistributedReadOnlyBeanService defines the methods that can be used to
28  * implement a distributed ReadOnly beans. An instance of
29  * ReadOnlyBeanRefreshEventHandler is used to handle requests received from
30  * other server instances. An instance of DistributedReadOnlyBeanNotifier is used to
31  * notify other server instances.
32  *
33  * @author Mahesh Kannan
34  * @see ReadOnlyBeanRefreshEventHandler
35  */

36 public interface DistributedReadOnlyBeanService {
37
38     /**
39      * This is typically done during appserver startup time. One of the LifeCycle
40      * listeners will create an instance of DistributedReadOnlyBeanNotifier and
41      * register that instance with DistributedReadOnlyBeanService
42      *
43      * @param notifier the notifier who is responsible for notifying refresh
44      * event(s) to other instances
45      */

46     public void setDistributedReadOnlyBeanNotifier(
47             DistributedReadOnlyBeanNotifier notifier);
48     
49     /**
50      * Called from ReadOnlyBeanContainer to register itself as a
51      * ReadOnlyBeanRefreshEventHandler.
52      *
53      * @param ejbID the ejbID that uniquely identifies the container
54      * @param loader the class loader that will be used to serialize/de-serialize
55      * the primary key
56      * @param handler The handler that is responsible for
57      * correctly refresing the state of a RO bean
58      */

59     public void addReadOnlyBeanRefreshEventHandler(
60             long ejbID, ClassLoader JavaDoc loader,
61             ReadOnlyBeanRefreshEventHandler handler);
62     
63     /**
64      * Called from ReadOnlyBeanContainer to unregister itself as a
65      * ReadOnlyBeanRefreshEventHandler. Typically called during undeployment.
66      *
67      * @param ejbID
68      */

69     public void removeReadOnlyBeanRefreshEventHandler(long ejbID);
70     
71     /**
72      * Called by the container after it has refreshed the RO bean
73      *
74      * @param ejbID the ejbID that uniquely identifies the container
75      * @param pk the primary key to be refreshed
76      */

77     public void notifyRefresh(long ejbID, Object JavaDoc pk);
78     
79     /**
80      * Called by the container after it has refreshed all RO beans
81      *
82      * @param ejbID the ejbID that uniquely identifies the container
83      */

84     public void notifyRefreshAll(long ejbID);
85     
86     /**
87      * Called from the DistributedReadOnlyBeanNotifier when it receives a (remote)
88      * request to refresh a RO bean
89      *
90      * @param ejbID the ejbID that uniquely identifies the container
91      * @param pk the primary key to be refreshed
92      */

93     public void handleRefreshRequest(long ejbID, byte[] pkData);
94     
95     /**
96      * Called from the DistributedReadOnlyBeanNotifier when it receives a (remote)
97      * request to refresh all RO beans
98      *
99      * @param ejbID the ejbID that uniquely identifies the container
100      */

101     public void handleRefreshAllRequest(long ejbID);
102     
103 }
104
Popular Tags