Search in sources :

Example 56 with ORB

use of org.omg.CORBA.ORB in project ACS by ACS-Community.

the class BrowserJNDIContextFactory method getInitialContext.

/**
     * An initial context factory (JNDI_ContextFactory)  must implement the InitialContextFactory interface, which
     * provides a method for creating instances of initial context that implement the Context interface
    */
public Context getInitialContext(Hashtable environment) throws NamingException {
    String strIOR = (String) environment.get(Context.PROVIDER_URL);
    if (strIOR == null)
        throw new NamingException("There is no " + Context.PROVIDER_URL + " property set!");
    // try to get the server
    // create and initialize the ORB
    String[] argv = {};
    ORB orb = ORB.init(argv, null);
    DAL dal = DALHelper.narrow(orb.string_to_object(strIOR));
    BrowserJNDIContext.setOrb(orb);
    BrowserJNDIContext.setDal(dal);
    String rootElements = dal.list_nodes("");
    //Returns the first level of the CDBTree (possible: "alma MACI schema CVS")
    try {
        //remove 'CVS' and 'schema' from Root
        rootElements = rootElements.replaceAll("CVS", "");
        rootElements = rootElements.replaceAll("schemas", "");
    } catch (PatternSyntaxException e) {
    } catch (NullPointerException e) {
    }
    Logger logger = ClientLogManager.getAcsLogManager().getLoggerForApplication("cdbBrowser", false);
    //JNDI_Context implements Context	    
    return new BrowserJNDIContext("", rootElements, logger);
}
Also used : NamingException(javax.naming.NamingException) Logger(java.util.logging.Logger) ORB(org.omg.CORBA.ORB) DAL(com.cosylab.CDB.DAL) PatternSyntaxException(java.util.regex.PatternSyntaxException)

Example 57 with ORB

use of org.omg.CORBA.ORB in project ACS by ACS-Community.

the class AlarmSystemCorbaServer method run.

/**
	 * Main thread to handle CORBA requests.
	 * 
	 * @see java.lang.Runnable#run()
	 */
public void run() {
    ORB localORBRef = orb;
    if (!destroyState && localORBRef != null) {
        localORBRef.run();
    }
    m_logger.log(AcsLogLevel.DEBUG, "ORB thread terminated");
}
Also used : ORB(org.omg.CORBA.ORB) AcsProfilingORB(org.jacorb.orb.acs.AcsProfilingORB)

Example 58 with ORB

use of org.omg.CORBA.ORB in project ACS by ACS-Community.

the class AlarmServiceUtils method initORB.

/**
	 * Instantiate the ORB
	 * 
	 * @return the ORB
	 */
private ORB initORB() {
    // ORB stanza
    java.util.Properties orbprops = java.lang.System.getProperties();
    ORB theORB = ORB.init(new String[0], orbprops);
    // POA stanza -- use RootPOA
    POA rootPOA = null;
    try {
        rootPOA = POAHelper.narrow(theORB.resolve_initial_references("RootPOA"));
    } catch (org.omg.CORBA.ORBPackage.InvalidName in) {
        throw new IllegalStateException("Cannot resolve RootPOA: " + in);
    }
    POAManager poaManager = rootPOA.the_POAManager();
    try {
        poaManager.activate();
    } catch (Exception e) {
        throw new IllegalStateException("POAManager activation failed." + e);
    }
    return theORB;
}
Also used : POA(org.omg.PortableServer.POA) POAManager(org.omg.PortableServer.POAManager) ORB(org.omg.CORBA.ORB) InvalidName(org.omg.CORBA.ORBPackage.InvalidName)

Example 59 with ORB

use of org.omg.CORBA.ORB in project ACS by ACS-Community.

the class AdvancedContainerServicesImpl method corbaObjectFromString.

/* (non-Javadoc)
	 * @see alma.acs.container.ContainerServices#corbaObjectFromString(java.lang.String)
	 */
public org.omg.CORBA.Object corbaObjectFromString(String strObjRef) {
    ORB orb = getORB();
    org.omg.CORBA.Object objRef = orb.string_to_object(strObjRef);
    logger.finer("converted corba object reference string " + strObjRef + " back to a corba object reference.");
    return objRef;
}
Also used : ORB(org.omg.CORBA.ORB)

Example 60 with ORB

use of org.omg.CORBA.ORB in project ACS by ACS-Community.

the class AdvancedContainerServicesImpl method getAny.

/**
     * Returns a reference to a new CORBA Any. In Java the only way to do 
     * this is through the ORB itself (i.e., the create_any method).
     * @return org.omg.CORBA.Any 
     * @throws NullPointerException if the Any object could not be created.
     */
public org.omg.CORBA.Any getAny() {
    ORB orb = getORB();
    org.omg.CORBA.Any any = orb.create_any();
    if (any == null) {
        // should never happen, but we check just in case, 
        // since there is a difficult to verify NPE when Any is created by MC for sending alarms.
        String msg = "Failed to create org.omg.CORBA.Any";
        logger.warning(msg);
        throw new NullPointerException(msg);
    }
    return any;
}
Also used : ORB(org.omg.CORBA.ORB)

Aggregations

ORB (org.omg.CORBA.ORB)73 POA (org.omg.PortableServer.POA)12 Properties (java.util.Properties)10 NamingException (javax.naming.NamingException)8 Test (org.junit.Test)7 AcsProfilingORB (org.jacorb.orb.acs.AcsProfilingORB)6 IOException (java.io.IOException)5 Logger (java.util.logging.Logger)5 HashMap (java.util.HashMap)4 StartException (org.jboss.msc.service.StartException)4 Any (org.omg.CORBA.Any)4 ManagerImpl (com.cosylab.acs.maci.manager.ManagerImpl)3 FileWriter (java.io.FileWriter)3 PrintWriter (java.io.PrintWriter)3 MessageImpl (org.apache.cxf.message.MessageImpl)3 Monitorlong (alma.ACS.Monitorlong)2 DAL (com.cosylab.CDB.DAL)2 HandleDataStore (com.cosylab.acs.maci.manager.HandleDataStore)2 OutputStream (java.io.OutputStream)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2