Search in sources :

Example 1 with INTERNAL

use of org.omg.CORBA.INTERNAL in project wildfly by wildfly.

the class CorbaNamingContext method list.

public void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi) {
    if (this.destroyed)
        return;
    Binding[] result;
    this.cleanup();
    int size = how_many();
    Iterator<Name> names = this.names.keySet().iterator();
    Iterator<Name> contexts = this.contexts.keySet().iterator();
    if (how_many < size) {
        // counter for copies
        int how_many_ctr = how_many;
        // set up an array with "how_many" bindings
        result = new Binding[how_many];
        for (; names.hasNext() && how_many_ctr > 0; how_many_ctr--) result[how_many_ctr - 1] = new Binding((names.next()).components(), BindingType.nobject);
        for (; contexts.hasNext() && how_many_ctr > 0; how_many_ctr--) result[how_many_ctr - 1] = new Binding((contexts.next()).components(), BindingType.ncontext);
        // create a new BindingIterator for the remaining arrays
        size -= how_many;
        Binding[] rest = new Binding[size];
        for (; names.hasNext() && size > 0; size--) rest[size - 1] = new Binding((names.next()).components(), BindingType.nobject);
        for (; contexts.hasNext() && size > 0; size--) rest[size - 1] = new Binding((contexts.next()).components(), BindingType.ncontext);
        org.omg.CORBA.Object o;
        try {
            // Iterators are activated with the RootPOA (transient)
            byte[] oid = rootPoa.activate_object(new BindingIteratorImpl(rest));
            o = rootPoa.id_to_reference(oid);
        } catch (Exception e) {
            IIOPLogger.ROOT_LOGGER.logInternalError(e);
            throw new INTERNAL(e.toString());
        }
        bi.value = BindingIteratorHelper.narrow(o);
    } else {
        result = new Binding[size];
        for (; names.hasNext() && size > 0; size--) result[size - 1] = new Binding((names.next()).components(), BindingType.nobject);
        for (; contexts.hasNext() && size > 0; size--) result[size - 1] = new Binding((contexts.next()).components(), BindingType.ncontext);
    }
    bl.value = result;
}
Also used : Binding(org.omg.CosNaming.Binding) INTERNAL(org.omg.CORBA.INTERNAL) IOException(java.io.IOException) InvalidName(org.omg.CosNaming.NamingContextPackage.InvalidName)

Aggregations

IOException (java.io.IOException)1 INTERNAL (org.omg.CORBA.INTERNAL)1 Binding (org.omg.CosNaming.Binding)1 InvalidName (org.omg.CosNaming.NamingContextPackage.InvalidName)1