KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > mbeans > DomainDiagnostics


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 package com.sun.enterprise.admin.mbeans;
24 import com.sun.enterprise.server.pluggable.PluggableFeatureFactory;
25 import com.sun.logging.LogDomains;
26 import com.sun.enterprise.server.ApplicationServer;
27
28 import java.util.logging.Logger JavaDoc;
29 import java.util.List JavaDoc;
30 import java.util.Map JavaDoc;
31 import java.util.logging.Level JavaDoc;
32
33
34 /**
35  * This is called DiagnosticMBean because it is meant to aid the
36  * diagnostice services. In future this mBean is expected to provide
37  * more diagnostic service specific methods.
38  *
39  * @author Sreenivas Munnangi
40  */

41
42 public class DomainDiagnostics implements DomainDiagnosticsMBean {
43
44     protected Logger JavaDoc _logger = LogDomains.getLogger(LogDomains.ADMIN_LOGGER);
45     /*protected static final StringManager _strMgr =
46             StringManager.getManager(DomainDiagnostics.class);*/

47     private PluggableFeatureFactory featureFactory;
48     /**
49      * default constructor
50      */

51     public DomainDiagnostics() {
52             initPluggableFeatureFactory();
53     }
54
55     /**
56      * get DAS diagnostic report
57      */

58     public String JavaDoc generateReport(Map JavaDoc input) throws Exception JavaDoc {
59         if(input != null) {
60             if(featureFactory != null) {
61                 com.sun.enterprise.diagnostics.DiagnosticAgent agent =
62                         featureFactory.getDiagnosticAgent();
63                  return agent.generateReport(input);
64             }
65             throw new Exception JavaDoc("Unable to retrieve feature factory");
66         }
67         throw new Exception JavaDoc(" Null input");
68     }
69             
70
71     /**
72      * @param repositoryDir absolute path of central repository
73      * @return list of attributes being masked with ****
74      * @throw DiagnosticException
75      */

76     public List JavaDoc<String JavaDoc> getConfidentialProperties()
77     throws Exception JavaDoc {
78         if(featureFactory != null) {
79             com.sun.enterprise.diagnostics.DiagnosticAgent agent =
80                         featureFactory.getDiagnosticAgent();
81             String JavaDoc repositoryDir = ApplicationServer.getServerContext().
82                     getInstanceEnvironment().getInstancesRoot();
83             return agent.getConfidentialProperties(repositoryDir);
84         }
85         throw new Exception JavaDoc(" Unable to retrive Pluggable Feature Factory");
86     }
87     
88    
89     private void initPluggableFeatureFactory() {
90         featureFactory =
91                 ApplicationServer.getServerContext().getPluggableFeatureFactory();
92         if (featureFactory == null) {
93             _logger.log(Level.WARNING,
94                     "diagnostic-service.error_initalize_pluggable_factory");
95         }
96     }
97 }
98
Popular Tags