⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classpathmanager.java

📁 Java 3D Desktop Environment旨在使用Java 3D来创建一个3D桌面环境。功能包括:分布式的应用程序
💻 JAVA
字号:
package org.j3de.server;                          

import java.util.Iterator;
import java.util.Set;
import java.util.HashSet; 

import org.j3de.server.EnvironmentWrapper;
import org.j3de.server.ApplicationWrapper;

public class ClassPathManager {
  private ApplicationList applicationList;
  private EnvironmentList environmentList;
  private String rmiClassPath;   
  
  public ClassPathManager(EnvironmentList envList, ApplicationList appList, String rmiClassPath) {
    this.applicationList = appList;
    this.environmentList = envList;
    this.rmiClassPath    = rmiClassPath;
  }                      
  
  private static void addString(String hstr, Set set) {   
    int pos;
    String remainder;     
    hstr = hstr.trim();
    while (-1 < (pos = hstr.indexOf(' '))) {  
      remainder = hstr.substring(pos+1);
      hstr = hstr.substring(0, pos);
      if (!hstr.equals(""))
        set.add(hstr);
        
      hstr = remainder.trim();
    }          
    
    if (!hstr.equals(""))
      set.add(hstr);
  }        
   
  public String getCodeBase() {
    Set urls = new HashSet();  
    String codebase = "";  
    
    addString(rmiClassPath, urls);
    
    Iterator appIter = applicationList.getApplicationNames();
    while (appIter.hasNext())
      addString(applicationList.getApplication((String)appIter.next()).getJarURL(), urls);
    
    Iterator envIter = environmentList.getEnvironmentNames();     
    while (envIter.hasNext())    
      addString(environmentList.getEnvironmentWrapper((String)envIter.next()).getJarURL(), urls);      
    
    Iterator iter = urls.iterator();
    while (iter.hasNext())
      codebase += (String)iter.next() + " ";  
       
    return codebase;
  }
  
  public void setServerClassPath() {
    System.setProperty("java.rmi.server.codebase", getCodeBase());
  }
  
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -