Protege 3.4.8

edu.stanford.smi.protege.util
Class ProtegeJob

java.lang.Object
  extended by edu.stanford.smi.protege.util.RemoteJob
      extended by edu.stanford.smi.protege.util.ProtegeJob
All Implemented Interfaces:
Localizable, Serializable
Direct Known Subclasses:
CacheControlJob, ControlFrameCalculatorCachingJob, GetInstancesAndBrowserTextJob, GetOwnSlotValuesBrowserTextJob, GetServerProjectName, PingProtegeServerJob

public abstract class ProtegeJob
extends RemoteJob
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.
 ProjectInstance 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.
 boolean serverSideCheckOperationAllowed(Operation op)
           
 
Methods inherited from class edu.stanford.smi.protege.util.RemoteJob
run, serverSideCheckOperationAllowed
 
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

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.

getKnowledgeBase

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

Returns:
the knowledge base associated with this job.

fixLoader

public void fixLoader()
Specified by:
fixLoader in class RemoteJob

getMetaProjectInstance

public ProjectInstance 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 ProjectInstance for this project.

serverSideCheckOperationAllowed

public boolean serverSideCheckOperationAllowed(Operation op)

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.4.8

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