Search in sources :

Example 6 with NameComponent

use of org.omg.CosNaming.NameComponent in project ACS by ACS-Community.

the class Helper method destroyNotificationChannel.

/**
	 * <b>Destroys the channel and unregisters it from the naming service. ONLY
	 * USE THIS METHOD IF YOU KNOW FOR CERTAIN THERE IS ONLY ONE SUPPLIER FOR THE
	 * CHANNEL!!! Use this method with extreme caution as it's likely to become
	 * deprecated in future versions of ACS!</b>
	 * 
	 * @param channelName
	 *           name of the channel as registered int the CORBA notification
	 *           service
	 * @param channelKind
	 *           Kind of the channel as registered with the CORBA naming service.
	 * @param channelRef
	 *           reference to the channel being destroyed. 
	 *           Here we use the plain OMG type instead of the TAO extension subtype, because the extensions are 
	 *           not used for channel destruction.
	 * @throws AcsJException
	 *            Thrown when the channel isn't registered with the Naming
	 *            Service.
	 * @warning this method assumes
	 */
protected void destroyNotificationChannel(String channelKind, org.omg.CosNotifyChannelAdmin.EventChannel channelRef) throws AcsJException {
    try {
        // destroy the remote CORBA object
        channelRef.destroy();
        // unregister our channel with the naming service
        NameComponent[] t_NameChannel = { new NameComponent(combineChannelAndDomainName(channelName, domainName), channelKind) };
        getNamingService().unbind(t_NameChannel);
    } catch (org.omg.CosNaming.NamingContextPackage.NotFound e) {
        // Think there is virtually no chance of this every happening but...
        String msg = "Cannot unbind the '" + channelName + "' channel from the Naming Service!";
        m_logger.severe(msg);
    } catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e) {
        // Think there is virtually no chance of this every happening but...
        Throwable cause = new Throwable(e.getMessage());
        throw new alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx(cause);
    } catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) {
        // Think there is virtually no chance of this every happening but...
        Throwable cause = new Throwable(e.getMessage());
        throw new alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx(cause);
    }
    // TODO use notif.service name 
    LOG_NC_ChannelDestroyed_OK.log(m_logger, channelName, "");
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) AcsJCORBAProblemEx(alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)

Example 7 with NameComponent

use of org.omg.CosNaming.NameComponent in project ACS by ACS-Community.

the class HelperTest method setUp.

protected void setUp() throws Exception {
    System.out.println("------------------------- " + getName() + " -------------------------");
    super.setUp();
    nctx = NamingContextHelper.narrow(m_acsManagerProxy.get_service(NAMING_SERVICE_NAME.value, false));
    String factoryMonitorRegName = "MC_NotifyEventChannelFactory";
    try {
        nsmc = NotificationServiceMonitorControlHelper.narrow(nctx.resolve(new NameComponent[] { new NameComponent("MC_NotifyEventChannelFactory", "") }));
    } catch (NotFound ex) {
        fail("Failed to resolve factory's MC extension object in the naming service: " + factoryMonitorRegName + ". This is a recurrent problem, probably linked to the missing line 'ReBound ID: MC_NotifyEventChannelFactory' in ./tmp/acsStart.log.");
    }
    assertNotNull(nsmc);
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) NotFound(org.omg.CosNaming.NamingContextPackage.NotFound)

Example 8 with NameComponent

use of org.omg.CosNaming.NameComponent in project ACS by ACS-Community.

the class AlarmSystemCorbaServer method unregisterToNamingService.

/**
     * Unregister the AlarmService name to the Naming Service.
     * <P>
     * The name to unregister is taken from the IDL interface.
     */
private void unregisterToNamingService() throws Exception {
    String name = alma.alarmsystem.AlarmServiceName.value;
    m_logger.log(AcsLogLevel.DEBUG, "Unregistering " + name + " from the naming service");
    NamingContext context = getNamingContext();
    NameComponent[] nameComponent = new NameComponent[1];
    nameComponent[0] = new NameComponent(name, "");
    context.unbind(nameComponent);
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) NamingContext(org.omg.CosNaming.NamingContext)

Example 9 with NameComponent

use of org.omg.CosNaming.NameComponent in project ACS by ACS-Community.

the class AlarmSystemCorbaServer method getCDB.

/**
	 * Get a reference to the DAL.
	 * 
	 * @return The DAL
	 * @throws Exception In case of error getting the DAL
	 */
private DAL getCDB() throws Exception {
    NamingContext context = getNamingContext();
    NameComponent[] nameCom = new NameComponent[1];
    nameCom[0] = new NameComponent("CDB", "");
    Object obj = context.resolve(nameCom);
    return DALHelper.narrow(obj);
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) Object(org.omg.CORBA.Object) NamingContext(org.omg.CosNaming.NamingContext)

Example 10 with NameComponent

use of org.omg.CosNaming.NameComponent in project ACS by ACS-Community.

the class AlarmSystemCorbaServer method registerToNamingService.

/**
     * Register the AlarmService name to the Naming Service.
     * <P>
     * The name to register is taken from the IDL interface.
     * 
     * @param laserObject The CORBA object to bind to the name
     */
private void registerToNamingService(org.omg.CORBA.Object laserObject) throws Exception {
    String name = alma.alarmsystem.AlarmServiceName.value;
    m_logger.log(AcsLogLevel.DEBUG, "Registering into the naming service with name " + name);
    NamingContext context = getNamingContext();
    NameComponent[] nameComponent = new NameComponent[1];
    nameComponent[0] = new NameComponent(name, "");
    context.rebind(nameComponent, laserObject);
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) NamingContext(org.omg.CosNaming.NamingContext)

Aggregations

NameComponent (org.omg.CosNaming.NameComponent)34 NamingContext (org.omg.CosNaming.NamingContext)12 NotFound (org.omg.CosNaming.NamingContextPackage.NotFound)10 InvalidName (org.omg.CosNaming.NamingContextPackage.InvalidName)9 CannotProceed (org.omg.CosNaming.NamingContextPackage.CannotProceed)8 AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)3 NamingException (javax.naming.NamingException)3 AcsJUnexpectedExceptionEx (alma.ACSErrTypeCommon.wrappers.AcsJUnexpectedExceptionEx)2 EventChannel (gov.sandia.NotifyMonitoringExt.EventChannel)2 FileWriter (java.io.FileWriter)2 PrintWriter (java.io.PrintWriter)2 Properties (java.util.Properties)2 CannotProceedException (javax.naming.CannotProceedException)2 Name (javax.naming.Name)2 NameNotFoundException (javax.naming.NameNotFoundException)2 ORB (org.omg.CORBA.ORB)2 Object (org.omg.CORBA.Object)2 AlreadyBound (org.omg.CosNaming.NamingContextPackage.AlreadyBound)2 POA (org.omg.PortableServer.POA)2 AcsJNarrowFailedEx (alma.ACSErrTypeCORBA.wrappers.AcsJNarrowFailedEx)1