KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > diagnostics > ReportTarget


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.diagnostics;
24
25 import com.sun.enterprise.server.ApplicationServer;
26 import com.sun.logging.LogDomains;
27 import java.util.logging.Logger JavaDoc;
28 import java.util.List JavaDoc;
29 import java.io.File JavaDoc;
30 /**
31  *
32  * @author mu125243
33  */

34 public class ReportTarget {
35     protected String JavaDoc targetDir;
36     protected String JavaDoc targetName;
37     protected String JavaDoc repositoryName;
38     protected String JavaDoc repositoryDir;
39     protected TargetType type;
40     protected List JavaDoc<String JavaDoc> instances;
41     private boolean local ;
42     private static Logger JavaDoc logger =
43     LogDomains.getLogger(LogDomains.ADMIN_LOGGER);
44     
45     /** Creates a new instance of ReportServiceConfig */
46     public ReportTarget(String JavaDoc repositoryDir, String JavaDoc repositoryName, String JavaDoc targetName,
47             TargetType type, List JavaDoc<String JavaDoc> instances, boolean local) {
48         this.repositoryDir = repositoryDir;
49         this.repositoryName = repositoryName;
50         this.targetDir = repositoryDir + File.separator + repositoryName;
51         this.targetName = targetName;
52         this.type = type;
53         this.instances = instances;
54         this.local = local;
55       
56     }
57     /**
58      * Retrieves the type of this target
59      * @return target type
60      */

61     public TargetType getType() {
62         return type;
63     }
64     
65     /**
66      * Returns target name
67      * @return target name
68      */

69     public String JavaDoc getName() {
70         return targetName;
71     }
72     
73       
74     /**
75      * @return name of the central/cache repository
76      */

77     public String JavaDoc getRepositoryDir() {
78           return repositoryDir;
79     }
80     
81     public String JavaDoc getTargetDir() {
82         return targetDir;
83     }
84
85     public String JavaDoc getRepositoryName() {
86         return repositoryName;
87     }
88     /**
89      * @return name of the temp folder in which data is collected before
90      * compressing it
91      */

92     public String JavaDoc getIntermediateReportDir() {
93         return getArchiveDir() + File.separator + targetName;
94     }
95
96     public String JavaDoc getArchiveDir(){
97         return repositoryDir + File.separator +
98                 repositoryName + Defaults.TEMP_REPORT_FOLDER;
99     }
100
101     /**
102      * @return default directory in which diagnostic report is stored
103      */

104     public String JavaDoc getDefaultReportDir() {
105         return targetDir + Defaults.REPORT_FOLDER;
106     }
107     
108     public List JavaDoc<String JavaDoc> getInstances() {
109         return instances;
110     }
111     public String JavaDoc toString() {
112         return getName() +"," + getType() + "," + getRepositoryDir() + "," +
113                 getIntermediateReportDir() + "," + getDefaultReportDir() +
114                 "," + getInstances();
115     }
116 }
117
Popular Tags