{
return;
}
RepositoryAdmin ra = (RepositoryAdmin) svcObj;
Resolver resolver = ra.resolver();
for (int argIdx = 0; (args != null) && (argIdx < args.length); argIdx++)
{
// Find the target's bundle resource.
String targetName = args[argIdx];
String targetVersion = null;
int idx = args[argIdx].indexOf(VERSION_SEPARATOR);
if (idx > 0)
{
targetName = args[argIdx].substring(0, idx);
targetVersion = args[argIdx].substring(idx + 1);
}
Resource resource = selectNewestVersion(
searchRepository(ra, targetName, targetVersion));
if (resource != null)
{
resolver.add(resource);
}
else
{
System.err.println("Unknown bundle - " + args[argIdx]);
}
}
if ((resolver.getAddedResources() != null) &&
(resolver.getAddedResources().length > 0))
{
if (resolver.resolve())
{
System.out.println("Target resource(s):");
System.out.println(Util.getUnderlineString(19));
Resource[] resources = resolver.getAddedResources();
for (int resIdx = 0; (resources != null) && (resIdx < resources.length); resIdx++)
{
System.out.println(" " + resources[resIdx].getPresentationName()
+ " (" + resources[resIdx].getVersion() + ")");
}
resources = resolver.getRequiredResources();
if ((resources != null) && (resources.length > 0))
{
System.out.println("\nRequired resource(s):");
System.out.println(Util.getUnderlineString(21));
for (int resIdx = 0; resIdx < resources.length; resIdx++)
{
System.out.println(" " + resources[resIdx].getPresentationName()
+ " (" + resources[resIdx].getVersion() + ")");
}
}
if (!requiredOnly)
{
resources = resolver.getOptionalResources();
if ((resources != null) && (resources.length > 0))
{
System.out.println("\nOptional resource(s):");
System.out.println(Util.getUnderlineString(21));
for (int resIdx = 0; resIdx < resources.length; resIdx++)
{
System.out.println(" " + resources[resIdx].getPresentationName()
+ " (" + resources[resIdx].getVersion() + ")");
}
}
}
try
{
System.out.print("\nDeploying...\n");
int options = 0;
if (start)
{
options |= Resolver.START;
}
if (requiredOnly)
{
options |= Resolver.NO_OPTIONAL_RESOURCES;
}
resolver.deploy(options);
System.out.println("done.");
}
catch (IllegalStateException ex)
{
System.err.println(ex);
}
}
else
{
Reason[] reqs = resolver.getUnsatisfiedRequirements();
if ((reqs != null) && (reqs.length > 0))
{
System.out.println("Unsatisfied requirement(s):");
System.out.println(Util.getUnderlineString(27));
for (int reqIdx = 0; reqIdx < reqs.length; reqIdx++)