ilog.cpl.service
Class IlpClassLoaderURLAccessService

java.lang.Object
  extended by ilog.cpl.service.IlpClassLoaderURLAccessService
All Implemented Interfaces:
IlpService, IlpURLAccessService

public class IlpClassLoaderURLAccessService
extends Object
implements IlpURLAccessService

This service is used for deploying applications and applets without hardcoding pathnames or URLs. It allows you to provide an java.net.URLClassLoader to turn relative URLs into absolute URLs or pathnames.

A possible use of this service is for accessing icons and configuration files.

Since:
JViews 7.5

Constructor Summary
IlpClassLoaderURLAccessService(URLClassLoader classLoader)
          Creates the service.
 
Method Summary
 URL getFileLocation(String filename)
          Returns the URL of a file in the path, or null if it is not found.
 URL getFileLocation(String filename, boolean searchClassPathFirst, boolean searchClassPathLast)
          Returns the URL of a file in the path, or null if it is not found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlpClassLoaderURLAccessService

public IlpClassLoaderURLAccessService(URLClassLoader classLoader)
Creates the service.

Parameters:
classLoader - the classLoader whose findResource method will be used to resolve URLs
Method Detail

getFileLocation

public URL getFileLocation(String filename)
Returns the URL of a file in the path, or null if it is not found.

In this implementation, it simply calls the classloader's findResource method.

Specified by:
getFileLocation in interface IlpURLAccessService
Parameters:
filename - A relative URL or pathname.

getFileLocation

public URL getFileLocation(String filename,
                           boolean searchClassPathFirst,
                           boolean searchClassPathLast)
Returns the URL of a file in the path, or null if it is not found. This variant has explicit control whether the file shall be searched in the CLASSPATH or not.

Specified by:
getFileLocation in interface IlpURLAccessService
Parameters:
filename - A relative URL or pathname.
searchClassPathFirst - ignored in this implementation
searchClassPathLast - ignored in this implementation


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.