Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add repositories info.

  • Loading branch information...
commit f492f9b88d89e7082e450543f0b5cc0253b0e0f1 1 parent a76bd32
@alesj alesj authored
View
8 api/src/main/java/com/redhat/ceylon/cmr/api/RepositoryManager.java
@@ -19,6 +19,7 @@
import java.io.File;
import java.io.InputStream;
+import java.util.List;
/**
* RepositoryManager API.
@@ -67,4 +68,11 @@
void removeArtifact(String name, String version) throws RepositoryException;
void removeArtifact(ArtifactContext context) throws RepositoryException;
+
+ /**
+ * Gather repositories display strings.
+ *
+ * @return the display strings
+ */
+ List<String> getRepositoriesDisplayString();
}
View
9 impl/src/main/java/com/redhat/ceylon/cmr/impl/AbstractNodeRepositoryManager.java
@@ -26,6 +26,7 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -80,6 +81,14 @@ protected ArtifactResult toArtifactResult(Node node) {
return adapter.getArtifactResult(this, node);
}
+ public List<String> getRepositoriesDisplayString() {
+ final List<String> displayStrings = new ArrayList<String>();
+ for (Repository root : roots) {
+ displayStrings.add(root.getDisplayString());
+ }
+ return displayStrings;
+ }
+
public void putArtifact(ArtifactContext context, InputStream content) throws RepositoryException {
final Node parent = getOrCreateParent(context);
log.debug("Adding artifact " + context + " to repository " + root.getDisplayString());
View
86 impl/src/main/java/com/redhat/ceylon/cmr/impl/CacheRepositoryManager.java
@@ -1,86 +0,0 @@
-/*
- * Copyright 2011 Red Hat inc. and third party contributors as noted
- * by the author tags.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.redhat.ceylon.cmr.impl;
-
-import com.redhat.ceylon.cmr.api.*;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Cache manager.
- * Cache remote lookups - hits and misses.
- *
- * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
- */
-public class CacheRepositoryManager extends AbstractRepositoryManager {
-
- private File root = getCacheDir();
- private Map<Repository, RepositoryManager> repositories = new ConcurrentHashMap<Repository, RepositoryManager>();
- private AbstractNodeRepositoryManager manager;
-
- private static File getCacheDir() {
- final File dir = new File(System.getProperty("user.home"), ".ceylon/cache");
- if (dir.exists() == false && dir.mkdirs() == false)
- throw new IllegalArgumentException("Cannot create Ceylon cache dir: " + dir);
- return dir;
- }
-
- public CacheRepositoryManager(Logger log) {
- super(log);
- }
-
- public ArtifactResult getArtifactResult(ArtifactContext context) throws RepositoryException {
- return null;
- }
-
- public void putArtifact(ArtifactContext context, InputStream content) throws RepositoryException {
- }
-
- public void removeArtifact(ArtifactContext context) throws RepositoryException {
- }
-
- protected void addRepository(Repository repository) {
- if (repository.getRoot().isRemote()) {
- final FileContentStore fileContentStore = new FileContentStore(new File(root, "/todo")); // TODO
- final RepositoryManager rm = new SimpleRepositoryManager(fileContentStore, log);
- repositories.put(repository, rm);
- }
- }
-
- protected void prependRepository(Repository external) {
- manager.prependRepository(external);
- addRepository(external);
- }
-
- protected void appendRepository(Repository external) {
- manager.appendRepository(external);
- addRepository(external);
- }
-
- protected void removeRepository(Repository external) {
- manager.removeRepository(external);
- repositories.remove(external);
- }
-
- @Override
- public String toString() {
- return "CacheRepositoryManager: " + root;
- }
-}
View
9 impl/src/main/java/com/redhat/ceylon/cmr/impl/OutputRepositoryManager.java
@@ -20,6 +20,8 @@
import java.io.File;
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
/**
* Output manager.
@@ -55,6 +57,13 @@ public OutputRepositoryManager(RepositoryManager output, RepositoryManager manag
this.manager = manager;
}
+ public List<String> getRepositoriesDisplayString() {
+ List<String> displayStrings = new ArrayList<String>();
+ displayStrings.addAll(output.getRepositoriesDisplayString());
+ displayStrings.addAll(manager.getRepositoriesDisplayString());
+ return displayStrings;
+ }
+
public ArtifactResult getArtifactResult(ArtifactContext context) throws RepositoryException {
final ArtifactResult result = output.getArtifactResult(context);
if (result != null) {
Please sign in to comment.
Something went wrong with that request. Please try again.