Package net.sf.robocode.repository.items

Examples of net.sf.robocode.repository.items.IRepositoryItem


    }
  }

  private void createItem(List<IRepositoryItem> items, URL root, String url) {
    try {
      IRepositoryItem item = ItemHandler.registerItem(new URL(url), DllRoot.this, repository);
      if (item != null) {
        if (item instanceof RobotItem) {
          ((RobotItem) item).setClassPathURL(root);
        }
        items.add(item);
View Full Code Here


    // Check if the source file is already registered in the repository with a project URL
    if (root instanceof ClasspathRoot) {
      String projectUrl = ((ClasspathRoot) root).getFriendlyProjectURL(sourceFileUrl);
      if (projectUrl != null) {
        IRepositoryItem repositoryItem = repository.getItem(projectUrl);
        if (repositoryItem instanceof RobotItem) {
          item = (RobotItem) repositoryItem;
        }
      }
    }

    // If no project URL was registered with the source file then check if the source file is registered
    // in the repository.
    if (item == null) {
      String friendlyUrl = UrlUtil.removeFileExtension(sourceFileUrl.toString());

      IRepositoryItem repositoryItem = repository.getItem(friendlyUrl);
      if (repositoryItem instanceof RobotItem) {
        item = (RobotItem) repositoryItem;
      }
    }
View Full Code Here

   */
  public final static IRepositoryItem registerItem(URL itemUrl, IRepositoryRoot root, IRepository repository) {
    // Test if any available item handler will accept and register the item
    List<ItemHandler> itemHandlers = Container.getComponents(ItemHandler.class);
    for (ItemHandler handler : itemHandlers) {
      IRepositoryItem repositoryItem = handler.acceptItem(itemUrl, root, repository);
      if (repositoryItem != null) {
        return repositoryItem;
      }
    }
    return null;
View Full Code Here

    RobotItem item = null;

    // Check if the class file is already registered in the repository
    String friendlyUrl = UrlUtil.removeFileExtension(classFileUrl.toString());
   
    IRepositoryItem repositoryItem = repository.getItem(friendlyUrl);
    if (repositoryItem instanceof RobotItem) {
      item = (RobotItem) repositoryItem;
    }

    // If the class file has not been registered then create a new RobotItem based on the class file URL
View Full Code Here

    TeamItem item = null;

    // Check if the team file is already registered in the repository
    String friendlyUrl = UrlUtil.removeFileExtension(teamFileUrl.toString());

    IRepositoryItem repositoryItem = repository.getItem(friendlyUrl);
    if (repositoryItem instanceof TeamItem) {
      item = (TeamItem) repositoryItem;
    }

    // If the team file has not been registered then create a new TeamItem based on the team file URL
View Full Code Here

    RobotItem item = null;

    // Check if the properties file is already registered in the repository
    String friendlyUrl = UrlUtil.removeFileExtension(propertiesFileUrl.toString());

    IRepositoryItem repositoryItem = repository.getItem(friendlyUrl);
    if (repositoryItem instanceof RobotItem) {
      item = (RobotItem) repositoryItem;
    }

    // If the properties file has not been registered then create a new RobotItem based on the properties file URL
View Full Code Here

    return prev != repository.getItems().size();
  }

  private boolean updateItemRoot(String friendlyUrl, boolean force) {
    IRepositoryItem repositoryItem = repository.getItems().get(friendlyUrl);
    if (repositoryItem != null) {
      repositoryItem.getRoot().updateItem(repositoryItem, force);
      return true;
    }
    return false;
  }
View Full Code Here

    StringTokenizer tokenizer = new StringTokenizer(friendlyUrls, ",");

    while (tokenizer.hasMoreTokens()) {
      String friendlyUrl = tokenizer.nextToken().trim();

      IRepositoryItem repositoryItem = repository.getItem(friendlyUrl);
      if (repositoryItem != null) {
        if (repositoryItem.isValid()) {
          result.add((IRobotSpecItem) repositoryItem);
        } else {
          Logger.logError("Can't load '" + friendlyUrl + "' because it is an invalid robot or team.");
        }
      } else {
View Full Code Here

      botPath = botPath.replace('.', '/').replaceAll("\\*", "");

      // first load from same classPath
      String teamBot = team.getRoot().getURL() + botPath;
      IRepositoryItem res = repository.getItem(teamBot);

      if (res != null && res instanceof RobotItem) {
        result.add((RobotItem) res);
        continue;
      }
View Full Code Here

    }
    return null;
  }

  private IRobotSpecItem getRobot(String fullClassNameWithVersion) {
    final IRepositoryItem repositoryItem = repository.getItem(fullClassNameWithVersion);

    if (repositoryItem == null || !repositoryItem.isValid()) {
      return null;
    }
    return (IRobotSpecItem) repositoryItem;
  }
View Full Code Here

TOP

Related Classes of net.sf.robocode.repository.items.IRepositoryItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.