Home | pfodApps/pfodDevices | WebStringTemplates | Java/J2EE | Unix | Torches | Superannuation | | About Us
 

Forward Logo (image)      

InterfaceClassFinder V1.0.0

InterfaceClassFinder

This package allows you find all the classes in your class path that implement a given interface. The standard Java library classes are not searched (unless you explicitly add one to your classpath) and only classes that have a no-arg public constructor and that implement the interface are returned.

The interface you specify can be any one that exists in the classpath. The classes found do not have to implement the interface directly but can do so via a superclass or via an interface the extends the the one you specifed.

The source and jar files (including the required asm jar file) are in InterfaceClassFinderV1.0.0.zip or InterfaceClassFinderV1.0.0.tar.gz

Uses

Scanning your classpath

This package provides a simple way to scan you class path. The ClasspathScanner will pass every class on the classpath to each consumer registered with it. See the ClasspathScanner.main() method for an example that just list the classes found and looks for duplicates.

Sample usage (when the current directory is the jar directory):
java -cp InterfaceClassFinder.jar;lib/asm-3.1.jar au.com.forward.interfaceClassFinder.ClasspathScanner

Loading Functionallity from your classpath

FindInterfaceClasses returns a list of fully qualified class names that implements a given interface. You can use this to dynamically configure your application by adding the classes to your classpath. A suggested process is:-
Define your interface. Include methods to initialize the class, start, stop and cleanup.
Write your processes implementing this interface.
On startup use FindInterfaceClasses.findClassNames(..) to find all the available processes.
Call Class.forName( ) to instanciate each process and then call your interface methods to install and start the process.

Sample usage (when the current directory is the jar directory):
java -jar InterfaceClassFinder.jar org.objectweb.asm.ClassVisitor

Licence Agreement

InterfaceClassFinder package
Copyright (c) 2009 Forward Computing and Control Pty. Ltd.
NSW. Australia,  www.forward.com.au
All rights reserved.

Redistribution of the source of this package, with or without
modification, is NOT permitted.

Redistribution of the compiled java .class files of this package, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions in compiled java .class form must reproduce the above
   copyright notice, this list of conditions and the following disclaimer
   in the documentation and/or other materials provided with the distribution.

2. If the software is modified, the compiled java .class distribution must
   include, in the documentation and/or other materials provided with the 
   distribution, a statement that the software has been modified and
   identify the person who was responsable for the modifications.  

3. Neither the name of the author nor Forward Computing and Control may be 
   used to endorse or promote products derived from this software
   without specific prior written permission.

4.  All advertising materials mentioning features or use of this
    software must display the following acknowledgment: 
    "This product includes software developed by Matthew Ford
     and Forward Computing and Control Pty. Ltd. 
    (http://www.forward.com.au)."


THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 


Forward home page link (image)

Contact Forward Computing and Control by
©Copyright 1996-2020 Forward Computing and Control Pty. Ltd. ACN 003 669 994