Package java.util

Examples of java.util.SortedSet


                rarPath);
        ListableRepository[] repos = PortletManager.getCurrentServer(request).getRepositories();
        for (ListableRepository repo : repos) {
            // if the artifact is not fully resolved then try to resolve it
            if (!artifact.isResolved()) {
                SortedSet results = repo.list(artifact);
                if (!results.isEmpty()) {
                    artifact = (Artifact) results.first();
                } else {
                    continue;
                }
            }
            File url = repo.getLocation(artifact);
View Full Code Here


     *
     * @return A Map with key type String (plugin name) and value type Artifact
     *         (config ID of the plugin).
     */
    public Map getInstalledPlugins() {
        SortedSet artifacts = writeableRepo.list();

        Map plugins = new HashMap();
        for (Iterator i = artifacts.iterator(); i.hasNext();) {
            Artifact configId = (Artifact) i.next();
            File dir = writeableRepo.getLocation(configId);
            if(dir.isDirectory()) {
                File meta = new File(dir, "META-INF");
                if(!meta.isDirectory() || !meta.canRead()) {
View Full Code Here

   
    private static URL getLocation(Collection<ListableRepository> repositories, Artifact artifactQuery) throws DeploymentException, MalformedURLException {
        File file = null;
       
        for (ListableRepository repository : repositories) {
            SortedSet artifactSet = repository.list(artifactQuery);
            // if we have exactly one artifact found
            if (artifactSet.size() == 1) {
                file = repository.getLocation((Artifact) artifactSet.first());
                return file.getAbsoluteFile().toURL();
            } else if (artifactSet.size() > 1) {// if we have more than 1 artifacts found use the latest one.
                file = repository.getLocation((Artifact) artifactSet.last());
                return file.getAbsoluteFile().toURL();
            }
        }
        if (file == null) {
            throw new DeploymentException("Missing artifact in repositories: " + artifactQuery.toString());
View Full Code Here

        } else {
            TipoAssuntoCtrl defaultCtrl = new TipoAssuntoCtrl(getDaoFactory());
            object = defaultCtrl.get(new Long(id));
        }

        SortedSet lista = new TreeSet(new Comparator() {
            public int compare(Object obj1, Object obj2) {
                return ((Instituicao) obj1).getDescricao().compareTo(
                        ((Instituicao) obj2).getDescricao());
            }
        });

        SubOrgaoCtrl subOrgaoCtrl = new SubOrgaoCtrl(getDaoFactory());

        if( funcionario.getNivelAtuacao() == Funcionario.NA_ORGAO ) {
            lista.addAll(subOrgaoCtrl.list(getOrgao(request)));
        } else {
            lista.addAll(funcionario.getListaSubOrgaosAtivos());
        }

        request.setAttribute("object", object);
        request.setAttribute("function", request.getParameter("function"));
        request.setAttribute("listarInstituicao", lista);
View Full Code Here

  @Override
  @SuppressWarnings("unchecked")
  public SortedSet subSet(Object fromElement, Object toElement) {
    read();
    final SortedSet subSet = ( (SortedSet) set ).subSet( fromElement, toElement );
    return new SubSetProxy( subSet );
  }
View Full Code Here

  @Override
  @SuppressWarnings("unchecked")
  public SortedSet headSet(Object toElement) {
    read();
    final SortedSet headSet = ( (SortedSet) set ).headSet( toElement );
    return new SubSetProxy( headSet );
  }
View Full Code Here

  @Override
  @SuppressWarnings("unchecked")
  public SortedSet tailSet(Object fromElement) {
    read();
    final SortedSet tailSet = ( (SortedSet) set ).tailSet( fromElement );
    return new SubSetProxy( tailSet );
  }
View Full Code Here

    private static void hideAttributes(SortedMap map) {
  if (map.isEmpty())
      return;

  final SortedSet hiddenStrings;
  final SortedSet hiddenPrefixes;

  String hide = (String) map.get(HIDDEN_ATTRIBUTES);
  if (hide != null) {
      if (hide.startsWith("="))
    hide = hide.substring(1);
      else
    hide += " " + DEFAULT_HIDDEN_ATTRIBUTES;
      hiddenStrings = new TreeSet();
      hiddenPrefixes = new TreeSet();
      parseHiddenAttributes(hide, hiddenStrings, hiddenPrefixes);
  } else {
      hide = DEFAULT_HIDDEN_ATTRIBUTES;
      synchronized (defaultHiddenStrings) {
    if (defaultHiddenStrings.isEmpty()) {
        parseHiddenAttributes(hide,
            defaultHiddenStrings,
            defaultHiddenPrefixes);
    }
    hiddenStrings = defaultHiddenStrings;
    hiddenPrefixes = defaultHiddenPrefixes;
      }
  }

  /* Construct a string that is greater than any key in the map.
     Setting a string-to-match or a prefix-to-match to this string
     guarantees that we will never call next() on the corresponding
     iterator.  */
  String sentinelKey = map.lastKey() + "X";
  Iterator keyIterator = map.keySet().iterator();
  Iterator stringIterator = hiddenStrings.iterator();
  Iterator prefixIterator = hiddenPrefixes.iterator();

  String nextString;
  if (stringIterator.hasNext())
      nextString = (String) stringIterator.next();
  else
View Full Code Here

  /**
   * @see PersistentSortedSet#subSet(Object,Object)
   */
  public SortedSet subSet(Object fromElement, Object toElement) {
    read();
    SortedSet s;
    s = ( (SortedSet) set ).subSet(fromElement, toElement);
    return new SubSetProxy(s);
  }
View Full Code Here

  /**
   * @see PersistentSortedSet#headSet(Object)
   */
  public SortedSet headSet(Object toElement) {
    read();
    SortedSet s = ( (SortedSet) set ).headSet(toElement);
    return new SubSetProxy(s);
  }
View Full Code Here

TOP

Related Classes of java.util.SortedSet

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.