Search in sources :

Example 11 with AcsJContainerServicesEx

use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx 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 12 with AcsJContainerServicesEx

use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.

the class AlarmSystemContainerServices method getCDB.

@Override
public DAL getCDB() throws AcsJContainerServicesEx {
    try {
        org.omg.CORBA.Object dalObj = alSysCorbaServer.getServiceFromNameServer("CDB");
        DAL dal = DALHelper.narrow(dalObj);
        return dal;
    } catch (Throwable thr) {
        String msg = "Unexpectedly failed to get the CDB reference!";
        logger.log(Level.FINE, msg, thr);
        AcsJContainerServicesEx ex = new AcsJContainerServicesEx(thr);
        ex.setContextInfo(msg);
        throw ex;
    }
}
Also used : AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx) DAL(com.cosylab.CDB.DAL)

Example 13 with AcsJContainerServicesEx

use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.

the class AlarmSystemContainerServices method checkOffShootServant.

private void checkOffShootServant(Servant servant) throws AcsJContainerServicesEx {
    if (servant == null) {
        AcsJBadParameterEx cause = new AcsJBadParameterEx();
        cause.setParameter("servant");
        cause.setParameterValue("null");
        throw new AcsJContainerServicesEx(cause);
    }
    if (!(servant instanceof OffShootOperations)) {
        String msg = "invalid offshoot servant provided. Must implement " + OffShootOperations.class.getName();
        logger.fine(msg);
        AcsJContainerServicesEx ex = new AcsJContainerServicesEx();
        ex.setContextInfo(msg);
        throw ex;
    }
}
Also used : AcsJBadParameterEx(alma.ACSErrTypeCommon.wrappers.AcsJBadParameterEx) OffShootOperations(alma.ACS.OffShootOperations) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Example 14 with AcsJContainerServicesEx

use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.

the class SampTool method initializeComponents.

public static void initializeComponents() throws AcsJContainerEx, AcsInformationException {
    info = AcsInformation.getInstance(NAME);
    /* Get all component names and descriptors */
    List<String> listTmp = new ArrayList<String>();
    compList = info.getCManager().getComponentsName();
    cServices = info.getContainerServices();
    for (int i = 0; i < compList.length; i++) {
        try {
            ComponentDescriptor c = cServices.getComponentDescriptor(compList[i]);
            /* Check which of them are Sampling Managers */
            if (c.getType().equals(SAMP_MAN_IFACE)) {
                sampManList.add(c.getName());
                info.getContainerServices().getLogger().info("Found Sampling Manager " + c.getName());
            } else /* If they are not, then add them to the component list */
            {
                listTmp.add(compList[i]);
                cDescriptorList.add(c);
                propList.add(null);
            }
        } catch (AcsJContainerServicesEx e) {
            e.getMessage();
        }
    }
    compList = new String[listTmp.size()];
    compList = listTmp.toArray(compList);
    Arrays.sort(compList);
}
Also used : ComponentDescriptor(alma.acs.component.ComponentDescriptor) ArrayList(java.util.ArrayList) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Example 15 with AcsJContainerServicesEx

use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.

the class BlobberImpl method initialize.

//////////////////////////////////////
///////// ComponentLifecycle /////////
//////////////////////////////////////
/**
	 * Initializes the component: creates the BlobberPlugin and the BlobberWorker objects.
	 * <p>
	 * Raises an alarm (FF="Monitoring", FM="MonitorArchiver", FC="2") if initialization fails.
	 * This makes sense because the blobber runs as an autostart component, and the manager being 
	 * the client that activates this blobber would not know the alarm details. 
	 * @TODO: Shouldn't we use a FM specific to this blobber instance? 
	 * 
	 * @see alma.acs.component.ComponentImplBase#initialize(alma.acs.container.ContainerServices)
	 */
@Override
public void initialize(ContainerServices inContainerServices) throws ComponentLifecycleException {
    long now = System.nanoTime();
    componentActivationStartNanos = now;
    super.initialize(inContainerServices);
    componentActivationTimesNanosMap.put("super init", System.nanoTime() - now);
    now = System.nanoTime();
    alarmSource = inContainerServices.getAlarmSource();
    // clear alarm that might have been left active from a previous run
    // @TODO use component-specific alarm triplet
    alarmSource.clearAlarm("Monitoring", "MonitorArchiver", 2);
    componentActivationTimesNanosMap.put("alarm init", System.nanoTime() - now);
    try {
        now = System.nanoTime();
        blobberPlugin = createBlobberPlugin();
        componentActivationTimesNanosMap.put("plugin creation", System.nanoTime() - now);
        now = System.nanoTime();
        blobberPlugin.init();
        componentActivationTimesNanosMap.put("plugin init", System.nanoTime() - now);
        collectorIntervalSec = blobberPlugin.getCollectorIntervalSec();
        m_logger.finer("Instantiated blobber plugin object.");
        // Create the blobber runnable (worker)
        now = System.nanoTime();
        this.myWorker = createWorker();
        componentActivationTimesNanosMap.put("worker creation", System.nanoTime() - now);
        m_logger.finer("Instantiated blobber worker object.");
    } catch (AcsJCouldntCreateObjectEx ex) {
        alarmSource.raiseAlarm("Monitoring", "MonitorArchiver", 2);
        throw new ComponentLifecycleException(ex);
    }
    // In case this blobber is restarting after a shutdown while collectors were still assigned, 
    // we ask the controller to add these otherwise lost collectors.
    ControllerOperations controller = null;
    now = System.nanoTime();
    try {
        controller = ControllerHelper.narrow(m_containerServices.getDefaultComponent("IDL:alma/MonitorArchiver/Controller:1.0"));
        controller.registerKnownCollectors(name());
        m_logger.finer("Requested monitor controller to re-register collectors.");
    } catch (AcsJContainerServicesEx ex1) {
        throw new ComponentLifecycleException("Failed to get ARCHIVE_CONTROLLER instance.", ex1);
    } finally {
        if (controller != null) {
            m_containerServices.releaseComponent(controller.name(), null);
        }
    }
    componentActivationTimesNanosMap.put("controller handshake", System.nanoTime() - now);
}
Also used : AcsJCouldntCreateObjectEx(alma.ACSErrTypeCommon.wrappers.AcsJCouldntCreateObjectEx) ComponentLifecycleException(alma.acs.component.ComponentLifecycleException) ControllerOperations(alma.MonitorArchiver.ControllerOperations) AcsJContainerServicesEx(alma.JavaContainerError.wrappers.AcsJContainerServicesEx)

Aggregations

AcsJContainerServicesEx (alma.JavaContainerError.wrappers.AcsJContainerServicesEx)51 AcsJBadParameterEx (alma.ACSErrTypeCommon.wrappers.AcsJBadParameterEx)10 AcsJException (alma.acs.exceptions.AcsJException)6 AcsJmaciErrTypeEx (alma.maciErrType.wrappers.AcsJmaciErrTypeEx)6 ComponentDescriptor (alma.acs.component.ComponentDescriptor)5 DAL (com.cosylab.CDB.DAL)5 ComponentLifecycleException (alma.acs.component.ComponentLifecycleException)4 ComponentInfo (si.ijs.maci.ComponentInfo)4 OffShootOperations (alma.ACS.OffShootOperations)3 AcsJIllegalArgumentEx (alma.ACSErrTypeCommon.wrappers.AcsJIllegalArgumentEx)3 EntityT (alma.entities.commonentity.EntityT)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 Any (org.omg.CORBA.Any)3 NamingContext (org.omg.CosNaming.NamingContext)3 Servant (org.omg.PortableServer.Servant)3 OffShoot (alma.ACS.OffShoot)2 AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)2 AcsJContainerEx (alma.JavaContainerError.wrappers.AcsJContainerEx)2 ComponentClient (alma.acs.component.client.ComponentClient)2 AcsManagerProxy (alma.acs.container.AcsManagerProxy)2