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: * @(#)JbiNameInfo.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.management.support;
030:
031: /**
032: * Implementation of JbiNameInfo interface.
033: *
034: * @author Sun Microsystems, Inc.
035: */
036: public class JbiNameInfo implements com.sun.jbi.management.JbiNameInfo {
037: private final String mName;
038: private final String mAltName;
039: private final boolean mIsEngine;
040: private final boolean mIsBinding;
041: private final boolean mIsSystemService;
042:
043: /**
044: * Constructs a <CODE>JbiNameInfo</CODE>.
045: * This version of the constructor creates a system service name object.
046: */
047: public JbiNameInfo(String aServiceName) {
048: mName = aServiceName;
049: mAltName = null;
050: mIsBinding = false;
051: mIsEngine = false;
052: mIsSystemService = true;
053: }
054:
055: /**
056: * Constructs a <CODE>JbiNameInfo</CODE>.
057: * This version of the constructor creates an installed component name object.
058: */
059: public JbiNameInfo(String aComponentName, boolean isBinding) {
060: mName = aComponentName;
061: mAltName = aComponentName;
062: mIsBinding = isBinding;
063: mIsEngine = !isBinding;
064: mIsSystemService = false;
065: }
066:
067: /**
068: * Constructs a <CODE>JbiNameInfo</CODE>.
069: * This version of the constructor creates an installed component name object.
070: */
071: public JbiNameInfo(String aComponentName, String aComponentAlias,
072: boolean isBinding) {
073: mName = aComponentName;
074: mAltName = aComponentAlias; //this is to be deprecated when we eliminate aliases
075: mIsBinding = isBinding;
076: mIsEngine = !isBinding;
077: mIsSystemService = false;
078: }
079:
080: /**
081: * Return the name of the JBI Framework Service or Installed component.
082: * @return name of service or component
083: */
084: public String name() {
085: return mName;
086: }
087:
088: /**
089: * Return the alternative name of a JBI Framework installed component.
090: * @return alternative name of the installed component
091: */
092: public String altName() {
093: return mAltName;
094: }
095:
096: /**
097: * True iff this object identifies an SE.
098: * By definition, isEngine() => !isBinding() && !isSystemService()
099: *
100: * @return true iff object identifies an SE.
101: */
102: public boolean isEngine() {
103: return mIsEngine;
104: }
105:
106: /**
107: * True iff this object identifies an SE.
108: * By definition, isBinding() => !isEngine() && !isSystemService()
109: *
110: * @return true iff object identifies an SE.
111: */
112: public boolean isBinding() {
113: return mIsBinding;
114: }
115:
116: /**
117: * True iff this object identifies a JBI Framework System Service.
118: * By definition, isSystemService() => !isEngine() && !isBinding()
119: *
120: * @return true iff object identifies an JBI Framework System Service.
121: */
122: public boolean isSystemService() {
123: return mIsSystemService;
124: }
125:
126: }
|