/* * Decompiled with CFR 0.152. * * Could not load the following classes: * javax.baja.nre.util.Array */ package javax.baja.naming; import javax.baja.naming.BOrd; import javax.baja.naming.OrdQuery; import javax.baja.naming.OrdTarget; import javax.baja.naming.SlotPath; import javax.baja.naming.UnresolvedException; import javax.baja.nre.util.Array; import javax.baja.space.BComponentSpace; import javax.baja.sys.BComponent; import javax.baja.sys.BObject; import javax.baja.sys.Context; import javax.baja.virtual.BVirtualGateway; import javax.baja.virtual.VirtualPath; /* * Illegal identifiers - consider using --renameillegalidents true */ public class BatchResolve { BOrd[] ords; Result[] results; static /* synthetic */ Class class$javax$baja$naming$BatchResolve$ComponentSpaceItem; static /* synthetic */ Class class$javax$baja$naming$BatchResolve$ComponentSpaceGroup; static /* synthetic */ Class class$javax$baja$naming$SlotPath; public int size() { return this.ords.length; } public BOrd getOrd(int n) { return this.ords[n]; } public boolean isResolved(int n) { boolean bl = false; if (this.results[n].target != null) { bl = true; } return bl; } public Throwable getException(int n) { return this.results[n].exception; } public OrdTarget getTarget(int n) { Result result = this.results[n]; OrdTarget ordTarget = result.target; if (ordTarget != null) { return ordTarget; } if (result.exception instanceof RuntimeException) { throw (RuntimeException)result.exception; } throw new UnresolvedException("" + this.ords[n], result.exception); } public BObject get(int n) { return this.getTarget(n).get(); } public OrdTarget[] getTargets() { OrdTarget[] ordTargetArray = new OrdTarget[this.results.length]; int n = 0; while (n < ordTargetArray.length) { ordTargetArray[n] = this.getTarget(n); ++n; } return ordTargetArray; } public BObject[] getTargetObjects() { OrdTarget[] ordTargetArray = this.getTargets(); BObject[] bObjectArray = new BObject[ordTargetArray.length]; int n = 0; while (n < bObjectArray.length) { bObjectArray[n] = ordTargetArray[n].get(); ++n; } return bObjectArray; } public BComponent[] getTargetComponents() { OrdTarget[] ordTargetArray = this.getTargets(); BComponent[] bComponentArray = new BComponent[ordTargetArray.length]; int n = 0; while (n < bComponentArray.length) { bComponentArray[n] = (BComponent)ordTargetArray[n].get(); ++n; } return bComponentArray; } public BatchResolve resolve(BObject bObject) { return this.resolve(bObject, null); } public BatchResolve resolve(BObject bObject, Context context) { try { this.resolveComponentSpace(bObject, context); } catch (Exception exception) { exception.printStackTrace(); } int n = 0; while (n < this.ords.length) { Result result = this.results[n]; if (result.target == null && result.exception == null) { try { result.target = this.ords[n].resolve(bObject, context); result.exception = null; } catch (Throwable throwable) { result.target = null; result.exception = throwable; } } ++n; } return this; } private final void resolveComponentSpace(BObject bObject, Context context) { Object object; Class clazz = class$javax$baja$naming$BatchResolve$ComponentSpaceItem; if (clazz == null) { clazz = class$javax$baja$naming$BatchResolve$ComponentSpaceItem = BatchResolve.class("[Ljavax.baja.naming.BatchResolve$ComponentSpaceItem;", false); } Array array = new Array(clazz); int n = 0; while (n < this.ords.length) { BOrd bOrd = this.ords[n]; if ((bOrd.toString().indexOf("slot:") >= 0 || bOrd.toString().indexOf("virtual:") >= 0 || bOrd.toString().indexOf("h:") >= 0) && (object = this.makeComponentSpaceItem(bOrd, bObject)) != null) { array.add(object); } ++n; } if (array.size() == 0) { return; } Class clazz2 = class$javax$baja$naming$BatchResolve$ComponentSpaceGroup; if (clazz2 == null) { clazz2 = class$javax$baja$naming$BatchResolve$ComponentSpaceGroup = BatchResolve.class("[Ljavax.baja.naming.BatchResolve$ComponentSpaceGroup;", false); } Array array2 = new Array(clazz2); int n2 = 0; while (n2 < array.size()) { object = (ComponentSpaceItem)array.get(n2); BComponentSpace bComponentSpace = ((ComponentSpaceItem)object).space; ComponentSpaceGroup componentSpaceGroup = null; int n3 = 0; while (n3 < array2.size()) { ComponentSpaceGroup componentSpaceGroup2 = (ComponentSpaceGroup)array2.get(n3); if (componentSpaceGroup2.space == bComponentSpace) { componentSpaceGroup = componentSpaceGroup2; break; } ++n3; } if (componentSpaceGroup == null) { componentSpaceGroup = new ComponentSpaceGroup(bComponentSpace); array2.add((Object)componentSpaceGroup); } componentSpaceGroup.items.add(object); ++n2; } n2 = 0; while (n2 < array2.size()) { object = (ComponentSpaceGroup)array2.get(n2); this.resolveComponentSpaceGroup((ComponentSpaceGroup)object, bObject, context); ++n2; } } private final ComponentSpaceItem makeComponentSpaceItem(BOrd bOrd, BObject bObject) { Object object; Object object2; ComponentSpaceItem componentSpaceItem = new ComponentSpaceItem(bOrd); OrdQuery[] ordQueryArray = bOrd.normalize().parse(); int n = -1; int n2 = 0; while (n2 < ordQueryArray.length) { object2 = ordQueryArray[n2]; object = object2.getScheme(); if (((String)object).equals("virtual")) { n = n2; componentSpaceItem.slot = object2; break; } if (((String)object).equals("h") && n == -1) { n = n2; componentSpaceItem.h = object2; } if (((String)object).equals("slot") && n == -1) { n = n2; componentSpaceItem.slot = object2; } ++n2; } if (n == -1) { return null; } BObject bObject2 = null; try { object2 = BOrd.make(ordQueryArray, 0, n); if (!((BOrd)object2).isNull()) { bObject2 = ((BOrd)object2).get(bObject); } } catch (Exception exception) {} object2 = null; if (bObject2 instanceof BComponentSpace) { object2 = (BComponentSpace)bObject2; } else if (bObject2 instanceof BVirtualGateway) { object2 = ((BVirtualGateway)bObject2).getVirtualSpace(); } else { object = BOrd.toSpace(bObject); if (object instanceof BComponentSpace) { object2 = (BComponentSpace)object; } } if (object2 == null) { return null; } componentSpaceItem.space = object2; return componentSpaceItem; } private final void resolveComponentSpaceGroup(ComponentSpaceGroup componentSpaceGroup, BObject bObject, Context context) { Class clazz; SlotPath[] slotPathArray; BComponentSpace bComponentSpace = componentSpaceGroup.space; ComponentSpaceItem[] componentSpaceItemArray = (ComponentSpaceItem[])componentSpaceGroup.items.trim(); Class clazz2 = class$javax$baja$naming$BatchResolve$ComponentSpaceItem; if (clazz2 == null) { clazz2 = class$javax$baja$naming$BatchResolve$ComponentSpaceItem = BatchResolve.class("[Ljavax.baja.naming.BatchResolve$ComponentSpaceItem;", false); } Array array = new Array(clazz2); int n = 0; while (n < componentSpaceItemArray.length) { slotPathArray = componentSpaceItemArray[n]; if (slotPathArray.slot != null) { slotPathArray.path = this.toSlotPath(slotPathArray.slot, bObject); } else { array.add((Object)slotPathArray); } ++n; } if (array.size() > 0) { Object[] objectArray = new Object[array.size()]; int n2 = 0; while (n2 < array.size()) { ComponentSpaceItem componentSpaceItem = (ComponentSpaceItem)array.get(n2); objectArray[n2] = componentSpaceItem.h.getBody(); ++n2; } slotPathArray = bComponentSpace.handlesToSlotPaths(objectArray); int n3 = 0; while (n3 < array.size()) { ComponentSpaceItem componentSpaceItem = (ComponentSpaceItem)array.get(n3); componentSpaceItem.path = slotPathArray[n3]; ++n3; } } if ((clazz = class$javax$baja$naming$SlotPath) == null) { clazz = class$javax$baja$naming$SlotPath = BatchResolve.class("[Ljavax.baja.naming.SlotPath;", false); } Array array2 = new Array(clazz); int n4 = 0; while (n4 < componentSpaceItemArray.length) { ComponentSpaceItem componentSpaceItem = componentSpaceItemArray[n4]; if (componentSpaceItem.path != null) { array2.add((Object)componentSpaceItem.path); } ++n4; } SlotPath[] slotPathArray2 = (SlotPath[])array2.trim(); bComponentSpace.fw(104, slotPathArray2, null, null, null); } SlotPath toSlotPath(OrdQuery ordQuery, BObject bObject) { SlotPath slotPath = null; boolean bl = ordQuery.getScheme().equals("virtual"); slotPath = bl ? new VirtualPath(ordQuery.getBody()) : new SlotPath(ordQuery.getBody()); if (slotPath.isAbsolute()) { return slotPath; } if (bObject instanceof BComponent && !bl) { SlotPath slotPath2 = ((BComponent)bObject).getSlotPath(); return slotPath2.merge(slotPath); } return null; } 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()); } } public BatchResolve(BOrd[] bOrdArray) { this.ords = (BOrd[])bOrdArray.clone(); this.results = new Result[bOrdArray.length]; int n = 0; while (n < this.results.length) { this.results[n] = new Result(); ++n; } } static class Result { OrdTarget target; Throwable exception; Result() { } } static class ComponentSpaceItem { BOrd ord; OrdQuery h; OrdQuery slot; BComponentSpace space; SlotPath path; ComponentSpaceItem(BOrd bOrd) { this.ord = bOrd; } } /* * Illegal identifiers - consider using --renameillegalidents true */ static class ComponentSpaceGroup { BComponentSpace space; Array items; static /* synthetic */ Class class$javax$baja$naming$BatchResolve$ComponentSpaceItem; 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 final /* synthetic */ void this() { Class clazz = class$javax$baja$naming$BatchResolve$ComponentSpaceItem; if (clazz == null) { clazz = class$javax$baja$naming$BatchResolve$ComponentSpaceItem = ComponentSpaceGroup.class("[Ljavax.baja.naming.BatchResolve$ComponentSpaceItem;", false); } this.items = new Array(clazz); } ComponentSpaceGroup(BComponentSpace bComponentSpace) { this.this(); this.space = bComponentSpace; } } }