1 22 package org.jboss.deployment; 23 24 import java.net.URL ; 25 import javax.management.ObjectName ; 26 import org.jboss.mx.loading.LoaderRepositoryFactory; 27 import org.jboss.mx.loading.RepositoryClassLoader; 28 import org.jboss.system.ServiceMBeanSupport; 29 30 31 41 public class ClasspathExtension 42 extends ServiceMBeanSupport 43 implements ClasspathExtensionMBean 44 { 45 private String metadataURL; 46 private ObjectName loaderRepository; 47 private RepositoryClassLoader ucl; 48 49 public ClasspathExtension() 50 { 51 52 } 53 54 61 public String getMetadataURL() 62 { 63 return metadataURL; 64 } 65 66 72 public void setMetadataURL(String metadataURL) 73 { 74 this.metadataURL = metadataURL; 75 } 76 77 84 public ObjectName getLoaderRepository() 85 { 86 return loaderRepository; 87 } 88 89 90 96 public void setLoaderRepository(ObjectName loaderRepository) 97 { 98 this.loaderRepository = loaderRepository; 99 } 100 101 protected void createService() throws Exception 102 { 103 if (metadataURL != null) 104 { 105 URL url = new URL (metadataURL); 106 if( loaderRepository == null ) 107 loaderRepository = LoaderRepositoryFactory.DEFAULT_LOADER_REPOSITORY; 108 Object [] args = {url, url, Boolean.TRUE}; 109 String [] sig = {"java.net.URL", "java.net.URL", "boolean"}; 110 ucl = (RepositoryClassLoader) server.invoke(loaderRepository, 111 "newClassLoader",args, sig); 112 } } 114 115 protected void destroyService() throws Exception 116 { 117 if (ucl != null) 118 ucl.unregister(); 119 } 120 121 } | Popular Tags |