/*___INFO__MARK_BEGIN__*/ /************************************************************************* * * The Contents of this file are made available subject to the terms of * the Sun Industry Standards Source License Version 1.2 * * Sun Microsystems Inc., March, 2001 * * * Sun Industry Standards Source License Version 1.2 * ================================================= * The contents of this file are subject to the Sun Industry Standards * Source License Version 1.2 (the "License"); You may not use this file * except in compliance with the License. You may obtain a copy of the * License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html * * Software provided under this License is provided on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. * See the License for the specific provisions governing your rights and * obligations concerning the Software. * * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * * Copyright: 2001 by Sun Microsystems, Inc. * * All Rights Reserved. * ************************************************************************/ /*___INFO__MARK_END__*/ /** * Generated from java_jgdi.jsp * !!! DO NOT EDIT THIS FILE !!! */ <% final com.sun.grid.cull.JavaHelper jh = (com.sun.grid.cull.JavaHelper)params.get("javaHelper"); final com.sun.grid.cull.CullDefinition cullDef = (com.sun.grid.cull.CullDefinition)params.get("cullDef"); final java.util.logging.Logger logger = java.util.logging.Logger.getLogger("cullconv"); class JGDIGenerator extends com.sun.grid.cull.AbstractGDIGenerator { public JGDIGenerator(com.sun.grid.cull.CullObject cullObj) { super(cullObj.getIdlName(), jh.getClassName(cullObj), cullObj); addPrimaryKeys(cullObj, jh); } public void genImport() { if(!(cullObject.getType() == cullObject.TYPE_PRIMITIVE || cullObject.getType() == cullObject.TYPE_MAPPED)) { %>import com.sun.grid.jgdi.configuration.<%=classname%>; <% } } public void genUpdateMethod() { %> /** * Update a <%=name%> object. * @param obj the <%=name%> object with the new values * @throws JGDIException on any error on the GDI layer */ public void update<%=name%>(<%=classname%> obj) throws JGDIException; /** * Update a <%=name%> object. * @param obj the <%=name%> object with the new values * @param answers the answer list object * @throws JGDIException on any error on the GDI layer */ public void update<%=name%>WithAnswer(<%=classname%> obj, List answers) throws JGDIException; <% } // end of genUpdateMethod public void genGetMethod() { %> /** * Get the <%=name%> object. * @return the <%=classname%> object. * @throws JGDIException on any error on the GDI layer */ public <%=classname%> get<%=name%>() throws JGDIException; /** * Get the <%=name%> object. * @param answers the answer list object * @return the <%=classname%> object. * @throws JGDIException on any error on the GDI layer */ public <%=classname%> get<%=name%>WithAnswer(List answers) throws JGDIException; <% } // end of genGetMethod public void genGetListMethod() { %> /** * Get the list of all defined <%=name%> objects. * @return list of <%=name%> objects * @throws JGDIException on any error on the GDI layer */ public List< <%=classname%> > get<%=name%>List() throws JGDIException; /** * Get the list of all defined <%=name%> objects. * @param answers the answer list object * @return list of <%=name%> objects * @throws JGDIException on any error on the GDI layer */ public List< <%=classname%> > get<%=name%>ListWithAnswer(List answers) throws JGDIException; <% } // end of genGetListMethod public void genAddMethod() { %> /** * Add a new <%=name%> object. * @param obj the new <%=name%> object * @throws JGDIException on any error on the GDI layer */ public void add<%=name%>(<%=classname%> obj) throws JGDIException; /** * Add a new <%=name%> object. * @param obj the new <%=name%> object * @param answers the answer list object * @throws JGDIException on any error on the GDI layer */ public void add<%=name%>WithAnswer(<%=classname%> obj, List answers) throws JGDIException; <% if ((name.equals("Manager")) || (name.equals("Operator")) || (name.equals("AdminHost")) || (name.equals("SubmitHost"))) { %> /** * Add a new <%=name%> object. * @param name the new String object * @throws JGDIException on any error on the GDI layer */ public void add<%=name%>(String name) throws JGDIException; /** * Add a new <%=name%> object. * @param name the new String object * @param answers the answer list object * @throws JGDIException on any error on the GDI layer */ public void add<%=name%>WithAnswer(String name, List answers) throws JGDIException; <% } // end if name.equals() } // end of genAddMethod public void genDeleteMethod() { %> /** * Delete a <%=name%> object. * @param obj <%=name%> object with the primary key information * @throws JGDIException on any error on the GDI layer */ public void delete<%=name%>(<%=classname%> obj) throws JGDIException; /** * Delete a <%=name%> object. * @param obj the <%=name%> object with the primary key information * @param answers the answer list object * @throws JGDIException on any error on the GDI layer */ public void delete<%=name%>WithAnswer(<%=classname%> obj, List answers) throws JGDIException; <% } // end of genDeleteMethod public void genDeleteByPrimaryKeyMethod() { %> /** * Delete a <%=name%> object by its primary key <% for (java.util.Map.Entry entry: primaryKeys.entrySet()) { String pkName = entry.getKey(); String pkType = entry.getValue(); %> * @param <%=pkName%> the <%=pkName%> of the <%=name%> object <% } // end of for %> * @throws JGDIException on any error on the GDI layer */ public void delete<%=name%>(<% boolean first = true; for (java.util.Map.Entry entry: primaryKeys.entrySet()) { String pkName = entry.getKey(); String pkType = entry.getValue(); if (first) { first = false; } else { %> , <% } %> <%=pkType%> <%=pkName%> <% } // end of for %>) throws JGDIException; /** * Delete a <%=name%> object by its primary key <% for (java.util.Map.Entry entry: primaryKeys.entrySet()) { String pkName = entry.getKey(); String pkType = entry.getValue(); %> * @param <%=pkName%> the <%=pkName%> of the <%=name%> object <% } // end of for %> * @param answers the answer list object * @throws JGDIException on any error on the GDI layer */ public void delete<%=name%>WithAnswer(<% first = true; for (java.util.Map.Entry entry: primaryKeys.entrySet()) { String pkName = entry.getKey(); String pkType = entry.getValue(); if (first) { first = false; } else { %> , <% } %> <%=pkType%> <%=pkName%> <% } // end of for %>, List answers) throws JGDIException; /** * Delete several <%=name%> objects by their primary key <% for (java.util.Map.Entry entry: primaryKeys.entrySet()) { String pkName = entry.getKey(); // String pkType = entry.getValue(); %> * @param <%=pkName%>s array of <%=pkName%> of the <%=name%> objects <% } // end of for %> * @param answers the answer list object * @throws JGDIException on any error on the GDI layer */ public void delete<%=name%>sWithAnswer(<% first = true; for (java.util.Map.Entry entry: primaryKeys.entrySet()) { String pkName = entry.getKey(); // String pkType = entry.getValue(); if (first) { first = false; } else { %> , <% } %> String[] <%=pkName%>s <% } // end of for %> <% if (name.equals("Job") || name.equals("AdvanceReservation")) {%> , boolean forced, UserFilter userFilter <% }%> , List answers) throws JGDIException; <% } // end of genDeleteByPrimaryKeyMethod public void genGetByPrimaryKeyMethod() { %> /** * Get a <%=name%> by its primary key * * @return the <%=name%> <% for (java.util.Map.Entry entry: primaryKeys.entrySet()) { String pkName = entry.getKey(); String pkType = entry.getValue(); %> * @param <%=pkName%> the <%=pkName%> of the <%=name%> object <% } // end of for %> * @return the found <%=name%> object of null * @throws JGDIException on any error on the GDI layer */ public <%=classname%> get<%=name%>(<% boolean first = true; for (java.util.Map.Entry entry: primaryKeys.entrySet()) { String pkName = entry.getKey(); String pkType = entry.getValue(); if (first) { first = false; } else { %> , <% } %> <%=pkType%> <%=pkName%> <% } // end of for %>) throws JGDIException; /** * Get a <%=name%> by its primary key * * @return the <%=name%> <% for (java.util.Map.Entry entry: primaryKeys.entrySet()) { String pkName = entry.getKey(); String pkType = entry.getValue(); %> * @param <%=pkName%> the <%=pkName%> of the <%=name%> object <% } // end of for %> * @param answers the answer list object * @return the found <%=name%> object of null * @throws JGDIException on any error on the GDI layer */ public <%=classname%> get<%=name%>WithAnswer(<% first = true; for (java.util.Map.Entry entry: primaryKeys.entrySet()) { String pkName = entry.getKey(); String pkType = entry.getValue(); if (first) { first = false; } else { %> , <% } %> <%=pkType%> <%=pkName%> <% } // end of for %>, List answers) throws JGDIException; <% } // end of genGetByPrimaryKeyMethod } // end of class JGDIGenerator // -------------------------------------------------------------------------- // Build all generator instances // -------------------------------------------------------------------------- java.util.ArrayList generators = new java.util.ArrayList(); for (String name : cullDef.getObjectNames()) { com.sun.grid.cull.CullObject cullObj = cullDef.getCullObject(name); logger.fine("JGDIGenerator->handle " + cullObj.getName() + "(" + cullObj.getOperationString() +")"); generators.add(new JGDIGenerator(cullObj)); } %> package com.sun.grid.jgdi; import java.util.List; import com.sun.grid.jgdi.JGDIException; import com.sun.grid.jgdi.configuration.JGDIAnswer; import com.sun.grid.jgdi.monitoring.filter.UserFilter; <% // Import all cull object names; for (JGDIGenerator gen : generators) { gen.genImport(); } %> /** *

The class JGDI is the central interface for communication with * the SGE master.

* *

An instanceof of the interface can be obtained via the {@link JGDIFactory}. * For each JGDI instance the close method has to * called to give the native parts of the implementation a chance to release * the resources.

* *

Example:

*
 *     String url = "bootstrap:///opt/sge@default:1026";
 *     String user = "sge_admin";
 *     String password = "secret";
 *
 *     JGDI jgdi = JGDIFactory.newInstance(url, user, password);
 *     ...
 *     jgdi.close();
 *    
 *  
* * Warning: The JGDI interface will not be compatible with future Sun™ Grid Engine releases. * * @version 6.5 * */ public interface JGDI extends JGDIBase { <% for (JGDIGenerator gen : generators) { gen.genMethods(); } %> }