Search in sources :

Example 41 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)

Example 42 with ORB

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

the class JconttestUtil method getSystemLevelOrbTimeoutMillis.

/**
	 * We get the timeout property value from the ORB configuration.
	 * System-level timeout defaults are not standardized in Corba, thus we need jacorb-specific access.
	 * @throws IllegalArgumentException if the ORB timeout is configured as a negative value
	 * @throws AcsJCouldntPerformActionEx if the ORB-level timeout could not be read, e.g. because the ORB is not jacorb.
	 */
public int getSystemLevelOrbTimeoutMillis() throws AcsJCouldntPerformActionEx {
    int orbLevelTimeout = -1;
    ORB orb = containerServices.getAdvancedContainerServices().getORB();
    if (orb instanceof org.jacorb.orb.ORB) {
        try {
            orbLevelTimeout = ((org.jacorb.orb.ORB) orb).getConfiguration().getAttributeAsInteger(PROPERTYNAME_CLIENTORBTIMEOUT);
            if (orbLevelTimeout < 0) {
                throw new IllegalArgumentException("system-level roundtrip timeout must be non-negative!");
            }
        } catch (ConfigurationException e) {
            logger.log(Level.SEVERE, "Failed to read the system-level ORB timeout setting.", e);
            throw new AcsJCouldntPerformActionEx();
        }
    } else {
        logger.log(Level.SEVERE, "Wrong ORB " + orb.getClass().getName());
        throw new AcsJCouldntPerformActionEx();
    }
    return orbLevelTimeout;
}
Also used : ConfigurationException(org.jacorb.config.ConfigurationException) AcsJCouldntPerformActionEx(alma.ACSErrTypeCommon.wrappers.AcsJCouldntPerformActionEx) ORB(org.omg.CORBA.ORB)

Example 43 with ORB

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

the class ServicesDaemonTest method getServicesDaemon.

private ServicesDaemon getServicesDaemon(String host) {
    String daemonLoc = AcsLocations.convertToServicesDaemonLocation(host);
    assertNotNull("corbaloc for service daemon must not be null", daemonLoc);
    logger.fine("Using services daemon corbaloc " + daemonLoc);
    ORB orb = acsCorba.getORB();
    assertNotNull("ORB provided by inherited acsCorba must not be null", daemonLoc);
    org.omg.CORBA.Object obj = orb.string_to_object(daemonLoc);
    ServicesDaemon ret = null;
    try {
        ret = ServicesDaemonHelper.narrow(obj);
    } catch (TRANSIENT ex) {
        fail("Failed to get reference to services daemon '" + daemonLoc + "' because of TRANSIENT ex");
    }
    assertNotNull("Corba ref to services daemon must not be null", ret);
    return ret;
}
Also used : ServicesDaemon(alma.acsdaemon.ServicesDaemon) TRANSIENT(org.omg.CORBA.TRANSIENT) ORB(org.omg.CORBA.ORB)

Example 44 with ORB

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

the class JNDIContextFactory method getInitialContext.

/**
	 * @see InitialContextFactory#getInitialContext(Hashtable)
	 */
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));
    JNDIContext.setOrb(orb);
    JNDIContext.setDal(dal);
    //System.out.println( "Returning CDBContext" );
    Logger logger = ClientLogManager.getAcsLogManager().getLoggerForApplication(Server.CDB_LOGGER_NAME, true);
    return new JNDIContext("", dal.list_nodes(""), logger);
}
Also used : NamingException(javax.naming.NamingException) Logger(java.util.logging.Logger) ORB(org.omg.CORBA.ORB) DAL(com.cosylab.CDB.DAL)

Example 45 with ORB

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

the class CharacteristicModelImpl method get_all_characteristics.

/**
	 * @see alma.ACS.CharacteristicModelOperations#get_all_characteristics()
	 */
public PropertySet get_all_characteristics() {
    String[] allSeq;
    try {
        if (prefix == "")
            allSeq = dao.get_string_seq("");
        else
            allSeq = dao.get_string_seq(prefix);
        Property[] p = new Property[allSeq.length];
        for (int i = 0; i < allSeq.length; i++) {
            Any a = get_characteristic_by_name(allSeq[i]);
            p[i] = new Property(allSeq[i], a);
        }
        //dangerous methods!! 
        ORB orb = m_container.getAdvancedContainerServices().getORB();
        POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
        rootpoa.the_POAManager().activate();
        PropertySetImpl psetImpl = new PropertySetImpl(p);
        PropertySetPOATie psetTie = new PropertySetPOATie(psetImpl, rootpoa);
        return psetTie._this(orb);
    } catch (CDBFieldDoesNotExistEx e) {
    } catch (WrongCDBDataTypeEx e) {
    } catch (NoSuchCharacteristic e) {
    } catch (MultipleExceptions e) {
    } catch (InvalidName e) {
    } catch (AdapterInactive e) {
    } catch (NullPointerException e) {
        System.out.println(e);
    }
    throw new NO_IMPLEMENT();
}
Also used : NO_IMPLEMENT(org.omg.CORBA.NO_IMPLEMENT) POA(org.omg.PortableServer.POA) NoSuchCharacteristic(alma.ACS.NoSuchCharacteristic) AdapterInactive(org.omg.PortableServer.POAManagerPackage.AdapterInactive) Any(org.omg.CORBA.Any) PropertySetImpl(alma.ACS.jbaci.PropertySetImpl) PropertySetPOATie(org.omg.CosPropertyService.PropertySetPOATie) InvalidName(org.omg.CORBA.ORBPackage.InvalidName) CDBFieldDoesNotExistEx(alma.cdbErrType.CDBFieldDoesNotExistEx) MultipleExceptions(org.omg.CosPropertyService.MultipleExceptions) Property(org.omg.CosPropertyService.Property) ORB(org.omg.CORBA.ORB) WrongCDBDataTypeEx(alma.cdbErrType.WrongCDBDataTypeEx)

Aggregations

ORB (org.omg.CORBA.ORB)51 POA (org.omg.PortableServer.POA)11 Properties (java.util.Properties)7 NamingException (javax.naming.NamingException)6 AcsProfilingORB (org.jacorb.orb.acs.AcsProfilingORB)6 Logger (java.util.logging.Logger)5 StartException (org.jboss.msc.service.StartException)5 ManagerImpl (com.cosylab.acs.maci.manager.ManagerImpl)3 IOException (java.io.IOException)3 Monitorlong (alma.ACS.Monitorlong)2 PostInitLoader (com.arjuna.orbportability.internal.utils.PostInitLoader)2 DAL (com.cosylab.CDB.DAL)2 HandleDataStore (com.cosylab.acs.maci.manager.HandleDataStore)2 FileWriter (java.io.FileWriter)2 PrintWriter (java.io.PrintWriter)2 MalformedURLException (java.net.MalformedURLException)2 ArrayList (java.util.ArrayList)2 CannotProceedException (javax.naming.CannotProceedException)2 ConfigurationException (javax.naming.ConfigurationException)2 InitialContext (javax.naming.InitialContext)2