1 23 package com.sun.enterprise.management.config; 24 25 import java.util.Map ; 26 27 import javax.management.ObjectName ; 28 29 import com.sun.appserv.management.base.XTypes; 30 31 import com.sun.appserv.management.config.Libraries; 32 33 import com.sun.appserv.management.util.misc.StringUtil; 34 import com.sun.appserv.management.util.misc.ExceptionUtil; 35 import com.sun.appserv.management.util.stringifier.ArrayStringifier; 36 37 import com.sun.enterprise.management.support.Delegate; 38 39 42 public class DeployedItemConfigBase extends AMXConfigImplBase 43 implements Libraries, ConfigFactoryCallback 44 { 45 public 46 DeployedItemConfigBase( final Delegate delegate ) 47 { 48 super( delegate ); 49 } 50 51 52 protected static String 53 getPathSeparator() 54 { 55 return System.getProperty( "path.separator" ); 56 } 57 58 private static final String LIBRARIES_ATTR = "Libraries"; 59 60 public String [] 61 getLibraries() 62 { 63 final String s = (String )delegateGetAttributeNoThrow( LIBRARIES_ATTR ); 64 65 final String [] libraries = s == null ? 66 EMPTY_STRING_ARRAY : s.split( getPathSeparator() ); 67 68 return libraries; 69 } 70 71 75 public void 76 setLibraries( final String [] libraries ) 77 { 78 if ( libraries == null || libraries.length == 0 ) 79 { 80 final String [] current = getLibraries(); 81 if ( current.length == 0 ) 82 { 83 } 85 else 86 { 87 delegateSetAttributeNoThrow( LIBRARIES_ATTR, null ); 88 } 89 } 90 else 91 { 92 final String SEP = getPathSeparator(); 93 94 for( final String s : libraries ) 95 { 96 if ( s == null || s.length() == 0 || s.indexOf( SEP ) >= 0 ) 97 { 98 throw new IllegalArgumentException ( StringUtil.quote( "" + s ) ); 99 } 100 } 101 final String libs = StringUtil.toString( SEP, (Object [])libraries ); 102 103 delegateSetAttributeNoThrow( LIBRARIES_ATTR, libs ); 104 } 105 } 106 } 107 108 109 110 111 112 113 114 | Popular Tags |