use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.
the class ContainerServicesImpl method getCollocatedComponent.
public org.omg.CORBA.Object getCollocatedComponent(ComponentQueryDescriptor spec, boolean markAsDefaul, String targetCompUrl) throws AcsJContainerServicesEx {
if (spec == null) {
AcsJBadParameterEx cause = new AcsJBadParameterEx();
cause.setParameter("ComponentQueryDescriptor");
cause.setParameterValue("null");
throw new AcsJContainerServicesEx(cause);
}
if (targetCompUrl == null) {
AcsJBadParameterEx cause = new AcsJBadParameterEx();
cause.setParameter("targetCompUrl");
cause.setParameterValue("null");
throw new AcsJContainerServicesEx(cause);
}
ComponentInfo cInfo = null;
try {
// the call
cInfo = m_acsManagerProxy.get_collocated_component(getEffectiveClientHandle(), spec.toComponentSpec(), false, targetCompUrl);
} catch (AcsJmaciErrTypeEx ex) {
String msg = "Failed to retrieve component '" + spec.getComponentName() + "' created such that it runs collocated with '" + targetCompUrl + "'.";
// it's serious, but the caller is supposed to log this. Container only logs just in case.
m_logger.log(Level.FINE, msg, ex);
throw new AcsJContainerServicesEx(ex);
} catch (Throwable thr) {
String msg = "Unexpectedly failed to retrieve component '" + spec.getComponentName() + "' created such that it runs collocated with '" + targetCompUrl + "'.";
m_logger.log(Level.FINE, msg, thr);
AcsJContainerServicesEx ex = new AcsJContainerServicesEx(thr);
ex.setContextInfo(msg);
throw ex;
}
// @todo check and remove this
if (cInfo.reference == null) {
String msg = "Failed to retrieve component '" + spec.getComponentName() + "' created such that it runs collocated with '" + targetCompUrl + "'.";
m_logger.info(msg);
AcsJContainerServicesEx ex = new AcsJContainerServicesEx();
ex.setContextInfo(msg);
throw ex;
}
m_usedComponentsMap.put(cInfo.name, cInfo.reference);
m_componentDescriptorMap.put(cInfo.name, new ComponentDescriptor(cInfo));
return cInfo.reference;
}
use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.
the class ContainerServicesImpl method checkOffShoot.
/**
* @param cbServant
* @throws ContainerException
*/
private void checkOffShoot(Object 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();
m_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 ContainerServicesImpl method getDynamicComponent.
/**
* @see alma.acs.container.ContainerServices#getDynamicComponent(si.ijs.maci.ComponentSpec, boolean)
*/
public org.omg.CORBA.Object getDynamicComponent(ComponentSpec compSpec, boolean markAsDefault) throws AcsJContainerServicesEx {
String entryMsg = "getDynamicComponent called with" + " compName=" + compSpec.component_name + " compType=" + compSpec.component_type + " compCode=" + compSpec.component_code + " compContainer=" + compSpec.container_name + " markAsDefault=" + markAsDefault;
m_logger.fine(entryMsg);
ComponentInfo cInfo = null;
try {
// the call
cInfo = m_acsManagerProxy.get_dynamic_component(getEffectiveClientHandle(), compSpec, markAsDefault);
m_usedComponentsMap.put(cInfo.name, cInfo.reference);
m_componentDescriptorMap.put(cInfo.name, new ComponentDescriptor(cInfo));
} catch (AcsJmaciErrTypeEx ex) {
m_logger.log(Level.FINE, "Failed to create dynamic component", ex);
throw new AcsJContainerServicesEx(ex);
} catch (Throwable thr) {
String msg = "Unexpectedly failed to create dynamic component for unexpected reasons!";
m_logger.log(Level.FINE, msg, thr);
AcsJContainerServicesEx ex = new AcsJContainerServicesEx(thr);
ex.setContextInfo(msg);
throw ex;
}
return cInfo.reference;
}
use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.
the class ContainerServicesImpl method findComponents.
/**
* @see alma.acs.container.ContainerServices#findComponents(java.lang.String, java.lang.String)
*/
@Override
public String[] findComponents(String curlWildcard, String typeWildcard) throws AcsJContainerServicesEx {
if (curlWildcard == null) {
curlWildcard = "*";
}
if (typeWildcard == null) {
typeWildcard = "*";
}
String msgSpec = "curlWildcard='" + curlWildcard + "' and typeWildcard='" + typeWildcard + "'.";
if (m_logger.isLoggable(Level.FINER)) {
m_logger.finer("about to call Manager#get_component_info with " + msgSpec);
}
ComponentInfo[] components = null;
try {
components = m_acsManagerProxy.get_component_info(new int[0], curlWildcard, typeWildcard, false);
} catch (AcsJNoPermissionEx ex) {
m_logger.log(Level.FINE, "No permission to find components with " + msgSpec, ex);
AcsJContainerServicesEx ex2 = new AcsJContainerServicesEx(ex);
ex2.setContextInfo(msgSpec);
throw ex2;
} catch (Throwable thr) {
m_logger.log(Level.FINE, "Unexpected failure calling 'get_component_info' with " + msgSpec, thr);
AcsJContainerServicesEx ex = new AcsJContainerServicesEx(thr);
ex.setContextInfo(msgSpec);
throw ex;
}
ArrayList<String> curls = new ArrayList<String>();
if (components != null) {
for (int i = 0; i < components.length; i++) {
curls.add(components[i].name);
}
}
if (m_logger.isLoggable(Level.FINER)) {
m_logger.finer("received " + curls.size() + " curls from get_component_info.");
}
return curls.toArray(new String[curls.size()]);
}
use of alma.JavaContainerError.wrappers.AcsJContainerServicesEx in project ACS by ACS-Community.
the class SimpleSupplierReconnClient method createPublisherAndSubscriber.
public void createPublisherAndSubscriber() {
try {
m_client = new ComponentClient(m_logger, System.getProperty("ACS.manager"), "SimpleSupplierReconnClient");
m_publisher = m_client.getContainerServices().createNotificationChannelPublisher(CHANNEL_NAME, IDLEntity.class);
((NCPublisher) m_publisher).setAutoreconnect(m_autoreconnect);
m_publisher.enableEventQueue(100, m_cbObj);
//m_publisher.setAutoreconnect(m_autoreconnect);
} catch (AcsJContainerServicesEx e) {
// Silently ignore the errors
} catch (AcsJException e) {
// Shouldn't happen
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations