Search in sources :

Example 6 with OffShoot

use of alma.ACS.OffShoot in project ACS by ACS-Community.

the class RequesterUtil method giveCBLong.

/**
	 * 
	 * @param cs
	 * @param x
	 * @return
	 * @throws AcsJContainerServicesEx
	 */
public static CBlong giveCBLong(ContainerServicesBase cs, ResponseReceiver<Integer> x) throws AcsJContainerServicesEx {
    CBlong ret;
    Objects.CBlongImpl cb = new Objects.CBlongImpl(x);
    OffShoot offshoot = cs.activateOffShoot(cb);
    ret = CBlongHelper.narrow(offshoot);
    return ret;
}
Also used : CBlong(alma.ACS.CBlong) OffShoot(alma.ACS.OffShoot)

Example 7 with OffShoot

use of alma.ACS.OffShoot in project ACS by ACS-Community.

the class RequesterUtil method giveCBLongSequence.

/**
	 * 
	 * @param cs
	 * @param x
	 * @return
	 * @throws AcsJContainerServicesEx
	 */
public static CBlongSeq giveCBLongSequence(ContainerServicesBase cs, ResponseReceiver<Integer[]> x) throws AcsJContainerServicesEx {
    CBlongSeq ret;
    Objects.CBlongSeqImpl cb = new Objects.CBlongSeqImpl(x);
    OffShoot offshoot = cs.activateOffShoot(cb);
    ret = CBlongSeqHelper.narrow(offshoot);
    return ret;
}
Also used : OffShoot(alma.ACS.OffShoot) CBlongSeq(alma.ACS.CBlongSeq)

Example 8 with OffShoot

use of alma.ACS.OffShoot in project ACS by ACS-Community.

the class RequesterUtil method giveCBDouble.

/**
	 * 
	 * @param cs
	 * @param x
	 * @return
	 * @throws AcsJContainerServicesEx
	 */
public static CBdouble giveCBDouble(ContainerServicesBase cs, ResponseReceiver<Double> x) throws AcsJContainerServicesEx {
    CBdouble ret;
    Objects.CBdoubleImpl cb = new Objects.CBdoubleImpl(x);
    OffShoot offshoot = cs.activateOffShoot(cb);
    ret = CBdoubleHelper.narrow(offshoot);
    return ret;
}
Also used : CBdouble(alma.ACS.CBdouble) OffShoot(alma.ACS.OffShoot)

Example 9 with OffShoot

use of alma.ACS.OffShoot in project ACS by ACS-Community.

the class OffShootMapper method translate.

@Override
public <T> Object translate(Object oldObject, T newObjectTemplate, Class<T> newObjectClass, ComponentInvocationHandler invHandler) throws DynWrapperException {
    Object ret = null;
    OffShoot s = m_offshootMap.get(oldObject);
    String helperClass = newObjectClass.getName() + "Helper";
    try {
        Class<?> clazz = Class.forName(helperClass);
        Method m = clazz.getMethod("narrow", org.omg.CORBA.Object.class);
        ret = m.invoke(clazz, s);
    } catch (Exception e) {
        m_logger.log(AcsLogLevel.NOTICE, "Error while narrowing offshoot CORBA object for returning, will return null");
    }
    return ret;
}
Also used : OffShoot(alma.ACS.OffShoot) Method(java.lang.reflect.Method)

Example 10 with OffShoot

use of alma.ACS.OffShoot in project ACS by ACS-Community.

the class MyTestCBvoid method testActivateOffShoot.

public void testActivateOffShoot() throws Exception {
    // activate callback object
    MyTestCBvoid cb = new MyTestCBvoid(m_logger);
    m_logger.info("MyTestCBvoid instantiated...");
    CBvoid cbvoid = alma.ACS.CBvoidHelper.narrow(getContainerServices().activateOffShoot(cb));
    m_logger.info("MyTestCBvoid activated.");
    // activate dal listener object
    m_logger.info("activating dal listener offshoot...");
    DALChangeListenerPOA dalListenerSrv = new MyTestDALChangeListener();
    OffShoot offshoot2 = getContainerServices().activateOffShoot(dalListenerSrv);
    DALChangeListener dalListenerRef = DALChangeListenerHelper.narrow(offshoot2);
    m_logger.info("done activating dal listener offshoot.");
    // check if dal listener works...
    m_logger.info("calling dal listener...");
    dalListenerRef.object_changed("happyCurl");
    m_logger.info("done calling dal listener.");
    // check if callback works...
    RWdouble brightness = null;
    Lamp lamp = LampHelper.narrow(getContainerServices().getComponent(m_lampCurl));
    assertNotNull("reference to Lamp component not null", lamp);
    brightness = lamp.brightness();
    assertNotNull("brightness property of lamp not null", brightness);
    CBDescIn desc = new CBDescIn();
    m_logger.info("m_desc instantiated...");
    m_logger.info("before setting callback...");
    brightness.set_async(7.345, cbvoid, desc);
    m_logger.finer("callback set...");
//todo: do something and get feedback from the callback object		
//		m_logger.finer("changing value (sync)...");
//		brightness.set_sync(8.456);
}
Also used : DALChangeListenerPOA(com.cosylab.CDB.DALChangeListenerPOA) RWdouble(alma.ACS.RWdouble) OffShoot(alma.ACS.OffShoot) DALChangeListener(com.cosylab.CDB.DALChangeListener) Lamp(alma.acsexmplLamp.Lamp) CBvoid(alma.ACS.CBvoid) CBDescIn(alma.ACS.CBDescIn)

Aggregations

OffShoot (alma.ACS.OffShoot)11 CBDescIn (alma.ACS.CBDescIn)2 CBstringSeq (alma.ACS.CBstringSeq)2 AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)2 Method (java.lang.reflect.Method)2 CBdouble (alma.ACS.CBdouble)1 CBdoubleSeq (alma.ACS.CBdoubleSeq)1 CBlong (alma.ACS.CBlong)1 CBlongSeq (alma.ACS.CBlongSeq)1 CBstring (alma.ACS.CBstring)1 CBvoid (alma.ACS.CBvoid)1 RWdouble (alma.ACS.RWdouble)1 ComponentInvocationHandler (alma.acs.component.dynwrapper.ComponentInvocationHandler)1 AcsJException (alma.acs.exceptions.AcsJException)1 Lamp (alma.acsexmplLamp.Lamp)1 DALChangeListener (com.cosylab.CDB.DALChangeListener)1 DALChangeListenerPOA (com.cosylab.CDB.DALChangeListenerPOA)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Servant (org.omg.PortableServer.Servant)1