Protege 3.3.1

edu.stanford.smi.protege.util
Class ProtegeJob

java.lang.Object
  extended by edu.stanford.smi.protege.util.ProtegeJob
All Implemented Interfaces:
Localizable, Serializable

public abstract class ProtegeJob
extends Object
implements Localizable, Serializable

This class defines a unit of work to be executed in the context of a knowledge base. The purpose of this class is to allow a caller to define a unit of work that will be performed on the server if the jvm defining the job is a client accessing a Protege server. If the jvm is executing the knowledge base locally, this unit of work is executed directly on the local knowledge base. Most developers will need to override both the run() and localize() methods.

Author:
tredmond
See Also:
Serialized Form

Constructor Summary
ProtegeJob(KnowledgeBase kb)
          The main constructor for ProtegeJob's.
 
Method Summary
 Object execute()
          This method will either execute the job.run() method or - in the case that the caller is a client to a Protege server - it will copy this job to the server so that it can execute there.
 void fixLoader()
           
 KnowledgeBase getKnowledgeBase()
          Returns the knowledge base associated with this job.
 MetaProjectInstance getMetaProjectInstance()
          This is a utility for dealing with the metaproject instance when it is known that we are executing on the server side.
 void localize(KnowledgeBase kb)
          This call is used to make needed adjustments to objects after they have been serialized and then deserialized.
abstract  Object run()
          This class is overridden by the sub class and defines the fuunctionality of this job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtegeJob

public ProtegeJob(KnowledgeBase kb)
The main constructor for ProtegeJob's.

Parameters:
kb - - the knowledge base to be used when executing this job.
Method Detail

fixLoader

public void fixLoader()

execute

public Object execute()
               throws ProtegeException
This method will either execute the job.run() method or - in the case that the caller is a client to a Protege server - it will copy this job to the server so that it can execute there.

Returns:
the object returned by the execution of this job.
Throws:
ProtegeException - the exception thrown by this job during its execution.

run

public abstract Object run()
                    throws ProtegeException
This class is overridden by the sub class and defines the fuunctionality of this job. The intention is that the sub-class will define this method and callers will use the execute() method.

Returns:
Throws:
ProtegeException

getKnowledgeBase

public KnowledgeBase getKnowledgeBase()
Returns the knowledge base associated with this job.

Returns:
the knowledge base associated with this job.

getMetaProjectInstance

public MetaProjectInstance getMetaProjectInstance()
This is a utility for dealing with the metaproject instance when it is known that we are executing on the server side. This utility makes it easier for developers to access and work with the meta-ontology in server-client mode.

Returns:
The MetaProjectInstance for this project.

localize

public void localize(KnowledgeBase kb)
This call is used to make needed adjustments to objects after they have been serialized and then deserialized. The main adjustment needed is to set the knowledge base in all the frames. It is likely that all sub-classes will need to implement this method.

Specified by:
localize in interface Localizable
Parameters:
kb - The knowledge base of running on the jvm that deserialized this job.

Protege 3.3.1

Submit a bug report or feature request
Protégé is a trademark of Stanford University.
Copyright (c) 1998-2007 Stanford University.