2026-03-17 13:31:18 -07:00

131 lines
3.9 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package javax.baja.naming;
import javax.baja.naming.BISession;
import javax.baja.naming.BOrd;
import javax.baja.naming.BOrdScheme;
import javax.baja.naming.InvalidOrdBaseException;
import javax.baja.naming.OrdQuery;
import javax.baja.naming.OrdQueryList;
import javax.baja.naming.OrdTarget;
import javax.baja.naming.SyntaxException;
import javax.baja.naming.UnresolvedException;
import javax.baja.sys.BComponent;
import javax.baja.sys.ModuleNotFoundException;
import javax.baja.sys.ServiceNotFoundException;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.sys.TypeNotFoundException;
import javax.baja.util.BTypeSpec;
/*
* Illegal identifiers - consider using --renameillegalidents true
*/
public class BServiceScheme
extends BOrdScheme {
public static final BServiceScheme INSTANCE = new BServiceScheme();
public static final Type TYPE;
static /* synthetic */ Class class$javax$baja$naming$BServiceScheme;
public OrdQuery parse(String string) {
if (string.length() < 3 || string.indexOf(58) <= 0) {
throw new SyntaxException("Not a typespec: \"" + string + '\"');
}
return new ServiceQuery(string);
}
public OrdTarget resolve(OrdTarget ordTarget, OrdQuery ordQuery) throws SyntaxException, UnresolvedException {
BComponent bComponent = null;
try {
BTypeSpec bTypeSpec = BTypeSpec.make(ordQuery.getBody());
Type type = bTypeSpec.getResolvedType();
BISession bISession = BOrd.toSession(ordTarget.get());
if (bISession == null) {
throw new InvalidOrdBaseException("" + ordTarget);
}
if (!(bISession instanceof ServiceSession)) {
throw new InvalidOrdBaseException("Session does not support services");
}
bComponent = ((ServiceSession)((Object)bISession)).getService(type);
}
catch (ModuleNotFoundException moduleNotFoundException) {
}
catch (TypeNotFoundException typeNotFoundException) {
}
catch (ServiceNotFoundException serviceNotFoundException) {}
if (bComponent == null) {
throw new UnresolvedException("Service not found: " + ordQuery.getBody());
}
return new OrdTarget(ordTarget, bComponent);
}
public Type getType() {
return TYPE;
}
static /* synthetic */ Class class(String string, boolean bl) {
try {
Class<?> clazz = Class.forName(string);
if (!bl) {
clazz = clazz.getComponentType();
}
return clazz;
}
catch (ClassNotFoundException classNotFoundException) {
throw new NoClassDefFoundError(classNotFoundException.getMessage());
}
}
private BServiceScheme() {
super("service");
}
static {
Class clazz = class$javax$baja$naming$BServiceScheme;
if (clazz == null) {
clazz = class$javax$baja$naming$BServiceScheme = BServiceScheme.class("[Ljavax.baja.naming.BServiceScheme;", false);
}
TYPE = Sys.loadType(clazz);
}
static class ServiceQuery
implements OrdQuery {
String body;
public boolean isHost() {
return false;
}
public boolean isSession() {
return false;
}
public void normalize(OrdQueryList ordQueryList, int n) {
ordQueryList.shiftToSession(n);
}
public String getScheme() {
return "service";
}
public String getBody() {
return this.body;
}
public String toString() {
return "service:" + this.body;
}
ServiceQuery(String string) {
this.body = string;
}
}
public static interface ServiceSession {
public BComponent getService(Type var1);
}
}