Source Code Cross Referenced for ActivationGroup.java in  » Apache-Harmony-Java-SE » java-package » java » rmi » activation » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.rmi.activation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  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:         *
015:         * See the License for the specific language governing permissions and
016:         * limitations under the License.
017:         */
018:
019:        package java.rmi.activation;
020:
021:        import java.lang.reflect.Constructor;
022:        import java.rmi.MarshalledObject;
023:        import java.rmi.Naming;
024:        import java.rmi.Remote;
025:        import java.rmi.RemoteException;
026:        import java.rmi.server.RMIClassLoader;
027:        import java.rmi.server.RemoteObject;
028:        import java.rmi.server.UnicastRemoteObject;
029:        import java.security.AccessController;
030:
031:        import org.apache.harmony.rmi.common.GetStringPropAction;
032:        import org.apache.harmony.rmi.common.RMILog;
033:        import org.apache.harmony.rmi.internal.nls.Messages;
034:
035:        public abstract class ActivationGroup extends UnicastRemoteObject
036:                implements  ActivationInstantiator {
037:            private static final long serialVersionUID = -7696947875314805420L;
038:
039:            private static final RMILog rlog = RMILog.getActivationLog();
040:
041:            /**
042:             * The ActivationSystem for this VM.
043:             */
044:            private static ActivationSystem current_AS;
045:
046:            /**
047:             * Current ActivationGroupID
048:             */
049:            private static ActivationGroupID current_AGID;
050:
051:            /**
052:             * Current ActivationGroup.
053:             */
054:            private static ActivationGroup current_AG;
055:
056:            public static synchronized ActivationGroup createGroup(
057:                    ActivationGroupID id, ActivationGroupDesc desc,
058:                    long incarnation) throws ActivationException {
059:                // rmi.log.17=ActivationGroup.createGroup [id={0}, desc={1},
060:                // incarnation={2}
061:                rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.17", //$NON-NLS-1$ 
062:                        new Object[] { id, desc, incarnation }));
063:                SecurityManager sm = System.getSecurityManager();
064:                if (sm != null) {
065:                    sm.checkSetFactory();
066:                }
067:                /*
068:                 * Classname of the ActivationGroup implementation. If the group class
069:                 * name was given in 'desc' assign it to group_CN, use default
070:                 * otherwise.
071:                 */
072:                String group_CN = (desc.getClassName() == null) ? "org.apache.harmony.rmi.activation.ActivationGroupImpl" //$NON-NLS-1$
073:                        : desc.getClassName();
074:                // rmi.log.18=group_CN = {0}
075:                rlog.log(RMILog.VERBOSE, Messages.getString(
076:                        "rmi.log.18", group_CN)); //$NON-NLS-1$
077:                if (current_AG != null) {
078:                    // rmi.11=The ActivationGroup for this VM already exists.
079:                    throw new ActivationException(Messages.getString("rmi.11")); //$NON-NLS-1$
080:                }
081:                try {
082:                    // rmi.log.19=Ready to load ActivationGroupImpl class
083:                    rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.19")); //$NON-NLS-1$
084:                    Class<?> cl = RMIClassLoader.loadClass(desc.getLocation(),
085:                            group_CN);
086:                    // rmi.log.1A=ag class = {0}
087:                    rlog.log(RMILog.VERBOSE, Messages.getString(
088:                            "rmi.log.1A", cl)); //$NON-NLS-1$
089:                    Class[] special_constructor_parameter_classes = {
090:                            ActivationGroupID.class, MarshalledObject.class };
091:                    Constructor<?> constructor = cl
092:                            .getConstructor(special_constructor_parameter_classes);
093:                    Object[] constructor_parameters = { id, desc.getData() };
094:                    ActivationGroup ag = (ActivationGroup) constructor
095:                            .newInstance(constructor_parameters);
096:                    // rmi.log.1B=ag = {0}
097:                    rlog.log(RMILog.VERBOSE, Messages.getString(
098:                            "rmi.log.1B", ag)); //$NON-NLS-1$
099:                    current_AS = id.getSystem();
100:                    // rmi.log.1C=current_AS = {0}
101:                    rlog.log(RMILog.VERBOSE, Messages.getString(
102:                            "rmi.log.1C", current_AS)); //$NON-NLS-1$
103:                    ag.incarnation = incarnation;
104:                    // rmi.log.1D=ag.incarnation = {0}
105:                    rlog.log(RMILog.VERBOSE, Messages.getString(
106:                            "rmi.log.1D", ag.incarnation)); //$NON-NLS-1$
107:                    ag.monitor = current_AS.activeGroup(id, ag, incarnation);
108:                    // rmi.log.1E=ag.monitor = {0}
109:                    rlog.log(RMILog.VERBOSE, Messages.getString(
110:                            "rmi.log.1E", ag.monitor)); //$NON-NLS-1$
111:                    current_AG = ag;
112:                    current_AGID = id;
113:                } catch (Throwable t) {
114:                    // rmi.log.1F=Exception in createGroup: {0}
115:                    rlog.log(RMILog.VERBOSE, Messages
116:                            .getString("rmi.log.1F", t)); //$NON-NLS-1$
117:                    // rmi.12=Unable to create group.
118:                    throw new ActivationException(
119:                            Messages.getString("rmi.12"), t); //$NON-NLS-1$
120:                }
121:                // rmi.log.20=Group created: {0}
122:                rlog.log(RMILog.VERBOSE, Messages.getString(
123:                        "rmi.log.20", current_AG)); //$NON-NLS-1$
124:                return current_AG;
125:            }
126:
127:            public static synchronized ActivationGroupID currentGroupID() {
128:                return current_AGID;
129:            }
130:
131:            public static synchronized ActivationSystem getSystem()
132:                    throws ActivationException {
133:                // rmi.log.21=---------- ActivationGroup.getSystem() ----------
134:                rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.21")); //$NON-NLS-1$
135:                try {
136:                    if (current_AS == null) {
137:                        String port = AccessController
138:                                .doPrivileged(new GetStringPropAction(
139:                                        "java.rmi.activation.port", //$NON-NLS-1$
140:                                        ActivationSystem.SYSTEM_PORT + "")); //$NON-NLS-1$
141:                        current_AS = (ActivationSystem) Naming
142:                                .lookup("//:" + port //$NON-NLS-1$
143:                                        + "/java.rmi.activation.ActivationSystem"); //$NON-NLS-1$
144:                        // rmi.log.22=Activation System was got using Naming.lookup() at
145:                        // port {0}
146:                        rlog.log(RMILog.VERBOSE, Messages.getString(
147:                                "rmi.log.22", port)); //$NON-NLS-1$
148:                    }
149:                } catch (Throwable t) {
150:                    // rmi.13=getSystem fails.
151:                    throw new ActivationException(
152:                            Messages.getString("rmi.13"), t); //$NON-NLS-1$
153:                }
154:                // rmi.log.1C=current_AS = {0}
155:                rlog.log(RMILog.VERBOSE, Messages.getString(
156:                        "rmi.log.1C", current_AS)); //$NON-NLS-1$
157:
158:                // rmi.log.23=current_AS.ref = {0}
159:                if (current_AS instanceof  RemoteObject) {
160:                    rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.23", //$NON-NLS-1$
161:                            ((RemoteObject) current_AS).getRef()));
162:                }
163:                // rmi.log.24=---------- END -> ActivationGroup.getSystem() ----------
164:                rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.24")); //$NON-NLS-1$
165:                return current_AS;
166:            }
167:
168:            public static synchronized void setSystem(ActivationSystem system)
169:                    throws ActivationException {
170:                if (current_AS != null) {
171:                    // rmi.14=The ActivationSystem for this ActivationGroup was already
172:                    // defined.
173:                    throw new ActivationException(Messages.getString("rmi.14")); //$NON-NLS-1$
174:                }
175:                current_AS = system;
176:            }
177:
178:            static synchronized ActivationGroup getCurrentAG() {
179:                return current_AG;
180:            }
181:
182:            private ActivationGroupID groupID;
183:
184:            private ActivationMonitor monitor;
185:
186:            private long incarnation;
187:
188:            protected ActivationGroup(ActivationGroupID groupID)
189:                    throws RemoteException {
190:                /**
191:                 * We need to export this group, so we call the constructor of the
192:                 * superclass.
193:                 */
194:                super (0);
195:                this .groupID = groupID;
196:            }
197:
198:            protected void activeObject(ActivationID id, MarshalledObject mobj)
199:                    throws ActivationException, UnknownObjectException,
200:                    RemoteException {
201:                // rmi.log.14=ActivationGroup.activeObject: {0}; {1}
202:                rlog.log(RMILog.VERBOSE, Messages.getString(
203:                        "rmi.log.14", id, mobj)); //$NON-NLS-1$
204:                // rmi.log.15=monitor: {0}
205:                rlog.log(RMILog.VERBOSE, Messages.getString(
206:                        "rmi.log.15", monitor)); //$NON-NLS-1$
207:                monitor.activeObject(id, mobj);
208:                // rmi.log.16=ActivationGroup.activeObject finished.
209:                rlog.log(RMILog.VERBOSE, Messages.getString("rmi.log.16")); //$NON-NLS-1$
210:            }
211:
212:            public abstract void activeObject(ActivationID id, Remote obj)
213:                    throws ActivationException, UnknownObjectException,
214:                    RemoteException;
215:
216:            protected void inactiveGroup() throws UnknownGroupException,
217:                    RemoteException {
218:                monitor.inactiveGroup(groupID, incarnation);
219:            }
220:
221:            public boolean inactiveObject(ActivationID id)
222:                    throws ActivationException, UnknownObjectException,
223:                    RemoteException {
224:                monitor.inactiveObject(id);
225:                return true;
226:            }
227:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.