com.arsdigita.kernel
Class GenericURLFinder

java.lang.Object
  extended bycom.arsdigita.kernel.GenericURLFinder
All Implemented Interfaces:
URLFinder

public class GenericURLFinder
extends Object
implements URLFinder

A URLFinder that can be registered for most object types. The GenericURLFinder is constructed with a specified URL pattern such as one-ticket?ticket_id=:id. For a given OID, the URL path is determined as follows:

  1. Try to find the package instance to which the specified object belongs. The current process involves examining persistence metadata to try to navigate from the given OID to its package instance. This process will eventually be replaced with a call to some other kernel service (to be developed) that deals with the scoping of objects to package instances. Until then, the process is as follows:
  2. Once the package instance is determined, get the package instance's primary mount point (see PackageInstance.getDefaultMountPoint()).
  3. Once the primary mount point is determined, get its URL path.
  4. Append the URL pattern (which was specified to the constructor of GenericURLFinder).
  5. Substitute terms like :id with values from the given OID.
For example, suppose we have the following PDL fragment:
       model examples;
       object type Forum extends ACSObject {
           PackageInstance[1..1] packageInstance;
       }
       object type Message extends ACSObject {...}
       association {
           Forum[1..1] forum;
           composite Message[0..n] messages;
           // NOTE: composite means component in PDL
       }
   
We can register GenericURLFinder with the URLService for both of these object types with the following code:
      URLService.registerFinder("examples.Forum",
                            new GenericURLFinder("index?forum_id=:id"));
      URLService.registerFinder("examples.Message",
                            new GenericURLFinder("message?message_id=:id"));
   
The GenericURLFinder registered for examples.Forum will work because examples.Forum has a packageInstance property of type PackageInstance.

The finder registered for examples.Message will work because examples.Message has a composite role (in this case it is the role called forum), and the composite object has a packageInstance property of type PackageInstance.

Author:
Oumi Mehrotra

Field Summary
static String versionId
           
 
Constructor Summary
GenericURLFinder(String urlEndingPattern)
           
 
Method Summary
 String find(OID oid)
          Returns a URL path to a page that displays the object identified by the given OID.
 String find(OID oid, String context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

GenericURLFinder

public GenericURLFinder(String urlEndingPattern)
Method Detail

find

public String find(OID oid,
                   String context)
            throws NoValidURLException
Specified by:
find in interface URLFinder
Throws:
NoValidURLException

find

public String find(OID oid)
            throws NoValidURLException
Description copied from interface: URLFinder
Returns a URL path to a page that displays the object identified by the given OID. The URL path is relative to the server root. Only called from URLService.locate(OID).

Specified by:
find in interface URLFinder
Throws:
NoValidURLException - when no valid URL could be obtained for the given OID.
See Also:
URLService.locate(OID)


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC