if (index < 0) {
throw ExceptionFactory.get("Expected url format: sec:user@pass:<url>");
}
String user = userPass.substring(0, index);
String pass = userPass.substring(index + 1);
final MicroKernel mk = getInstance(u);
try {
return new SecurityWrapper(mk, user, pass) {
@Override
public void dispose() {
super.dispose();
MicroKernelFactory.disposeInstance(mk);
}
};
} catch (MicroKernelException e) {
MicroKernelFactory.disposeInstance(mk);
throw e;
}
} else if (head.equals("virtual")) {
final MicroKernel mk = getInstance(tail);
try {
return new VirtualRepositoryWrapper(mk) {
@Override
public void dispose() {
super.dispose();
MicroKernelFactory.disposeInstance(mk);
}
};
} catch (MicroKernelException e) {
MicroKernelFactory.disposeInstance(mk);
throw e;
}
} else if (head.equals("index")) {
final MicroKernel mk = getInstance(tail);
try {
return new IndexWrapper(mk) {
public void dispose() {
MicroKernelFactory.disposeInstance(mk);
}
};
} catch (MicroKernelException e) {
MicroKernelFactory.disposeInstance(mk);
throw e;
}
} else if (head.equals("http")) {
return new Client(url);
} else if (head.equals("http-bridge")) {
final MicroKernel mk = getInstance(tail);
final Server server = new Server(mk);
try {
server.start();
} catch (IOException e) {