001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)TestJavaEEVerifierMBeanImpl.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package test;
030:
031: import javax.management.MBeanException;
032: import javax.management.openmbean.OpenType;
033: import javax.management.openmbean.SimpleType;
034: import javax.management.openmbean.CompositeType;
035: import javax.management.openmbean.CompositeData;
036: import javax.management.openmbean.CompositeDataSupport;
037: import javax.management.openmbean.TabularDataSupport;
038: import javax.management.openmbean.TabularData;
039: import javax.management.openmbean.TabularType;
040: import com.sun.jbi.ui.common.JBIRemoteException;
041:
042: /**
043: * This class is used to provide a dummy MBean implementation
044: * for testing JavaEEVerifier integration.
045: * @author Sun Microsystems, Inc.
046: */
047:
048: public class TestJavaEEVerifierMBeanImpl implements
049: TestJavaEEVerifierMBean {
050:
051: /***
052: * Verify a service unit targeted to the JavaEE SE. This operation verifies the javaee/j2ee
053: * application and returns a CompositeData which has the verification status i.e. information
054: * related to the resources referenced by the application but are missing.
055: *
056: * @param serviceAssemblyPath - this is the path to the SA.
057: * @param suZipName - this is the SU zip name
058: * @param target - identifies the target for the service unit verification. This could
059: * be the DAS server instance "server", a standalone or clustered instance name
060: * or cluster.
061: * @return a TabularData with the verification result. The CompositeType of TabularData
062: * The column names in composite data are -
063: * "Ear Filename", "Referrence By","Referrence Class",
064: * "JNDI Name", "JNDI Class Type", "Message", "Status"
065: *
066: */
067: public TabularData verifyServiceUnit(String serviceAssemblyPath,
068: String suZipName, String target) throws MBeanException {
069:
070: String[] verifierTableItemaNames = new String[] {
071: "Ear Filename", "Referrence By", "Referrence Class",
072: "JNDI Name", "JNDI Class Type", "Message", "Status" };
073:
074: String[] verifierTableItemDescriptions = new String[] {
075: "Ear File Name", "Reference By", "Reference Class",
076: "Jndi Name", "Jndi Class", "Message", "Status"
077:
078: };
079:
080: OpenType[] verifierTableItemTypes = new OpenType[] {
081: SimpleType.STRING, SimpleType.STRING,
082: SimpleType.STRING, SimpleType.STRING,
083: SimpleType.STRING, SimpleType.STRING,
084: SimpleType.INTEGER };
085: try {
086:
087: CompositeType cType = new CompositeType(
088: "JavaEEVerifierTableDataType",
089: "Java EE Verification Report Table Type",
090: verifierTableItemaNames,
091: verifierTableItemDescriptions,
092: verifierTableItemTypes);
093:
094: TabularType reportTableType = new TabularType(
095: "JavaEEVerifierTableType",
096: "Java EE Verification Report Table Type", cType,
097: new String[] { "Referrence Class", "Referrence By",
098: "JNDI Name" });
099:
100: Object[] row1 = { "ordernotifiy.ear", "orders-ejb",
101: "OrderCheck.class", "jms/retailorders",
102: "javax.jms.Queue",
103: "Reference to JNDI object not found",
104: new Integer(2) };
105:
106: Object[] row2 = {
107: "classic.ear",
108: "V35Collab",
109: "Codegen.class",
110: "env1/Logicalhost1/OraExt1",
111: "Oracle eWay",
112: "An external configuration for Oracle eWay *MAY* be specified",
113: new Integer(1) };
114:
115: CompositeData cData1 = new CompositeDataSupport(cType,
116: verifierTableItemaNames, row1);
117:
118: CompositeData cData2 = new CompositeDataSupport(cType,
119: verifierTableItemaNames, row2);
120:
121: TabularData reportTable = new TabularDataSupport(
122: reportTableType);
123: reportTable.put(cData1);
124: reportTable.put(cData2);
125: return reportTable;
126: } catch (javax.management.openmbean.OpenDataException ex) {
127: System.out.println("JavaEEVerifierMBean could not be added"
128: + ex.getMessage());
129: throw new MBeanException(ex);
130: }
131:
132: }
133:
134: }
|