Search in sources :

Example 6 with DAL

use of com.cosylab.CDB.DAL 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 7 with DAL

use of com.cosylab.CDB.DAL in project ACS by ACS-Community.

the class FactoryTest method clearDalCache.

/**
	 * Clear the cache of the DAL
	 * @param contSvcs ContainerServices
	 * @throws Exception
	 */
private void clearDalCache(ContainerServices contSvcs) throws Exception {
    DAL dal = contSvcs.getCDB();
    jdal = JDALHelper.narrow(dal);
    if (jdal == null) {
        throw new Exception("Error narrowing the DAL");
    }
    jdal.clear_cache_all();
}
Also used : DAL(com.cosylab.CDB.DAL) JDAL(com.cosylab.CDB.JDAL)

Example 8 with DAL

use of com.cosylab.CDB.DAL in project ACS by ACS-Community.

the class ComponentClient method initAcs.

private void initAcs(String managerLoc, POA rootPOA) throws Exception {
    try {
        ManagerClient clImpl = new ManagerClient(m_clientName, m_logger) {

            public void disconnect() {
                m_logger.info("disconnected from manager");
                m_acsManagerProxy.logoutFromManager();
                m_acsManagerProxy = null;
                throw new RuntimeException("disconnected from the manager");
            }
        };
        m_managerClient = clImpl._this(acsCorba.getORB());
        m_acsManagerProxy = new AcsManagerProxy(managerLoc, acsCorba.getORB(), m_logger);
        m_acsManagerProxy.loginToManager(m_managerClient, 1);
        DAL cdb = DALHelper.narrow(m_acsManagerProxy.get_service("CDB", false));
        m_threadFactory = new CleaningDaemonThreadFactory(m_clientName, m_logger);
        m_containerServices = new ContainerServicesImpl(m_acsManagerProxy, cdb, rootPOA, acsCorba, m_logger, 0, m_clientName, null, m_threadFactory);
        clImpl.setContainerServices(m_containerServices);
        initAlarmSystem();
    } catch (Exception ex) {
        //										"or to set up the container services.", ex);
        if (acsCorba.getORB() != null) {
            acsCorba.getORB().destroy();
        }
        throw ex;
    }
}
Also used : ContainerServicesImpl(alma.acs.container.ContainerServicesImpl) CleaningDaemonThreadFactory(alma.acs.container.CleaningDaemonThreadFactory) DAL(com.cosylab.CDB.DAL) AcsManagerProxy(alma.acs.container.AcsManagerProxy)

Example 9 with DAL

use of com.cosylab.CDB.DAL in project ACS by ACS-Community.

the class MyTestCBvoid method testGetDAL.

public void testGetDAL() throws Exception {
    DAL dal = getContainerServices().getCDB();
    assertNotNull(dal);
    String managerDAOString = dal.get_DAO("MACI/Managers/Manager");
    assertNotNull(managerDAOString);
    m_logger.info("received manager DAO string from the CDB:\n" + managerDAOString);
}
Also used : DAL(com.cosylab.CDB.DAL)

Example 10 with DAL

use of com.cosylab.CDB.DAL in project ACS by ACS-Community.

the class DAOManager method backupCDB.

public void backupCDB() {
    DAL dal = null;
    WDAL wdal = null;
    try {
        dal = _contServ.getCDB();
    } catch (AcsJContainerServicesEx e) {
        return;
    }
    wdal = WDALHelper.narrow(dal);
    if (wdal == null)
        return;
    String src = "Alarms";
    String dst;
    int i = 1;
    do {
        dst = src + ".bkp." + i;
        i++;
    } while (nodeExists(wdal, "", dst));
    copyNode(wdal, src, dst);
}
Also used : WDAL(com.cosylab.CDB.WDAL) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx) DAL(com.cosylab.CDB.DAL) WDAL(com.cosylab.CDB.WDAL)

Aggregations

DAL (com.cosylab.CDB.DAL)13 AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)5 CleaningDaemonThreadFactory (alma.acs.container.CleaningDaemonThreadFactory)3 ContainerServicesImpl (alma.acs.container.ContainerServicesImpl)3 AcsManagerProxy (alma.acs.container.AcsManagerProxy)2 AcsLogger (alma.acs.logging.AcsLogger)2 Logger (java.util.logging.Logger)2 NamingException (javax.naming.NamingException)2 ORB (org.omg.CORBA.ORB)2 PropertyOperations (alma.ACS.PropertyOperations)1 AlarmSourceFactory (alma.acs.alarmsystem.source.AlarmSourceFactory)1 ComponentLifecycleException (alma.acs.component.ComponentLifecycleException)1 AcsCorba (alma.acs.container.corba.AcsCorba)1 AlarmSystemConfiguration (alma.alarmsystem.alarmmessage.generated.AlarmSystemConfiguration)1 ConfigurationProperty (alma.alarmsystem.alarmmessage.generated.ConfigurationProperty)1 JDAL (com.cosylab.CDB.JDAL)1 WDAL (com.cosylab.CDB.WDAL)1 StringReader (java.io.StringReader)1 ThreadFactory (java.util.concurrent.ThreadFactory)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1