Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

BasicTaskQosketImpl.java

Go to the documentation of this file.
00001 /*
00002  * BasicTaskQosketImpl.java
00003  *
00004  * Copyright (c) 2003, 2004 The University of Utah and the Flux Group.
00005  * All rights reserved.
00006  *
00007  * This file is licensed under the terms of the GNU Public License.  
00008  * See the file "license.terms" for restrictions on redistribution 
00009  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00010  */
00011 
00012 /**
00013  * @file BasicTaskQosketImpl.java
00014  *
00015  * Default implementation of a Qosket::Basic::BasicTaskQosket.
00016  */
00017 
00018 package Qosket.Basic;
00019 
00020 import com.bbn.quo.corba.QuoKernel;
00021 import com.bbn.quo.corba.ValueSC;
00022 import com.bbn.quo.corba.Callback;
00023 import com.bbn.quo.corba.ValueSCHelper;
00024 import com.bbn.quo.corba.impl.Connector;
00025 
00026 import rk.ResourceSet;
00027 
00028 /**
00029  * A subclass of the Qosket::Basic::BasicTaskQosketSkel class generated from
00030  * the BasicTaskContract.  The implementation is pretty straightforward, it
00031  * gets its system conditions from the quo::QuoKernel and creates the callback
00032  * itself.
00033  *
00034  * @sa BasicTaskQosketImpl
00035  * @sa Qosket::Basic::BasicTaskCallback
00036  * @sa BasicTaskCallbackImpl
00037  * @sa StubBasicTaskCallback
00038  * @sa BasicTaskContract.cdl
00039  */
00040 public class BasicTaskQosketImpl
00041     extends BasicTaskQosketSkel
00042 {
00043     /**
00044      * Initialize the internal QuO system conditions.
00045      *
00046      * @param kernel The QuO kernel to get the system conditions from.
00047      */
00048     public void initSysconds(QuoKernel kernel)
00049     {
00050         org.omg.CORBA.Object raw =
00051             Connector.instantiateSysCond(kernel,
00052                                          "DeadlinesMissed",
00053                                          "quo::ValueSC",
00054                                          "quo_sc::ValueSCImpl");
00055         this.myDeadlinesMissed = ValueSCHelper.narrow(raw);
00056 
00057         raw = Connector.instantiateSysCond(kernel,
00058                                            "LastStatus",
00059                                            "quo::ValueSC",
00060                                            "quo_sc::ValueSCImpl");
00061         this.myLastStatus = ValueSCHelper.narrow(raw);
00062     }
00063 
00064     /**
00065      * Initialize the internal call back object.
00066      */
00067     public void initCallbacks()
00068     {
00069         BasicTaskCallbackImpl btci;
00070 
00071         btci = new BasicTaskCallbackImpl("BasicTaskCallback");
00072         try
00073         {
00074             (com.bbn.quo.corba.impl.Connector.quoPOA()).
00075                 activate_object(btci);
00076         }
00077         catch(Exception e)
00078         {
00079             e.printStackTrace();
00080         }
00081         this.myCallback = btci._this();
00082     }
00083 
00084     /** @copydoc Qosket::Basic::BasicTaskQosket::DeadlinesMissed */
00085     public ValueSC DeadlinesMissed()
00086     {
00087         return this.myDeadlinesMissed;
00088     }
00089 
00090     /** @copydoc Qosket::Basic::BasicTaskQosket::LastStatus */
00091     public ValueSC LastStatus()
00092     {
00093         return this.myLastStatus;
00094     }
00095 
00096     /** @copydoc Qosket::Basic::BasicTaskQosket::Callback */
00097     public Callback Callback()
00098     {
00099         return this.myCallback;
00100     }
00101 
00102     /** @copydoc Qosket::Basic::BasicTaskQosket::RUsage */
00103     public synchronized long RUsage()
00104     {
00105         long retval = rk.ResourceSet.getUsage();
00106         
00107         return retval;
00108     }
00109 
00110     /**
00111      * @see java.lang.Object#toString()
00112      */
00113     public String toString()
00114     {
00115         return "BasicTaskQosketImpl["
00116             + super.toString()
00117             + "]";
00118     }
00119 }

Generated on Fri Oct 22 07:50:24 2004 for CPU Broker by  doxygen 1.3.9.1