Source Code Cross Referenced for UBTSettingsHostBridge.java in  » Portal » Open-Portal » com » sun » portal » ubt » admin » mbeans » 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 » Portal » Open Portal » com.sun.portal.ubt.admin.mbeans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.sun.portal.ubt.admin.mbeans;
002:
003:        import com.sun.portal.admin.server.mbeans.PSResource;
004:        import com.sun.portal.admin.server.PASModule;
005:        import com.sun.portal.admin.server.AdminServerUtil;
006:        import com.sun.portal.admin.common.context.PSConfigContext;
007:        import com.sun.portal.admin.common.context.PortalDomainContext;
008:        import com.sun.portal.admin.common.util.AdminUtil;
009:        import com.sun.portal.log.common.PortalLogger;
010:
011:        import javax.management.*;
012:        import javax.management.remote.JMXConnector;
013:        import java.util.Hashtable;
014:        import java.util.List;
015:        import java.util.LinkedList;
016:        import java.util.logging.Logger;
017:        import java.util.logging.Level;
018:        import java.util.logging.LogRecord;
019:
020:        /**
021:         *
022:         */
023:        public class UBTSettingsHostBridge extends PSResource implements 
024:                UBTSettingsHostBridgeMBean {
025:            private String psPortalID;
026:            private static Logger logger = PortalLogger
027:                    .getLogger(UBTSettingsHostBridge.class);
028:
029:            public void init(PSConfigContext cc, PortalDomainContext pdc,
030:                    List path) {
031:                super .init(cc, pdc, path);
032:                psPortalID = (String) path.get(1);
033:            }
034:
035:            public Hashtable getUBTSettings(String instance) throws Exception {
036:                Object obj = null;
037:                MBeanServerConnection serverConnection = null;
038:                try {
039:                    //get appropriate MBeanServerConnector
040:                    serverConnection = getConnection(instance);
041:                    //invoke getCommonLogDetails on PortalLogconfigurator on that server
042:                    ObjectName ubtConfigObjName = getUbtConfigObjName();
043:                    obj = serverConnection.getAttribute(ubtConfigObjName,
044:                            "UBTSettings");
045:                } finally {
046:                    closeRemoteConnection(serverConnection);
047:                }
048:                if (obj == null)
049:                    return null;
050:                else
051:                    return (Hashtable) obj;
052:            }
053:
054:            public void setUBTSettings(Hashtable values, String instance)
055:                    throws Exception {
056:                Object obj = null;
057:                MBeanServerConnection serverConnection = null;
058:                try {
059:                    //get appropriate MBeanServerConnector
060:                    serverConnection = getConnection(instance);
061:                    //invoke getCommonLogDetails on PortalLogconfigurator on that server
062:                    ObjectName ubtConfigObjName = getUbtConfigObjName();
063:                    Attribute attribute = new Attribute("UBTSettings", values);
064:                    serverConnection.setAttribute(ubtConfigObjName, attribute);
065:                } finally {
066:                    closeRemoteConnection(serverConnection);
067:                }
068:            }
069:
070:            private ObjectName getUbtConfigObjName()
071:                    throws MalformedObjectNameException {
072:                LinkedList path = new LinkedList();
073:                path.addFirst(m_sPsDomainID);
074:                path.addFirst(psPortalID);
075:                path.addFirst("UBTSettings");
076:                return AdminUtil.getResourceMBeanObjectName(
077:                        UBTSettingsMBean.PORTAL_UBT_SETTINGS_OBJECT_NAME, path);
078:            }
079:
080:            private void closeRemoteConnection(
081:                    MBeanServerConnection serverConnection) {
082:                try {
083:                    if (!serverConnection.equals(PASModule.getMBeanServer()))
084:                        ((JMXConnector) serverConnection).close();
085:                } catch (Exception e) {
086:                    //drop through it is not open
087:                }
088:            }
089:
090:            private MBeanServerConnection getConnection(String instance)
091:                    throws Exception {
092:                MBeanServerConnection serverConnection;
093:                String host = getHost(instance);
094:                //find if it is local or remote
095:                if (isRemote(instance)) {
096:                    try {
097:                        JMXConnector connector = AdminServerUtil
098:                                .getJMXConnector(host);
099:                        serverConnection = connector.getMBeanServerConnection();
100:                    } catch (Exception e) {
101:                        LogRecord rec = new LogRecord(Level.WARNING,
102:                                "PSUB_CSPUAM0009");
103:                        rec.setParameters(new Object[] { host });
104:                        rec.setThrown(e);
105:                        rec.setLoggerName(logger.getName());
106:                        logger.log(rec);
107:                        throw e;
108:                    }
109:                } else {
110:                    serverConnection = PASModule.getMBeanServer();
111:                }
112:                return serverConnection;
113:            }
114:
115:            private String getHost(String instance) throws Exception {
116:                String host = null;
117:                ObjectName objName = getPortalInstanceObjectName(instance);
118:                host = (String) (PASModule.getMBeanServer().getAttribute(
119:                        objName, "Host"));
120:                return host;
121:            }
122:
123:            private boolean isRemote(String instance) throws Exception {
124:                boolean isRemote = false;
125:                MBeanServer server = PASModule.getMBeanServer();
126:                Boolean isLocal = (Boolean) server.invoke(
127:                        getPortalInstanceObjectName(instance), "isLocal", null,
128:                        null);
129:                isRemote = !isLocal.booleanValue();
130:                return isRemote;
131:            }
132:
133:            private ObjectName getPortalInstanceObjectName(String instance)
134:                    throws Exception {
135:                return AdminUtil.getInstanceMBeanObjectName(m_sPsDomainID,
136:                        psPortalID, instance);
137:            }
138:
139:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.