Java Code Examples for org.omg.CosNaming.NamingContextExt

The following examples show how to use org.omg.CosNaming.NamingContextExt. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: cxf   Source File: OrbConfig.java    License: Apache License 2.0 6 votes vote down vote up
public void exportObjectReferenceToNamingService(ORB orb,
                                                 org.omg.CORBA.Object ref,
                                                 String location) {
    int idx = location.indexOf('#');
    String name = location.substring(idx + 1);

    //Register in NameService
    try {
        org.omg.CORBA.Object nsObj = orb.resolve_initial_references("NameService");
        NamingContextExt rootContext = NamingContextExtHelper.narrow(nsObj);
        NameComponent[] nc = rootContext.to_name(name);
        rootContext.rebind(nc, ref);
    } catch (Exception ex) {
        throw new CorbaBindingException(ex);
    }
}
 
Example 2
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 3
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 4
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 5
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 6
Source Project: jdk8u60   Source File: INSURLOperationImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 7
Source Project: jdk8u60   Source File: INSURLOperationImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 8
Source Project: JDKSourceCode1.8   Source File: INSURLOperationImpl.java    License: MIT License 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 9
Source Project: JDKSourceCode1.8   Source File: INSURLOperationImpl.java    License: MIT License 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 10
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 11
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 12
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 13
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 14
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 15
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 16
Source Project: hottub   Source File: INSURLOperationImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 17
Source Project: hottub   Source File: INSURLOperationImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 18
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 19
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 20
/**
 *  resolves a corbaname: url that is encapsulated in a CorbanameURL object.
 *
 *  @return the CORBA.Object if resolution is successful
 */
private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
    org.omg.CORBA.Object result = null;

    try {
        NamingContextExt theNamingContext = null;

        if( theCorbaName.getRIRFlag( ) ) {
            // Case 1 of corbaname: rir#
            theNamingContext = getDefaultRootNamingContext( );
        } else {
            // Case 2 of corbaname: ::hostname#
            org.omg.CORBA.Object corbalocResult =
                getIORUsingCorbaloc( theCorbaName );
            if( corbalocResult == null ) {
                return null;
            }

            theNamingContext =
                NamingContextExtHelper.narrow( corbalocResult );
        }

        String StringifiedName = theCorbaName.getStringifiedName( );

        if( StringifiedName == null ) {
            // This means return the Root Naming context
            return theNamingContext;
        } else {
            return theNamingContext.resolve_str( StringifiedName );
        }
    } catch( Exception e ) {
        clearRootNamingContextCache( );
        return null;
    }
 }
 
Example 21
/**
 *  This is required for corbaname: resolution. Currently we
 *  are not caching RootNamingContext as the reference to rootNamingContext
 *  may not be Persistent in all the implementations.
 *  _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE.
 *
 *  @return the org.omg.COSNaming.NamingContextExt if resolution is
 *   successful
 *
 */
private NamingContextExt getDefaultRootNamingContext( ) {
    synchronized( rootContextCacheLock ) {
        if( rootNamingContextExt == null ) {
            try {
                rootNamingContextExt =
                    NamingContextExtHelper.narrow(
                    orb.getLocalResolver().resolve( "NameService" ) );
            } catch( Exception e ) {
                rootNamingContextExt = null;
            }
        }
    }
    return rootNamingContextExt;
}
 
Example 22
Source Project: cxf   Source File: Server.java    License: Apache License 2.0 5 votes vote down vote up
static int run(ORB orb, String[] args) throws UserException {
    //
    // Resolve Root POA
    //
    POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

    //
    // Get a reference to the POA manager
    //
    POAManager manager = poa.the_POAManager();

    //
    // Create implementation object
    //
    BankImpl bankImpl = new BankImpl(poa);

    byte[] oid = "Bank".getBytes();
    poa.activate_object_with_id(oid, bankImpl);

    org.omg.CORBA.Object ref = poa.create_reference_with_id(oid, BankHelper.id());

    // Register in NameService
    org.omg.CORBA.Object nsObj = orb.resolve_initial_references("NameService");
    NamingContextExt rootContext = NamingContextExtHelper.narrow(nsObj);
    NameComponent[] nc = rootContext.to_name("Bank");
    rootContext.rebind(nc, ref);

    //
    // Run implementation
    //
    manager.activate();
    System.out.println("Server ready...");
    orb.run();

    return 0;
}
 
Example 23
Source Project: cxf   Source File: Server.java    License: Apache License 2.0 5 votes vote down vote up
static int run(ORB orb, String[] args) throws UserException {
    // Resolve Root POA
    POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

    // Get a reference to the POA manager
    POAManager manager = poa.the_POAManager();

    // Create implementation object
    HelloWorldImpl hwImpl = new HelloWorldImpl(poa);

    byte[] oid = "HelloWorld".getBytes();
    poa.activate_object_with_id(oid, hwImpl);

    org.omg.CORBA.Object ref = poa.create_reference_with_id(oid, HelloWorldHelper.id());

    // Register in NameService
    org.omg.CORBA.Object nsObj = orb.resolve_initial_references("NameService");
    NamingContextExt rootContext = NamingContextExtHelper.narrow(nsObj);
    NameComponent[] nc = rootContext.to_name("HelloWorld");
    rootContext.rebind(nc, ref);

    // Run implementation
    manager.activate();
    System.out.println("Server ready...");
    orb.run();

    return 0;
}