Another bnd code refresh

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1351297 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/Container.java b/bundleplugin/src/main/java/aQute/bnd/build/Container.java
index e0aac8a..f726527 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/Container.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/Container.java
@@ -9,7 +9,7 @@
 
 public class Container {
 	public enum TYPE {
-		REPO, PROJECT, PROJECT_BUNDLE, EXTERNAL, LIBRARY, ERROR
+		REPO, PROJECT, EXTERNAL, LIBRARY, ERROR
 	}
 
 	final File					file;
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/Project.java b/bundleplugin/src/main/java/aQute/bnd/build/Project.java
index 1ec2c33..b55727a 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/Project.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/Project.java
@@ -998,6 +998,9 @@
 					case LOWEST :
 						provider = versions.firstKey();
 						break;
+					case EXACT :
+						// TODO need to handle exact better
+						break;
 				}
 				if (provider != null) {
 					RepositoryPlugin repo = versions.get(provider);
@@ -1274,6 +1277,11 @@
 	 * Check if this project needs building. This is defined as:
 	 */
 	public boolean isStale() throws Exception {
+		if ( workspace.isOffline()) {
+			trace("working %s offline, so always stale", this);
+			return true;
+		}
+		
 		Set<Project> visited = new HashSet<Project>();
 		return isStale(visited);
 	}
@@ -1320,6 +1328,7 @@
 					return true;
 			}
 		}
+		
 		return false;
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/Workspace.java b/bundleplugin/src/main/java/aQute/bnd/build/Workspace.java
index 573a61e..c74687f 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/Workspace.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/Workspace.java
@@ -28,6 +28,7 @@
 	final Map<String,Action>					commands	= newMap();
 	final File									buildDir;
 	final Maven									maven		= new Maven(Processor.getExecutor());
+	private boolean								offline		= true;
 
 	/**
 	 * This static method finds the workspace and creates a project (or returns
@@ -188,6 +189,7 @@
 		List<BndListener> listeners = getPlugins(BndListener.class);
 		for (BndListener l : listeners)
 			try {
+				offline = false;
 				l.changed(f);
 			}
 			catch (Exception e) {
@@ -360,4 +362,19 @@
 		list.add(new CachedFileRepo());
 	}
 
+	/**
+	 * Return if we're in offline mode. Offline mode is defined as an
+	 * environment where nobody tells us the resources are out of date (refresh
+	 * or changed). This is currently defined as having bndlisteners.
+	 * 
+	 * @return
+	 */
+	public boolean isOffline() {
+		return offline;
+	}
+
+	public Workspace setOffline(boolean on) {
+		this.offline = on;
+		return this;
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java b/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java
index 80a0a4e..05bb5eb 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java
@@ -185,6 +185,9 @@
 					return files[0];
 				case HIGHEST :
 					return files[files.length - 1];
+				case EXACT :
+					// TODO exact
+					break;
 			}
 		}
 		return null;
diff --git a/bundleplugin/src/main/java/aQute/bnd/repo/eclipse/EclipseRepo.java b/bundleplugin/src/main/java/aQute/bnd/repo/eclipse/EclipseRepo.java
index a54fc7e..0155c24 100644
--- a/bundleplugin/src/main/java/aQute/bnd/repo/eclipse/EclipseRepo.java
+++ b/bundleplugin/src/main/java/aQute/bnd/repo/eclipse/EclipseRepo.java
@@ -189,6 +189,9 @@
 					return files[0];
 				case HIGHEST :
 					return files[files.length - 1];
+				case EXACT :
+					// TODO exact version handing
+					break;
 			}
 		}
 		return null;
diff --git a/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java b/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
index a89d4e0..cfc69f3 100644
--- a/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
+++ b/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
@@ -313,6 +313,9 @@
 					return files[0];
 				case HIGHEST :
 					return files[files.length - 1];
+				case EXACT :
+					// TODO
+					break;
 			}
 		}
 		return null;
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Annotation.java b/bundleplugin/src/main/java/aQute/lib/osgi/Annotation.java
index cafe0e3..e364949 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Annotation.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Annotation.java
@@ -6,7 +6,6 @@
 import aQute.bnd.annotation.metatype.*;
 import aQute.lib.osgi.Descriptors.TypeRef;
 
-@SuppressWarnings("unchecked")
 public class Annotation {
 	TypeRef				name;
 	Map<String,Object>	elements;
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java b/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java
index ab1cf10..d7179d6 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java
@@ -128,7 +128,7 @@
 		if (p.isFailOk())
 			p.warning(string, args);
 		else {
-			String s = formatArrays(string, args);
+			String s = formatArrays(string, args == null ? new Object[0] : args);
 			if (!p.errors.contains(s))
 				p.errors.add(s);
 		}
@@ -142,7 +142,7 @@
 			p.warning(string + ": " + t, args);
 		else {
 			p.errors.add("Exception: " + t.getMessage());
-			String s = formatArrays(string, args);
+			String s = formatArrays(string, args == null ? new Object[0] : args);
 			if (!p.errors.contains(s))
 				p.errors.add(s);
 		}