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: * @(#)SharedLibraryDescriptor.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: /**
030: * ArchiveValidator.java
031: *
032: * SUN PROPRIETARY/CONFIDENTIAL.
033: * This software is the proprietary information of Sun Microsystems, Inc.
034: * Use is subject to license terms.
035: *
036: * Created on January 2, 2006, 4:49 PM
037: */package com.sun.jbi.management.descriptor;
038:
039: import com.sun.jbi.component.InstallationContext;
040: import com.sun.jbi.management.descriptor.Jbi;
041: import com.sun.jbi.management.descriptor.Jbi.SharedLibrary;
042: import com.sun.jbi.management.util.StringHelper;
043:
044: import java.util.List;
045:
046: /**
047: *
048: * This class encapsulates the JAXB model for the Shared Library Descriptor
049: *
050: * @author Sun Microsystems, Inc
051: */
052: public class SharedLibraryDescriptor {
053:
054: private com.sun.jbi.management.descriptor.Jbi.SharedLibrary mSlType;
055:
056: /**
057: * Constructs a SharedLibraryDescriptor.
058: *
059: * @throws an IllegalArgumentException if the JbiType passed in not that
060: * for a component
061: */
062: public SharedLibraryDescriptor(Jbi jbi)
063: throws IllegalArgumentException {
064: mSlType = jbi.getSharedLibrary();
065:
066: if (mSlType == null) {
067: throw new IllegalArgumentException();
068: }
069: }
070:
071: /**
072: * Get the name of the shared library
073: */
074: public String getName() {
075: if (mSlType.getIdentification() != null) {
076: return StringHelper.trim(mSlType.getIdentification()
077: .getName());
078: } else {
079: return "";
080: }
081: }
082:
083: /**
084: * @return the Shared Library Description
085: */
086: public String getDescription() {
087: if (mSlType.getIdentification() != null) {
088: return StringHelper.trim(mSlType.getIdentification()
089: .getDescription());
090: } else {
091: return "";
092: }
093: }
094:
095: /**
096: * @return true if the Class Loader Delegation is self first.
097: * @see com.sun.jbi.component.InstallationContext
098: */
099: public boolean isSharedLibraryClassLoaderSelfFirst() {
100: return (InstallationContext.SELF_FIRST.equals(StringHelper
101: .trim(mSlType.getClassLoaderDelegation())));
102: }
103:
104: /**
105: * @return the Shared Library Class Path elements. White spaces in individual elements
106: * are trimmed.
107: */
108: public List<String> getSharedLibraryClassPathElements() {
109: if (mSlType.getSharedLibraryClassPath() != null) {
110: return StringHelper.trim(mSlType
111: .getSharedLibraryClassPath().getPathElement());
112: }
113: return new java.util.ArrayList<String>();
114: }
115:
116: }
|