org.apache.oodt.profile.handlers.lightweight
Class LightweightProfileServer

java.lang.Object
  extended by org.apache.oodt.profile.handlers.lightweight.LightweightProfileServer
All Implemented Interfaces:
ProfileHandler

public final class LightweightProfileServer
extends Object
implements ProfileHandler

A lightweight profile server. A lightweight profile server is lightweight because it doesn't rely on any external database or other search/retrieval mechanism.

Author:
Kelly

Constructor Summary
LightweightProfileServer()
          Create a lightweight profile server using defaults.
LightweightProfileServer(Properties props)
          Create a lightweight profile server using the given properties.
LightweightProfileServer(URL url, String id)
          Create a lightweight profile server using the given URL.
 
Method Summary
 List findProfiles(XMLQuery query)
          Find a set of profiles that match the given query.
 Profile get(String profID)
          Get a single profile matching the given ID.
 String getID()
          Get my ID.
static void main(String[] argv)
          Application execution entry point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LightweightProfileServer

public LightweightProfileServer()
                         throws IOException,
                                SAXException,
                                MalformedURLException
Create a lightweight profile server using defaults.

Throws:
IOException - If an I/O error occurs.
SAXException - If an error occurs parsing the profile file.
MalformedURLException - If the default profile URL is malformed.

LightweightProfileServer

public LightweightProfileServer(Properties props)
                         throws IOException,
                                SAXException,
                                MalformedURLException
Create a lightweight profile server using the given properties. The property we use is profiles.url, which is the URL of the file containing profile definitions that this server will read and serve.

Parameters:
props - Properties.
Throws:
IOException - If an I/O error occurs.
SAXException - If an error occurs parsing the profile file.
MalformedURLException - If the URL to the profile file is malformed.

LightweightProfileServer

public LightweightProfileServer(URL url,
                                String id)
                         throws IOException,
                                SAXException,
                                MalformedURLException
Create a lightweight profile server using the given URL.

Parameters:
url - URL of the file containing profile definitions that this server will read and serve.
id - Identifier to report for when this handler is queried by name.
Throws:
IOException - If an I/O error occurs.
SAXException - If an error occurs parsing the profile file.
MalformedURLException - If url is malformed.
Method Detail

findProfiles

public List findProfiles(XMLQuery query)
                  throws ProfileException
Description copied from interface: ProfileHandler
Find a set of profiles that match the given query. This method searchs the profiles provided by this profile service provider based on criteria in the query. It returns an XML document describing the profiles and profile elements that match.

Specified by:
findProfiles in interface ProfileHandler
Parameters:
query - Search criteria.
Returns:
List of matching Profile objects.
Throws:
ProfileException - If any other error occurs.

get

public Profile get(String profID)
Get a single profile matching the given ID.

Specified by:
get in interface ProfileHandler
Parameters:
profID - a String value.
Returns:
a Profile value.

getID

public String getID()
Get my ID.

Specified by:
getID in interface ProfileHandler
Returns:
A string that identifies this profile handler in some way.

main

public static void main(String[] argv)
                 throws Exception
Application execution entry point. This lets you try out a query to the Lightweight Profile server.

Parameters:
argv - Command-line arguments.
Throws:
Exception - Should any error occur.


Copyright © 1999-2012 Apache OODT. All Rights Reserved.