0001: /*
0002: * BEGIN_HEADER - DO NOT EDIT
0003: *
0004: * The contents of this file are subject to the terms
0005: * of the Common Development and Distribution License
0006: * (the "License"). You may not use this file except
0007: * in compliance with the License.
0008: *
0009: * You can obtain a copy of the license at
0010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
0011: * See the License for the specific language governing
0012: * permissions and limitations under the License.
0013: *
0014: * When distributing Covered Code, include this CDDL
0015: * HEADER in each file and include the License file at
0016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
0017: * If applicable add the following below this CDDL HEADER,
0018: * with the fields enclosed by brackets "[]" replaced with
0019: * your own identifying information: Portions Copyright
0020: * [year] [name of copyright owner]
0021: */
0022:
0023: /*
0024: * @(#)AdministrationServiceImpl.java
0025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
0026: *
0027: * END_HEADER - DO NOT EDIT
0028: */
0029:
0030: package com.sun.esb.management.impl.administration;
0031:
0032: import java.io.Serializable;
0033: import java.util.Map;
0034: import java.util.Properties;
0035: import java.util.Set;
0036:
0037: import javax.management.MBeanServerConnection;
0038: import javax.management.ObjectName;
0039:
0040: import com.sun.esb.management.api.administration.AdministrationService;
0041: import com.sun.esb.management.base.services.AbstractServiceImpl;
0042: import com.sun.esb.management.common.ManagementRemoteException;
0043:
0044: /**
0045: * Defines client operations for common administration services for the client.
0046: *
0047: * @author graj
0048: */
0049: public class AdministrationServiceImpl extends AbstractServiceImpl
0050: implements Serializable, AdministrationService {
0051:
0052: static final long serialVersionUID = -1L;
0053:
0054: /** Constructor - Constructs a new instance of AdministrationServiceImpl */
0055: public AdministrationServiceImpl() {
0056: super (null, false);
0057: }
0058:
0059: /**
0060: * Constructor - Constructs a new instance of AdministrationServiceImpl
0061: *
0062: * @param serverConnection
0063: */
0064: public AdministrationServiceImpl(
0065: MBeanServerConnection serverConnection) {
0066: super (serverConnection, false);
0067: }
0068:
0069: /**
0070: * Constructor - Constructs a new instance of AdministrationServiceImpl
0071: *
0072: * @param serverConnection
0073: * @param isRemoteConnection
0074: */
0075: public AdministrationServiceImpl(
0076: MBeanServerConnection serverConnection,
0077: boolean isRemoteConnection) {
0078: super (serverConnection, isRemoteConnection);
0079: }
0080:
0081: /**
0082: * Returns a map of target names to an array of target instance names.
0083: * In the case cluster targets, the key contains the cluster target name,
0084: * and the the value contains an array of the "target instance" names.
0085: * If it is not a cluster target, the key contains the targetName, and
0086: * the value is null.
0087: *
0088: * @return map of target names to array of target instance names
0089: * @throws ManagementRemoteException
0090: */
0091: @SuppressWarnings("unchecked")
0092: public Map<String /*targetName*/, String[] /*targetInstanceNames*/> listTargetNames()
0093: throws ManagementRemoteException {
0094: return super .listTargetNames();
0095: }
0096:
0097: /**
0098: * Retrieve runtime version information
0099: * @return map of targetName to Properties elements detailing version info
0100: * @throws ManagementRemoteException
0101: */
0102: @SuppressWarnings("unchecked")
0103: public Map<String /*targetName*/, Properties /*version information*/> getRuntimeDetails()
0104: throws ManagementRemoteException {
0105: Map<String /*targetName*/, Properties /*version information*/> result = null;
0106: ObjectName mbeanName = this
0107: .getAdministrationServiceMBeanObjectName();
0108:
0109: Object[] params = null;
0110: String[] signature = null;
0111: result = (Map<String /*targetName*/, Properties /*version information*/>) this
0112: .invokeMBeanOperation(mbeanName, "getRuntimeDetails",
0113: params, signature);
0114:
0115: return result;
0116: }
0117:
0118: /**
0119: * Checks to see if the Target (server, cluster) is up or down.
0120: *
0121: * @param targetName
0122: * name of the target (e.g., cluster1, server, etc.)
0123: * @return true if Target is up, false if not
0124: * @throws ManagementRemoteException
0125: * if error or exception occurs.
0126: *
0127: * @see com.sun.esb.management.api.runtime.RuntimeManagementService#isTargetUp(java.lang.String)
0128: */
0129: public boolean isTargetUp(String targetName)
0130: throws ManagementRemoteException {
0131: boolean result = false;
0132: ObjectName mbeanName = this
0133: .getAdministrationServiceMBeanObjectName();
0134:
0135: Boolean resultObject = null;
0136: Object[] params = new Object[1];
0137: params[0] = targetName;
0138:
0139: String[] signature = new String[1];
0140: signature[0] = "java.lang.String";
0141: resultObject = (Boolean) this .invokeMBeanOperation(mbeanName,
0142: "isTargetUp", params, signature);
0143: if (resultObject != null) {
0144: result = resultObject.booleanValue();
0145: }
0146:
0147: return result;
0148: }
0149:
0150: /**
0151: * Retrieve the Component Installation descriptor for the server target.
0152: *
0153: * The Installation descriptor will never be different for a component name
0154: * in a JBI system because there's only one component allowed with that same
0155: * name. Therefore, this implies a registry lookup for the server target.
0156: *
0157: * @param Component
0158: * name as a string
0159: * @return the Component Installation descriptor as a string
0160: * @throws ManagementRemoteException
0161: * on error
0162: *
0163: * @see com.sun.esb.management.api.administration.AdministrationService#getComponentInstallationDescriptor(java.lang.String)
0164: */
0165: public String getComponentInstallationDescriptor(
0166: String componentName) throws ManagementRemoteException {
0167: String result = null;
0168: Object resultObject = null;
0169: ObjectName mbeanName = this
0170: .getAdministrationServiceMBeanObjectName();
0171:
0172: Object[] params = new Object[1];
0173: params[0] = componentName;
0174:
0175: String[] signature = new String[1];
0176: signature[0] = "java.lang.String";
0177:
0178: resultObject = this
0179: .invokeMBeanOperation(mbeanName,
0180: "getComponentInstallationDescriptor", params,
0181: signature);
0182:
0183: if (resultObject != null) {
0184: result = resultObject.toString();
0185: }
0186: return result;
0187: }
0188:
0189: /**
0190: * Returns the jbi.xml Deployment Descriptor for a Service Assembly.
0191: *
0192: * @param the
0193: * name of the Service Assembly
0194: * @return the jbi.xml deployment descriptor of the archive
0195: * @throws ManagementRemoteException
0196: * if error or exception occurs.
0197: *
0198: * @see com.sun.esb.management.api.administration.AdministrationService#getServiceAssemblyDeploymentDescriptor(java.lang.String)
0199: */
0200: public String getServiceAssemblyDeploymentDescriptor(
0201: String serviceAssemblyName)
0202: throws ManagementRemoteException {
0203: Object resultObject = null;
0204: ObjectName mbeanName = this
0205: .getAdministrationServiceMBeanObjectName();
0206:
0207: Object[] params = new Object[1];
0208: params[0] = serviceAssemblyName;
0209:
0210: String[] signature = new String[1];
0211: signature[0] = "java.lang.String";
0212:
0213: resultObject = this .invokeMBeanOperation(mbeanName,
0214: "getServiceAssemblyDeploymentDescriptor", params,
0215: signature);
0216:
0217: return resultObject.toString();
0218: }
0219:
0220: /**
0221: * Returns the jbi.xml Deployment Descriptor for a Service Unit.
0222: *
0223: * @param the
0224: * name of the Service Assembly
0225: * @param the
0226: * name of the Service Unit
0227: * @return the jbi.xml deployment descriptor of the archive
0228: * @throws ManagementRemoteException
0229: * if error or exception occurs.
0230: *
0231: * @see com.sun.esb.management.api.administration.AdministrationService#getServiceUnitDeploymentDescriptor(java.lang.String,
0232: * java.lang.String)
0233: */
0234: public String getServiceUnitDeploymentDescriptor(
0235: String serviceAssemblyName, String serviceUnitName)
0236: throws ManagementRemoteException {
0237: Object resultObject = null;
0238: ObjectName mbeanName = this
0239: .getAdministrationServiceMBeanObjectName();
0240:
0241: Object[] params = new Object[2];
0242: params[0] = serviceAssemblyName;
0243: params[1] = serviceUnitName;
0244:
0245: String[] signature = new String[2];
0246: signature[0] = "java.lang.String";
0247: signature[1] = "java.lang.String";
0248:
0249: resultObject = this
0250: .invokeMBeanOperation(mbeanName,
0251: "getServiceUnitDeploymentDescriptor", params,
0252: signature);
0253:
0254: return resultObject.toString();
0255: }
0256:
0257: /**
0258: * Returns the jbi.xml Installation Descriptor for a Shared Library.
0259: *
0260: * @param the
0261: * name of the Shared Library
0262: * @return the jbi.xml deployment descriptor of the archive
0263: * @throws ManagementRemoteException
0264: * if error or exception occurs.
0265: *
0266: * @see com.sun.esb.management.api.administration.AdministrationService#getSharedLibraryInstallationDescriptor(java.lang.String)
0267: */
0268: public String getSharedLibraryInstallationDescriptor(
0269: String sharedLibraryName) throws ManagementRemoteException {
0270: String result = null;
0271: ObjectName mbeanName = this
0272: .getAdministrationServiceMBeanObjectName();
0273:
0274: Object[] params = new Object[1];
0275: params[0] = sharedLibraryName;
0276:
0277: String[] signature = new String[1];
0278: signature[0] = "java.lang.String";
0279:
0280: result = (String) this .invokeMBeanOperation(mbeanName,
0281: "getSharedLibraryInstallationDescriptor", params,
0282: signature);
0283:
0284: return result;
0285: }
0286:
0287: /**
0288: * Checks to see if the JBI Runtime is enabled.
0289: *
0290: * @return true if JBI Runtime Framework is available, false if not
0291: * @throws ManagementRemoteException
0292: * if error or exception occurs.
0293: *
0294: * @see com.sun.esb.management.api.administration.AdministrationService#isJBIRuntimeEnabled()
0295: */
0296: public boolean isJBIRuntimeEnabled()
0297: throws ManagementRemoteException {
0298: boolean result = false;
0299: ObjectName mbeanName = this
0300: .getAdministrationServiceMBeanObjectName();
0301: result = this .isRegistered(mbeanName);
0302: return result;
0303: }
0304:
0305: /**
0306: * check for ServiceEngine
0307: *
0308: * @param the
0309: * name of the ServiceEngine or Binding Component
0310: * @return true if it is a Service Engine else false.
0311: * @throws ManagementRemoteException
0312: * if error or exception occurs.
0313: *
0314: * @see com.sun.esb.management.api.administration.AdministrationService#isServiceEngine(java.lang.String)
0315: */
0316: public boolean isServiceEngine(String componentName)
0317: throws ManagementRemoteException {
0318: boolean result = false;
0319: ObjectName mbeanName = this
0320: .getAdministrationServiceMBeanObjectName();
0321: Boolean resultObject = null;
0322:
0323: Object[] params = new Object[1];
0324: params[0] = componentName;
0325:
0326: String[] signature = new String[1];
0327: signature[0] = "java.lang.String";
0328:
0329: resultObject = (Boolean) this .invokeMBeanOperation(mbeanName,
0330: "isServiceEngine", params, signature);
0331:
0332: if (resultObject != null) {
0333: result = resultObject.booleanValue();
0334: }
0335:
0336: return result;
0337: }
0338:
0339: /**
0340: * check for BindingComponent
0341: *
0342: * @param the
0343: * name of the ServiceEngine or Binding Component
0344: * @return true if it is a Binding Component else false.
0345: * @throws ManagementRemoteException
0346: * if error or exception occurs.
0347: *
0348: * @see com.sun.esb.management.api.administration.AdministrationService#isBindingComponent(java.lang.String)
0349: */
0350: public boolean isBindingComponent(String componentName)
0351: throws ManagementRemoteException {
0352: boolean result = false;
0353: ObjectName mbeanName = this
0354: .getAdministrationServiceMBeanObjectName();
0355: Boolean resultObject = null;
0356:
0357: Object[] params = new Object[1];
0358: params[0] = componentName;
0359:
0360: String[] signature = new String[1];
0361: signature[0] = "java.lang.String";
0362:
0363: resultObject = (Boolean) this .invokeMBeanOperation(mbeanName,
0364: "isBindingComponent", params, signature);
0365:
0366: if (resultObject != null) {
0367: result = resultObject.booleanValue();
0368: }
0369:
0370: return result;
0371: }
0372:
0373: /**
0374: * Get the list of consuming endpoints
0375: *
0376: * @param componentName
0377: * @param targetName
0378: * @return Returns the consumingEndpoints.
0379: * @throws ManagementRemoteException
0380: *
0381: * @see com.sun.esb.management.api.administration.AdministrationService#getConsumingEndpoints(java.lang.String,
0382: * String)
0383: */
0384: public String[] getConsumingEndpoints(String componentName,
0385: String targetName) throws ManagementRemoteException {
0386: String[] result = null;
0387: ObjectName mbeanName = this
0388: .getAdministrationServiceMBeanObjectName();
0389:
0390: Object[] params = new Object[2];
0391: params[0] = componentName;
0392: params[1] = targetName;
0393:
0394: String[] signature = new String[2];
0395: signature[0] = "java.lang.String";
0396: signature[1] = "java.lang.String";
0397:
0398: result = (String[]) this .invokeMBeanOperation(mbeanName,
0399: "getConsumingEndpoints", params, signature);
0400:
0401: return result;
0402: }
0403:
0404: /**
0405: * Get the list of provisioning endpoints
0406: *
0407: * @param componentName
0408: * @param targetName
0409: * @return Returns the provisioningEndpoints.
0410: * @throws ManagementRemoteException
0411: *
0412: * @see com.sun.esb.management.api.administration.AdministrationService#getProvisioningEndpoints(java.lang.String,
0413: * String)
0414: */
0415: public String[] getProvisioningEndpoints(String componentName,
0416: String targetName) throws ManagementRemoteException {
0417: String[] result = null;
0418: ObjectName mbeanName = this
0419: .getAdministrationServiceMBeanObjectName();
0420:
0421: Object[] params = new Object[2];
0422: params[0] = componentName;
0423: params[1] = targetName;
0424:
0425: String[] signature = new String[2];
0426: signature[0] = "java.lang.String";
0427: signature[1] = "java.lang.String";
0428:
0429: result = (String[]) this .invokeMBeanOperation(mbeanName,
0430: "getProvisioningEndpoints", params, signature);
0431:
0432: return result;
0433: }
0434:
0435: /**
0436: * Retrieves the primary WSDL associated with the specified endpoint.
0437: *
0438: * @param componentName
0439: * @param endpoint
0440: * @param targetName
0441: * @return primary WSDL associated with the endpoint
0442: * @throws ManagementRemoteException
0443: *
0444: * @see com.sun.esb.management.api.administration.AdministrationService#getWSDLDefinition(String,String,String)
0445: */
0446: public String getWSDLDefinition(String componentName,
0447: String endpoint, String targetName)
0448: throws ManagementRemoteException {
0449: String result = null;
0450: ObjectName mbeanName = this
0451: .getAdministrationServiceMBeanObjectName();
0452:
0453: Object[] params = new Object[3];
0454: params[0] = componentName;
0455: params[1] = endpoint;
0456: params[2] = targetName;
0457:
0458: String[] signature = new String[3];
0459: signature[0] = "java.lang.String";
0460: signature[1] = "java.lang.String";
0461: signature[2] = "java.lang.String";
0462:
0463: result = (String) this .invokeMBeanOperation(mbeanName,
0464: "getWSDLDefinition", params, signature);
0465:
0466: return result;
0467: }
0468:
0469: /**
0470: * Retrieves the WSDL or XSD associated with the specified endpoint and
0471: * targetNamespace
0472: *
0473: * @param componentName
0474: * @param endpoint
0475: * @param targetNamespace
0476: * @param targetName
0477: * @return wsdl or xsd
0478: * @throws ManagementRemoteException
0479: *
0480: * @see com.sun.esb.management.api.administration.AdministrationService#getWSDLImportedResource(String,
0481: * String, String, String)
0482: */
0483: public String getWSDLImportedResource(String componentName,
0484: String endpoint, String targetNamespace, String targetName)
0485: throws ManagementRemoteException {
0486: String result = null;
0487: ObjectName mbeanName = this
0488: .getAdministrationServiceMBeanObjectName();
0489:
0490: Object[] params = new Object[4];
0491: params[0] = componentName;
0492: params[1] = endpoint;
0493: params[2] = targetNamespace;
0494: params[3] = targetName;
0495:
0496: String[] signature = new String[4];
0497: signature[0] = "java.lang.String";
0498: signature[1] = "java.lang.String";
0499: signature[2] = "java.lang.String";
0500: signature[3] = "java.lang.String";
0501:
0502: result = (String) this .invokeMBeanOperation(mbeanName,
0503: "getWSDLImportedResource", params, signature);
0504:
0505: return result;
0506: }
0507:
0508: /**
0509: * Gets the component state
0510: *
0511: * @param componentName
0512: * @param targetName
0513: * @return the state of the component
0514: * @throws ManagementRemoteException
0515: *
0516: * @see com.sun.esb.management.api.administration.AdministrationService#getComponentState(java.lang.String,
0517: * java.lang.String)
0518: */
0519: public String getComponentState(String componentName,
0520: String targetName) throws ManagementRemoteException {
0521: String result = null;
0522: ObjectName mbeanName = this
0523: .getAdministrationServiceMBeanObjectName();
0524:
0525: Object[] params = new Object[2];
0526: params[0] = componentName;
0527: params[1] = targetName;
0528:
0529: String[] signature = new String[2];
0530: signature[0] = "java.lang.String";
0531: signature[1] = "java.lang.String";
0532:
0533: result = (String) this .invokeMBeanOperation(mbeanName,
0534: "getComponentState", params, signature);
0535:
0536: return result;
0537: }
0538:
0539: /**
0540: * Gets the component type
0541: *
0542: * @param componentName
0543: * @param targetName
0544: * @return the type of the component (binding-component, service-engine, or
0545: * shared-library)
0546: * @throws ManagementRemoteException
0547: *
0548: * @see com.sun.esb.management.api.administration.AdministrationService#getComponentType(java.lang.String,
0549: * java.lang.String)
0550: */
0551: public String getComponentType(String componentName,
0552: String targetName) throws ManagementRemoteException {
0553: String result = null;
0554: ObjectName mbeanName = this
0555: .getAdministrationServiceMBeanObjectName();
0556:
0557: Object[] params = new Object[2];
0558: params[0] = componentName;
0559: params[1] = targetName;
0560:
0561: String[] signature = new String[2];
0562: signature[0] = "java.lang.String";
0563: signature[1] = "java.lang.String";
0564:
0565: result = (String) this .invokeMBeanOperation(mbeanName,
0566: "getComponentType", params, signature);
0567:
0568: return result;
0569: }
0570:
0571: /**
0572: * Gets the Service Assembly state
0573: *
0574: * @param serviceAssemblyName
0575: * @param targetName
0576: * @return the state of the Service Assembly
0577: * @throws ManagementRemoteException
0578: *
0579: * @see com.sun.esb.management.api.administration.AdministrationService#getServiceAssemblyState(java.lang.String,
0580: * java.lang.String)
0581: */
0582: public String getServiceAssemblyState(String serviceAssemblyName,
0583: String targetName) throws ManagementRemoteException {
0584: String result = null;
0585: ObjectName mbeanName = this
0586: .getAdministrationServiceMBeanObjectName();
0587:
0588: Object[] params = new Object[2];
0589: params[0] = serviceAssemblyName;
0590: params[1] = targetName;
0591:
0592: String[] signature = new String[2];
0593: signature[0] = "java.lang.String";
0594: signature[1] = "java.lang.String";
0595:
0596: result = (String) this .invokeMBeanOperation(mbeanName,
0597: "getServiceAssemblyState", params, signature);
0598:
0599: return result;
0600: }
0601:
0602: /**
0603: * Checks to see if a component/library is installed on a target
0604: *
0605: * @param componentName
0606: * @param targetName
0607: * @return true if installed, false if not
0608: * @throws ManagementRemoteException
0609: *
0610: * @see com.sun.esb.management.api.administration.AdministrationService#isJBIComponentInstalled(java.lang.String,
0611: * java.lang.String)
0612: */
0613: public boolean isJBIComponentInstalled(String componentName,
0614: String targetName) throws ManagementRemoteException {
0615: boolean result = false;
0616: ObjectName mbeanName = this
0617: .getAdministrationServiceMBeanObjectName();
0618: Boolean resultObject = null;
0619:
0620: Object[] params = new Object[2];
0621: params[0] = componentName;
0622: params[1] = targetName;
0623:
0624: String[] signature = new String[2];
0625: signature[0] = "java.lang.String";
0626: signature[1] = "java.lang.String";
0627:
0628: resultObject = (Boolean) this .invokeMBeanOperation(mbeanName,
0629: "isJBIComponentInstalled", params, signature);
0630:
0631: if (resultObject != null) {
0632: result = resultObject.booleanValue();
0633: }
0634:
0635: return result;
0636: }
0637:
0638: /**
0639: * Checks to see if a Service Assembly is deployed on a target
0640: *
0641: * @param serviceAssemblyName
0642: * @param targetName
0643: * @return true if deployed, false if not
0644: * @throws ManagementRemoteException
0645: *
0646: * @see com.sun.esb.management.api.administration.AdministrationService#isServiceAssemblyDeployed(java.lang.String,
0647: * java.lang.String)
0648: */
0649: public boolean isServiceAssemblyDeployed(
0650: String serviceAssemblyName, String targetName)
0651: throws ManagementRemoteException {
0652: boolean result = false;
0653: ObjectName mbeanName = this
0654: .getAdministrationServiceMBeanObjectName();
0655: Boolean resultObject = null;
0656:
0657: Object[] params = new Object[2];
0658: params[0] = serviceAssemblyName;
0659: params[1] = targetName;
0660:
0661: String[] signature = new String[2];
0662: signature[0] = "java.lang.String";
0663: signature[1] = "java.lang.String";
0664:
0665: resultObject = (Boolean) this .invokeMBeanOperation(mbeanName,
0666: "isServiceAssemblyDeployed", params, signature);
0667:
0668: if (resultObject != null) {
0669: result = resultObject.booleanValue();
0670: }
0671:
0672: return result;
0673: }
0674:
0675: /**
0676: * Get the instance name of the platform's administration server. If the
0677: * platform does not provide a separate administration server, then this
0678: * method returns the name of the local instance.
0679: * @return instance name of the administration server
0680: * @throws ManagementRemoteException
0681: */
0682: public String getAdminServerName() throws ManagementRemoteException {
0683: ObjectName mbeanName = this
0684: .getAdministrationServiceMBeanObjectName();
0685: String result = null;
0686: Object[] params = null;
0687: String[] signature = null;
0688: result = (String) this .invokeMBeanOperation(mbeanName,
0689: "getAdminServerName", params, signature);
0690: return result;
0691: }
0692:
0693: /**
0694: * Determine whether this instance is the administration server instance.
0695: * @return <CODE>true</CODE> if this instance is the administration server,
0696: * <CODE>false</CODE> if not.
0697: * @throws ManagementRemoteException
0698: */
0699: public boolean isAdminServer() throws ManagementRemoteException {
0700: ObjectName mbeanName = this
0701: .getAdministrationServiceMBeanObjectName();
0702: Boolean result = Boolean.FALSE;
0703: Object[] params = null;
0704: String[] signature = null;
0705: result = (Boolean) this .invokeMBeanOperation(mbeanName,
0706: "isAdminServer", params, signature);
0707: return result.booleanValue();
0708: }
0709:
0710: /**
0711: * Get the name of this instance.
0712: * @return the name of this server instance.
0713: * @throws ManagementRemoteException
0714: */
0715: public String getInstanceName() throws ManagementRemoteException {
0716: ObjectName mbeanName = this
0717: .getAdministrationServiceMBeanObjectName();
0718: String result = null;
0719: Object[] params = null;
0720: String[] signature = null;
0721: result = (String) this .invokeMBeanOperation(mbeanName,
0722: "getInstanceName", params, signature);
0723: return result;
0724: }
0725:
0726: /**
0727: * Determine if the specified instance is up.
0728: * @return true if the instance is up and running, false otherwise
0729: * @throws ManagementRemoteException
0730: */
0731: public boolean isInstanceUp(String instanceName)
0732: throws ManagementRemoteException {
0733: ObjectName mbeanName = this
0734: .getAdministrationServiceMBeanObjectName();
0735: Boolean result = Boolean.FALSE;
0736: Object[] params = new Object[1];
0737: params[0] = instanceName;
0738: String[] signature = new String[1];
0739: signature[0] = "java.lang.String";
0740: result = (Boolean) this .invokeMBeanOperation(mbeanName,
0741: "isInstanceUp", params, signature);
0742: return result.booleanValue();
0743: }
0744:
0745: /**
0746: * Determine whether multiple servers are permitted within this AS
0747: * installation.
0748: * @return true if multiple servers are permitted.
0749: * @throws ManagementRemoteException
0750: */
0751: public boolean supportsMultipleServers()
0752: throws ManagementRemoteException {
0753: ObjectName mbeanName = this
0754: .getAdministrationServiceMBeanObjectName();
0755: Boolean result = Boolean.FALSE;
0756: Object[] params = null;
0757: String[] signature = null;
0758: result = (Boolean) this .invokeMBeanOperation(mbeanName,
0759: "supportsMultipleServers", params, signature);
0760: return result.booleanValue();
0761: }
0762:
0763: /**
0764: * Get the Target Name. If the instance is not a clustered instance then
0765: * the target name is the instance name. If the instance is part of a
0766: * cluster then the target name is the cluster name.
0767: *
0768: * @return the target name.
0769: * @throws ManagementRemoteException
0770: */
0771: public String getTargetName() throws ManagementRemoteException {
0772: ObjectName mbeanName = this
0773: .getAdministrationServiceMBeanObjectName();
0774: String result = null;
0775: Object[] params = null;
0776: String[] signature = null;
0777: result = (String) this .invokeMBeanOperation(mbeanName,
0778: "getTargetName", params, signature);
0779: return result;
0780:
0781: }
0782:
0783: /**
0784: * Get the Target Name for a specified instance. If the instance is not
0785: * clustered the instance name is returned. This operation is invoked by
0786: * the JBI instance MBeans only.
0787: *
0788: * @return the target name.
0789: * @throws ManagementRemoteException
0790: */
0791: public String getTargetName(String instanceName)
0792: throws ManagementRemoteException {
0793: ObjectName mbeanName = this
0794: .getAdministrationServiceMBeanObjectName();
0795: String result = null;
0796: Object[] params = new Object[1];
0797: params[0] = instanceName;
0798: String[] signature = new String[1];
0799: signature[0] = "java.lang.String";
0800: result = (String) this .invokeMBeanOperation(mbeanName,
0801: "getTargetName", params, signature);
0802: return result;
0803: }
0804:
0805: /**
0806: * Get a set of the names of all the standalone servers in the domain.
0807: * @return a set of names of standalone servers in the domain.
0808: * @throws ManagementRemoteException
0809: */
0810: @SuppressWarnings("unchecked")
0811: public Set<String> getStandaloneServerNames()
0812: throws ManagementRemoteException {
0813: ObjectName mbeanName = this
0814: .getAdministrationServiceMBeanObjectName();
0815: Set<String> result = null;
0816: Object[] params = null;
0817: String[] signature = null;
0818: result = (Set<String>) this .invokeMBeanOperation(mbeanName,
0819: "getStandaloneServerNames", params, signature);
0820: return result;
0821: }
0822:
0823: /**
0824: * Get a set of the names of all the clustered servers in the domain.
0825: * @return a set of names of clustered servers in the domain.
0826: * @throws ManagementRemoteException
0827: */
0828: @SuppressWarnings("unchecked")
0829: public Set<String> getClusteredServerNames()
0830: throws ManagementRemoteException {
0831: ObjectName mbeanName = this
0832: .getAdministrationServiceMBeanObjectName();
0833: Set<String> result = null;
0834: Object[] params = null;
0835: String[] signature = null;
0836: result = (Set<String>) this .invokeMBeanOperation(mbeanName,
0837: "getClusteredServerNames", params, signature);
0838: return result;
0839: }
0840:
0841: /**
0842: * Get a set of the names of all the clusters in the domain.
0843: * @return a set of names of clusters in the domain.
0844: * @throws ManagementRemoteException
0845: */
0846: @SuppressWarnings("unchecked")
0847: public Set<String> getClusterNames()
0848: throws ManagementRemoteException {
0849: ObjectName mbeanName = this
0850: .getAdministrationServiceMBeanObjectName();
0851: Set<String> result = null;
0852: Object[] params = null;
0853: String[] signature = null;
0854: result = (Set<String>) this .invokeMBeanOperation(mbeanName,
0855: "getClusterNames", params, signature);
0856: return result;
0857: }
0858:
0859: /**
0860: * Get a set of the names of all the servers in the specified cluster.
0861: * @return a set of names of servers in the cluster.
0862: * @throws ManagementRemoteException
0863: */
0864: @SuppressWarnings("unchecked")
0865: public Set<String> getServersInCluster(String clusterName)
0866: throws ManagementRemoteException {
0867: ObjectName mbeanName = this
0868: .getAdministrationServiceMBeanObjectName();
0869: Set<String> result = null;
0870: Object[] params = new Object[1];
0871: params[0] = clusterName;
0872: String[] signature = new String[1];
0873: signature[0] = "java.lang.String";
0874: result = (Set<String>) this .invokeMBeanOperation(mbeanName,
0875: "getTargetName", params, signature);
0876: return result;
0877: }
0878:
0879: /**
0880: * Determine whether a target is a valid server or cluster name.
0881: * @return <CODE>true</CODE> if <CODE>targetName</CODE> is a valid
0882: * standalone server name or cluster name, <CODE>false</CODE> if not.
0883: * @throws ManagementRemoteException
0884: */
0885: public boolean isValidTarget(String targetName)
0886: throws ManagementRemoteException {
0887: ObjectName mbeanName = this
0888: .getAdministrationServiceMBeanObjectName();
0889: Boolean result = Boolean.FALSE;
0890: Object[] params = new Object[1];
0891: params[0] = targetName;
0892: String[] signature = new String[1];
0893: signature[0] = "java.lang.String";
0894: result = (Boolean) this .invokeMBeanOperation(mbeanName,
0895: "isValidTarget", params, signature);
0896: return result.booleanValue();
0897: }
0898:
0899: /**
0900: * Determine whether a target is a cluster.
0901: * @return <CODE>true</CODE> if <CODE>targetName</CODE> is a cluster,
0902: * <CODE>false</CODE> if not.
0903: * @throws ManagementRemoteException
0904: */
0905: public boolean isCluster(String targetName)
0906: throws ManagementRemoteException {
0907: ObjectName mbeanName = this
0908: .getAdministrationServiceMBeanObjectName();
0909: Boolean result = Boolean.FALSE;
0910: Object[] params = new Object[1];
0911: params[0] = targetName;
0912: String[] signature = new String[1];
0913: signature[0] = "java.lang.String";
0914: result = (Boolean) this .invokeMBeanOperation(mbeanName,
0915: "isCluster", params, signature);
0916: return result.booleanValue();
0917: }
0918:
0919: /**
0920: * Determine whether a target is a standalone server.
0921: * @return <CODE>true</CODE> if <CODE>targetName</CODE> is a standalone
0922: * server, <CODE>false</CODE> if not.
0923: * @throws ManagementRemoteException
0924: */
0925: public boolean isStandaloneServer(String targetName)
0926: throws ManagementRemoteException {
0927: ObjectName mbeanName = this
0928: .getAdministrationServiceMBeanObjectName();
0929: Boolean result = Boolean.FALSE;
0930: Object[] params = new Object[1];
0931: params[0] = targetName;
0932: String[] signature = new String[1];
0933: signature[0] = "java.lang.String";
0934: result = (Boolean) this .invokeMBeanOperation(mbeanName,
0935: "isStandaloneServer", params, signature);
0936: return result.booleanValue();
0937: }
0938:
0939: /**
0940: * Determine whether the target is a clustered server.
0941: * @return <CODE>true</CODE> if <CODE>targetName</CODE> is a clustered
0942: * server, <CODE>false</CODE> if not.
0943: * @throws ManagementRemoteException
0944: */
0945: public boolean isClusteredServer(String targetName)
0946: throws ManagementRemoteException {
0947: ObjectName mbeanName = this
0948: .getAdministrationServiceMBeanObjectName();
0949: Boolean result = Boolean.FALSE;
0950: Object[] params = new Object[1];
0951: params[0] = targetName;
0952: String[] signature = new String[1];
0953: signature[0] = "java.lang.String";
0954: result = (Boolean) this .invokeMBeanOperation(mbeanName,
0955: "isClusteredServer", params, signature);
0956: return result.booleanValue();
0957: }
0958:
0959: /**
0960: * Determine whether or not an instance is clustered.
0961: * @return <CODE>true</CODE> if the instance is clustered,
0962: * <CODE>false</CODE> if not.
0963: * @throws ManagementRemoteException
0964: */
0965: public boolean isInstanceClustered(String instanceName)
0966: throws ManagementRemoteException {
0967: ObjectName mbeanName = this
0968: .getAdministrationServiceMBeanObjectName();
0969: Boolean result = Boolean.FALSE;
0970: Object[] params = new Object[1];
0971: params[0] = instanceName;
0972: String[] signature = new String[1];
0973: signature[0] = "java.lang.String";
0974: result = (Boolean) this .invokeMBeanOperation(mbeanName,
0975: "isInstanceClustered", params, signature);
0976: return result.booleanValue();
0977: }
0978:
0979: /**
0980: * Get a string representation of the DAS JMX RMI connector port.
0981: * @return the JMX RMI connector port as a (CODE>String</CODE>.
0982: * @throws ManagementRemoteException
0983: */
0984: public String getJmxRmiPort() throws ManagementRemoteException {
0985: ObjectName mbeanName = this
0986: .getAdministrationServiceMBeanObjectName();
0987: String result = null;
0988: Object[] params = null;
0989: String[] signature = null;
0990: result = (String) this .invokeMBeanOperation(mbeanName,
0991: "getJmxRmiPort", params, signature);
0992: return result;
0993: }
0994:
0995: /**
0996: * Get the full path to the platform's instance root directory.
0997: * @return platform instance root
0998: * @throws ManagementRemoteException
0999: */
1000: public String getInstanceRoot() throws ManagementRemoteException {
1001: ObjectName mbeanName = this
1002: .getAdministrationServiceMBeanObjectName();
1003: String result = null;
1004: Object[] params = null;
1005: String[] signature = null;
1006: result = (String) this .invokeMBeanOperation(mbeanName,
1007: "getInstanceRoot", params, signature);
1008: return result;
1009: }
1010:
1011: /**
1012: * Get the full path to the platform's instaall root directory.
1013: * @return platform install root
1014: * @throws ManagementRemoteException
1015: */
1016: public String getInstallRoot() throws ManagementRemoteException {
1017: ObjectName mbeanName = this
1018: .getAdministrationServiceMBeanObjectName();
1019: String result = null;
1020: Object[] params = null;
1021: String[] signature = null;
1022: result = (String) this .invokeMBeanOperation(mbeanName,
1023: "getInstallRoot", params, signature);
1024: return result;
1025: }
1026:
1027: /**
1028: * Get the MBean server connection for a particular instance.
1029: * @return the <CODE>MBeanServerConnection</CODE> for the specified instance.
1030: * @throws ManagementRemoteException
1031: */
1032: public MBeanServerConnection getConnectionForInstance(
1033: String instanceName) throws ManagementRemoteException {
1034: MBeanServerConnection connection = null;
1035: ObjectName mbeanName = this
1036: .getAdministrationServiceMBeanObjectName();
1037: Object[] params = new Object[1];
1038: params[0] = instanceName;
1039: String[] signature = new String[1];
1040: signature[0] = "java.lang.String";
1041: connection = (MBeanServerConnection) this .invokeMBeanOperation(
1042: mbeanName, "getConnectionForInstance", params,
1043: signature);
1044:
1045: return connection;
1046: }
1047: }
|