这是一个基于计算网格的web service。它用java编写。一旦安装完成

源代码在线查看: ldapjobhostobjectfactory.java

软件大小: 4969 K
上传用户: choatehou4
关键词: service java web 计算网格
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*				 * LdapJobHostObjectFactory.java				 *				 * Created on April 16, 2005, 2:12 PM				 */								package jwsgrid.resourcemanager.priv;								import javax.naming.*;				import javax.naming.directory.*;				import javax.naming.spi.DirObjectFactory;								import java.util.Vector;				import java.util.Hashtable;								/**				 *				 * @author sean				 */				public class LdapJobHostObjectFactory implements DirObjectFactory 				{				    /** Creates a new instance of LdapJobHostObjectFactory */				    public LdapJobHostObjectFactory() 				    {				    }				    				    // DirObjectFactory version				    public Object getObjectInstance(				            Object obj, 				            Name name, 				            Context ctx, 				            Hashtable env, 				            Attributes attrs )				    throws Exception 				    {								        // Only interested in Attributes with ldapjobhost objectclass				        // System.out.println("object factory: " + attrs);				        Attribute oc = ( attrs != null ? attrs.get( "objectclass" ) : null );    				        				        if ( oc != null && oc.contains( Ldap.OBJ_JOBHOST ) ) 				        {				            Attribute attr = attrs.get( Ldap.ATTR_JHJOBTYPES );				            Vector jobTypeList = new Vector();				            				            for ( int i = 0; i < attr.size(); i++ )				            {				                jobTypeList.addElement( (String) attr.get( i ) );				            }				            				            LdapJobHost jobHost = new LdapJobHost(				                    (String) attrs.get( Ldap.ATTR_CN ).get(),				                    (String) attrs.get( Ldap.ATTR_JHCLUSTERID ).get(),				                    (String) attrs.get( Ldap.ATTR_JHOS_NAME ).get(), 				                    (String) attrs.get( Ldap.ATTR_JHOS_VERSION ).get(), 				                    (String) attrs.get( Ldap.ATTR_JHOS_ARCH ).get(), 				                    (String) attrs.get( Ldap.ATTR_JHCPU_VENDOR ).get(), 				                    (String) attrs.get( Ldap.ATTR_JHCPU_MODEL ).get(), 				                    Integer.valueOf( 				                        (String)attrs.get( Ldap.ATTR_JHCPU_COUNT).get() ),				                    Integer.valueOf( 				                        (String)attrs.get( Ldap.ATTR_JHCPU_SPEED).get() ),				                    Integer.valueOf( 				                        (String)attrs.get( Ldap.ATTR_JHCPU_USERTIME).get() ),				                    Integer.valueOf( 				                        (String)attrs.get( Ldap.ATTR_JHCPU_IDLETIME).get() ),				                    Integer.valueOf( 				                        (String)attrs.get( Ldap.ATTR_JHCPU_SYSTIME).get() ),				                    Integer.valueOf( 				                        (String)attrs.get( Ldap.ATTR_JHCPU_LOAD).get() ),                    				                    Integer.valueOf( 				                        (String)attrs.get( Ldap.ATTR_JHMEM_TOTAL).get() ),				                    Integer.valueOf( 				                        (String)attrs.get( Ldap.ATTR_JHMEM_FREE).get() ),				                    Integer.valueOf( 				                        (String)attrs.get( Ldap.ATTR_JHDISK_TOTAL).get() ),				                    Integer.valueOf( 				                        (String)attrs.get( Ldap.ATTR_JHDISK_FREE).get() ),				                    jobTypeList );								            return jobHost;				        }				        				        return null;				    }    				    				    // ObjectFactory version				    public Object getObjectInstance( 				            Object obj, 				            Name name, 				            Context ctx, 				            Hashtable env )				    throws Exception 				    {				        // Don't do anything if we can't see the attributes				        return null;				    }    				    				}							

相关资源