Search in sources :

Example 6 with NamingContext

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

the class AlarmSystemContainerServices method createNotificationChannelPublisher.

@Override
public <T> AcsEventPublisher<T> createNotificationChannelPublisher(String channelName, String channelNotifyServiceDomainName, Class<T> eventType) throws AcsJContainerServicesEx {
    AcsEventPublisher<T> publisher = null;
    try {
        // TODO: try to get the naming service ref in a nicer way (from ORB etc)
        NamingContext namingService = Helper.getNamingServiceInitial(this);
        publisher = new NCPublisher<T>(channelName, channelNotifyServiceDomainName, this, namingService);
    } catch (Throwable e) {
        logger.log(AcsLogLevel.ERROR, "Unexpected error while creating new AcsEventPublisher object", e);
        AcsJContainerServicesEx ex = new AcsJContainerServicesEx(e);
        throw ex;
    }
    return publisher;
}
Also used : NamingContext(org.omg.CosNaming.NamingContext) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Example 7 with NamingContext

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

the class AlarmSystemCorbaServer method getNamingContext.

/**
	 * Get the {@link NamingContext}
	 * 
	 * @return The {@link NamingContext}
	 */
private NamingContext getNamingContext() throws InvalidName {
    org.omg.CORBA.Object obj = null;
    Properties props = System.getProperties();
    String nameServiceCorbaLoc = props.getProperty("ORBInitRef.NameService");
    if (nameServiceCorbaLoc != null) {
        obj = orb.string_to_object(nameServiceCorbaLoc);
    }
    if (obj == null) {
        obj = orb.resolve_initial_references("NameService");
    }
    if (obj == null) {
        throw new NullPointerException("Error getting the reference to the NameService");
    }
    NamingContext context = NamingContextExtHelper.narrow(obj);
    if (context == null) {
        throw new NullPointerException("Got a null NamingContext while narrowing");
    }
    return context;
}
Also used : Object(org.omg.CORBA.Object) Properties(java.util.Properties) NamingContext(org.omg.CosNaming.NamingContext)

Example 8 with NamingContext

use of org.omg.CosNaming.NamingContext 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 NamingContext

use of org.omg.CosNaming.NamingContext 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 NamingContext

use of org.omg.CosNaming.NamingContext 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

NamingContext (org.omg.CosNaming.NamingContext)24 NameComponent (org.omg.CosNaming.NameComponent)11 AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)4 Object (org.omg.CORBA.Object)4 Properties (java.util.Properties)3 CannotProceedException (javax.naming.CannotProceedException)3 NameNotFoundException (javax.naming.NameNotFoundException)3 NamingException (javax.naming.NamingException)3 NotFound (org.omg.CosNaming.NamingContextPackage.NotFound)3 POA (org.omg.PortableServer.POA)3 AcsORBProfilerImplBase (alma.acs.profiling.orb.AcsORBProfilerImplBase)2 FileWriter (java.io.FileWriter)2 PrintWriter (java.io.PrintWriter)2 NotContextException (javax.naming.NotContextException)2 AcsORBProfiler (org.jacorb.orb.acs.AcsORBProfiler)2 AcsProfilingORB (org.jacorb.orb.acs.AcsProfilingORB)2 ORB (org.omg.CORBA.ORB)2 CannotProceed (org.omg.CosNaming.NamingContextPackage.CannotProceed)2 InvalidName (org.omg.CosNaming.NamingContextPackage.InvalidName)2 AcsJBadParameterEx (alma.ACSErrTypeCommon.wrappers.AcsJBadParameterEx)1