001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package javax.management.loading;
023:
024: import java.util.Set;
025: import java.util.Enumeration;
026:
027: import java.net.URL;
028:
029: import java.io.InputStream;
030: import java.io.IOException;
031:
032: import javax.management.ServiceNotFoundException;
033:
034: /**
035: * Management interface of an MLet.
036: *
037: * @see javax.management.loading.MLet
038: *
039: * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>.
040: * @version $Revision: 57200 $
041: */
042: public interface MLetMBean {
043:
044: /**
045: * Loads an MLET text file from a given url. The MLET text file is parsed
046: * and the declared MBeans will be registered to the MBean server.
047: *
048: * @param url url to load the MLET text file from
049: *
050: * @return A set of <tt>ObjectInstance</tt> instances for each registered
051: * MBean. If there was an error registering the MBean, a
052: * <tt>Throwable</tt> instance is added to the returned collection.
053: *
054: * @exception ServiceNotFoundException if the given URL is malformed, or the
055: * given MLET text file cannot be found, or the given text file
056: * does not contain an <MLET> tag or one of the specified
057: * mandatory attributes (see the JMX specification for a list of
058: * mandatory attributes in an MLET text file).
059: */
060: public Set getMBeansFromURL(String url)
061: throws ServiceNotFoundException;
062:
063: /**
064: * Loads an MLET text file from a given url. The MLET text file is parsed
065: * and the declared MBeans will be registered to the MBean server.
066: *
067: * @param url url to load the MLET text file from
068: *
069: * @return A set of <tt>ObjectInstance</tt> instances for each registered
070: * MBean. If there was an error registering the MBean, a
071: * <tt>Throwable</tt> instance is added to the returned collection.
072: *
073: * @exception ServiceNotFoundException if the
074: * given MLET text file cannot be found, or the given text file
075: * does not contain an <MLET> tag or one of the specified
076: * mandatory attributes (see the JMX specification for a list of
077: * mandatory attributes in an MLET text file).
078: */
079: public Set getMBeansFromURL(URL url)
080: throws ServiceNotFoundException;
081:
082: /**
083: * Adds the given URL to the MLet's classpath.
084: *
085: * @param url url
086: */
087: public void addURL(URL url);
088:
089: /**
090: * Adds the given URL to the MLet's classpath.
091: *
092: * @param url url
093: *
094: * @throws ServiceNotFoundException if the given URL is malformed
095: */
096: public void addURL(String url) throws ServiceNotFoundException;
097:
098: /**
099: * Returns the list of URLs associated with this MLet.
100: *
101: * @return array of URLs
102: */
103: public URL[] getURLs();
104:
105: /**
106: * Returns a resource with a given name from this MLet's classpath.
107: *
108: * @param name the resource name with a '/' separated path
109: *
110: * @return URL to the requested resource, or a <tt>null</tt> if it could
111: * not be found
112: */
113: public URL getResource(String name);
114:
115: /**
116: * Returns a resource with a given name from this MLet's classpath.
117: *
118: * @param name the resource name with a '/' separated path
119: *
120: * @return An InputStream to the requested resource, or a <tt>null</tt> if
121: * it could not be found
122: */
123: public InputStream getResourceAsStream(String name);
124:
125: /**
126: * Returns all resources with a given name.
127: *
128: * @param name the resource name with a '/' separated path
129: *
130: * @return an enumeration of URLs to the resource, or an empty
131: * <tt>Enumeration</tt> instance if no resources were found
132: *
133: * @throws IOException
134: */
135: public Enumeration getResources(String name) throws IOException;
136:
137: public String getLibraryDirectory();
138:
139: public void setLibraryDirectory(String libdir);
140:
141: }
|