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;
}
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;
}
}
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;
}
}
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);
}
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);
}
Aggregations