protected void clearCache() { if (myContext != null) { myContext.fastCache.clear(); } if (grtrTree != null) { grtrTree.clearCache(); } if (lessTree != null){ lessTree.clearCache(); } if (subTree != null){ subTree.clearCache(); } }
public IvmContext createSubcontext(final ParsedName name) throws NameAlreadyBoundException { return createSubcontext(name, false); }
public JndiEncArtifact(final IvmContext context) { NameNode node = context.mynode; do { path = node.getAtomicName() + "/" + path; node = node.getParent(); } while (node != null); }
private boolean isMyChild(final NameNode parent, final NameNode node) { if (node.getParent() == parent) { return true; } /* * Handle the special case of the top-level contexts like global, module, app, etc */ if (null == node.getParent() && null == parent.getParentTree()) { return true; } return false; }
protected void gatherNodes(NameNode node, Vector vect) { if (node.getLessTree() != null) { vect.addElement(node.getLessTree()); gatherNodes(node.getLessTree(), vect); } if (node.getGrtrTree() != null) { vect.addElement(node.getGrtrTree()); gatherNodes(node.getGrtrTree(), vect); } }
protected void buildEnumeration(final Vector vect) { for (int i = 0; i < vect.size(); i++) { final NameNode node = (NameNode) vect.elementAt(i); final String className = node.getBinding().getClass().getName(); vect.setElementAt(new Binding(node.getAtomicName(), className, node.getBinding()), i); } myEnum = vect.elements(); }
if (subTree != null) { try { return subTree.resolve(name, createReadOnlyContext); } catch (final NameNotFoundException e) { n = e; return myContext.mynode.resolve(name, createReadOnlyContext); } catch (final NameNotFoundException e) { n = e; return getBinding(createReadOnlyContext); return lessTree.resolve(name, createReadOnlyContext); return grtrTree.resolve(name,createReadOnlyContext); final NameNode node = new NameNode(null, new ParsedName(""), f, null); return new IvmContext(node, createReadOnlyContext);
protected void gatherNodes(NameNode initiallyRequestedNode, final NameNode node, final Vector vect) { addInListIfNeeded(initiallyRequestedNode, node.getLessTree(), vect); addInListIfNeeded(initiallyRequestedNode, node.getGrtrTree(), vect); addInListIfNeeded(initiallyRequestedNode, node.getSubTree(), vect); if (NameNode.Federation.class.isInstance(initiallyRequestedNode.getObject())) { // tomcat mainly for (final Context c : NameNode.Federation.class.cast(initiallyRequestedNode.getObject())) { if (c == IvmContext.this || !IvmContext.class.isInstance(c)) { continue; } final IvmContext ctx = IvmContext.class.cast(c); if (ctx.mynode == node || vect.contains(ctx.mynode)) { continue; } addInListIfNeeded(ctx.mynode, ctx.mynode.getGrtrTree(), vect); addInListIfNeeded(ctx.mynode, ctx.mynode.getLessTree(), vect); addInListIfNeeded(ctx.mynode, ctx.mynode.getSubTree(), vect); } } }
public IvmContext createSubcontext(ParsedName name) throws javax.naming.NameAlreadyBoundException { try { bind(name, null); name.reset(); return (IvmContext) resolve(name); } catch (javax.naming.NameNotFoundException exception) { exception.printStackTrace(); throw new RuntimeException(exception); } }
public void unbind(String name) throws NamingException { checkReadOnly(); final int indx = name.indexOf(":"); if (indx > -1) { /* The ':' character will be in the path if its an absolute path name starting with the schema 'java:'. We strip the schema off the path before passing it to the node.resolve method. */ name = name.substring(indx + 1); } fastCache.clear(); mynode.clearCache(); mynode.unbind(new ParsedName(name)); }
subTree = new NameNode(this, name, obj, this); else subTree.bind(name, obj); } else { if (subTree != null) { lessTree = new NameNode(this.parent, name, obj, this); else lessTree.bind(name, obj); } else {//ParsedName.IS_GREATER ... grtrTree = new NameNode(this.parent, name, obj, this); else grtrTree.bind(name, obj);
compoundName = mynode.getAtomicName() + '/' + compositName; if (obj == null) { try { obj = mynode.resolve(new ParsedName(compoundName)); } catch (final NameNotFoundException nnfe) { obj = federate(compositName);
public IvmContext(final String nodeName) { this(new NameNode(null, new ParsedName(nodeName), null, null)); }
public Object resolve(ParsedName name) throws javax.naming.NameNotFoundException { int compareResult = name.compareTo(atomicHash); if (compareResult == ParsedName.IS_EQUAL && name.getComponent().equals(atomicName)) {// hashcodes and String valuse are equal if (name.next()) { if (subTree == null) throw new javax.naming.NameNotFoundException("Cannot resolve " + name); return subTree.resolve(name); } else if (unbound){ throw new javax.naming.NameNotFoundException("Cannot resolve " + name); } else { return getBinding(); } } else if (compareResult == ParsedName.IS_LESS) {// parsed hash is less than if (lessTree == null) throw new javax.naming.NameNotFoundException("Cannot resolve " + name); return lessTree.resolve(name); } else {//ParsedName.IS_GREATER if (grtrTree == null) throw new javax.naming.NameNotFoundException("Cannot resolve " + name); return grtrTree.resolve(name); } }
@Override public String toString() { return "IvmContext{" + "mynode=" + mynode.getAtomicName() + '}'; }
public Object getBinding() { return getBinding(false); }
protected void buildEnumeration(final Vector vect) { for (int i = 0; i < vect.size(); i++) { final NameNode node = (NameNode) vect.elementAt(i); final String className = node.getBinding().getClass().getName(); vect.setElementAt(new Binding(node.getAtomicName(), className, node.getBinding()), i); } myEnum = vect.elements(); }
if (subTree != null) { try { return subTree.resolve(name); } catch (final NameNotFoundException e) { n = e; return getBinding(); return lessTree.resolve(name); return grtrTree.resolve(name); final NameNode node = new NameNode(null, new ParsedName(""), f, null); return new IvmContext(node);