Search in sources :

Example 96 with Any

use of org.omg.CORBA.Any in project ACS by ACS-Community.

the class AlarmSystemAdvancedContainerServices method getAny.

@Override
public Any getAny() {
    ORB orb = getORB();
    org.omg.CORBA.Any any = orb.create_any();
    if (any == null) {
        // should never happen, but we check just in case, 
        // since there is a difficult to verify NPE when Any is created by MC for sending alarms.
        String msg = "Failed to create org.omg.CORBA.Any";
        logger.warning(msg);
        throw new NullPointerException(msg);
    }
    return any;
}
Also used : Any(org.omg.CORBA.Any) ORB(org.omg.CORBA.ORB)

Example 97 with Any

use of org.omg.CORBA.Any in project ACS by ACS-Community.

the class LaserComponent method fromBusinessAlarm.

/**
	 * Helper method which converts EJB business Alarm to CORBA Alarm structure.
	 * @param alarm
	 * @return
	 */
private Alarm fromBusinessAlarm(cern.laser.business.data.Alarm alarm) {
    cern.laser.business.data.Triplet bt = alarm.getTriplet();
    cern.laser.business.data.Location bl = alarm.getLocation();
    if (bl.getBuilding() == null) {
        bl.setBuilding(new Building("", "", 1, ""));
    }
    cern.laser.business.data.Status bs = alarm.getStatus();
    // Build the properties
    Property[] props;
    if (alarm.getStatus().getProperties() != null) {
        props = new Property[alarm.getStatus().getProperties().size()];
        Set keys = alarm.getStatus().getProperties().keySet();
        int t = 0;
        for (Object key : keys) {
            String name = (String) key;
            String value = alarm.getStatus().getProperties().getProperty(name);
            Any any = corbaServer.getORB().create_any();
            any.insert_string(value);
            props[t++] = new Property(name, any);
        }
    } else {
        props = new Property[0];
    }
    Alarm newAlarm = new Alarm(alarm.getAlarmId(), new Triplet(bt.getFaultFamily(), bt.getFaultMember(), bt.getFaultCode().intValue()), getString(alarm.getSystemName()), getString(alarm.getIdentifier()), getString(alarm.getProblemDescription()), alarm.getPriority().intValue(), getString(alarm.getCause()), getString(alarm.getAction()), getString(alarm.getConsequence()), fromBusinessSource(alarm.getSource()), getString(alarm.getHelpURL().toExternalForm()), getString(alarm.getPiquetGSM()), getString(alarm.getPiquetEmail()), fromBusinessResponsiblePerson(alarm.getResponsiblePerson()), new Location(bl.getLocationId(), bl.getFloor(), bl.getRoom(), bl.getPosition(), bl.getMnemonic(), bl.getBuilding().getBuildingNumber(), bl.getBuilding().getSite(), bl.getBuilding().getZone().intValue(), bl.getBuilding().getMap()), fromBusinessCategoryCollection(alarm.getCategories()), new Status(bs.getActive().booleanValue(), bs.getMasked().booleanValue(), bs.getReduced().booleanValue(), new Timestamp(bs.getSourceTimestamp().getTime(), bs.getSourceTimestamp().getNanos()), bs.getSourceHostname(), new Timestamp(bs.getUserTimestamp().getTime(), bs.getUserTimestamp().getNanos()), new Timestamp(bs.getSystemTimestamp().getTime(), bs.getSystemTimestamp().getNanos()), props), alarm.getInstant().booleanValue(), alarm.hasNodeParents(), alarm.hasMultiplicityParents(), alarm.hasNodeChildren(), alarm.hasMultiplicityChildren());
    return newAlarm;
}
Also used : Building(cern.laser.business.data.Building) Status(alma.alarmsystem.Status) Set(java.util.Set) Triplet(alma.alarmsystem.Triplet) Any(org.omg.CORBA.Any) Timestamp(alma.alarmsystem.Timestamp) Alarm(alma.alarmsystem.Alarm) Property(org.omg.CosPropertyService.Property) Location(alma.alarmsystem.Location)

Example 98 with Any

use of org.omg.CORBA.Any in project cxf by apache.

the class CorbaConduit method getArguments.

public NVList getArguments(CorbaMessage message) {
    if (orb == null) {
        prepareOrb();
    }
    // Build the list of DII arguments, returns, and exceptions
    NVList list = null;
    if (message.getStreamableArguments() != null) {
        CorbaStreamable[] arguments = message.getStreamableArguments();
        list = orb.create_list(arguments.length);
        for (CorbaStreamable argument : arguments) {
            Any value = CorbaAnyHelper.createAny(orb);
            argument.getObject().setIntoAny(value, argument, true);
            list.add_value(argument.getName(), value, argument.getMode());
        }
    } else {
        list = orb.create_list(0);
    }
    return list;
}
Also used : NVList(org.omg.CORBA.NVList) Any(org.omg.CORBA.Any)

Example 99 with Any

use of org.omg.CORBA.Any in project cxf by apache.

the class CorbaConduit method getReturn.

public NamedValue getReturn(CorbaMessage message) {
    if (orb == null) {
        prepareOrb();
    }
    CorbaStreamable retVal = message.getStreamableReturn();
    NamedValue ret = null;
    if (retVal != null) {
        Any returnAny = CorbaAnyHelper.createAny(orb);
        retVal.getObject().setIntoAny(returnAny, retVal, false);
        ret = orb.create_named_value(retVal.getName(), returnAny, org.omg.CORBA.ARG_OUT.value);
    } else {
        // for some reason, some ORBs do not like to
        // have a null NamedValue return value. Create this 'empty'
        // one if a void return type is used.
        ret = orb.create_named_value("return", orb.create_any(), org.omg.CORBA.ARG_OUT.value);
    }
    return ret;
}
Also used : NamedValue(org.omg.CORBA.NamedValue) Any(org.omg.CORBA.Any)

Example 100 with Any

use of org.omg.CORBA.Any in project cxf by apache.

the class CorbaStreamInInterceptor method prepareDIIArgsList.

protected NVList prepareDIIArgsList(CorbaMessage corbaMsg, BindingOperationInfo boi, CorbaStreamable[] streamables, List<ParamType> paramTypes, CorbaTypeMap map, ORB orb, ServiceInfo service) {
    try {
        // Build the list of DII arguments, returns, and exceptions
        NVList list = orb.create_list(streamables.length);
        OperationInfo opInfo = boi.getOperationInfo();
        MessageInfo input = opInfo.getInput();
        MessageInfo output = opInfo.getOutput();
        String inWrapNSUri = null;
        String outWrapNSUri = null;
        boolean wrap = false;
        if (boi.isUnwrappedCapable()) {
            wrap = true;
            if (input != null) {
                inWrapNSUri = getWrappedParamNamespace(input);
                if (!CorbaUtils.isElementFormQualified(service, inWrapNSUri)) {
                    inWrapNSUri = "";
                }
            }
            if (output != null) {
                outWrapNSUri = getWrappedParamNamespace(output);
                if (!CorbaUtils.isElementFormQualified(service, outWrapNSUri)) {
                    outWrapNSUri = "";
                }
            }
        }
        int inMsgIndex = 0;
        int outMsgIndex = 0;
        for (int i = 0; i < paramTypes.size(); i++) {
            ParamType param = paramTypes.get(i);
            QName paramIdlType = param.getIdltype();
            QName paramName;
            ModeType paramMode = param.getMode();
            if (paramMode.value().equals("in")) {
                if (wrap) {
                    paramName = new QName(inWrapNSUri, param.getName());
                } else {
                    paramName = getMessageParamQName(input, param.getName(), inMsgIndex);
                    inMsgIndex++;
                }
            } else {
                if (wrap) {
                    paramName = new QName(outWrapNSUri, param.getName());
                } else {
                    paramName = getMessageParamQName(output, param.getName(), outMsgIndex);
                    outMsgIndex++;
                }
            }
            CorbaObjectHandler obj = CorbaHandlerUtils.initializeObjectHandler(orb, paramName, paramIdlType, map, service);
            streamables[i] = corbaMsg.createStreamableObject(obj, paramName);
            Any value = CorbaAnyHelper.createAny(orb);
            if (paramMode.value().equals("in")) {
                streamables[i].setMode(org.omg.CORBA.ARG_IN.value);
                streamables[i].getObject().setIntoAny(value, streamables[i], false);
            } else if (paramMode.value().equals("out")) {
                streamables[i].setMode(org.omg.CORBA.ARG_OUT.value);
                streamables[i].getObject().setIntoAny(value, streamables[i], true);
            } else {
                streamables[i].setMode(org.omg.CORBA.ARG_INOUT.value);
                streamables[i].getObject().setIntoAny(value, streamables[i], false);
            }
            list.add_value(streamables[i].getName(), value, streamables[i].getMode());
            corbaMsg.addStreamableArgument(streamables[i]);
        }
        return list;
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo) QName(javax.xml.namespace.QName) Any(org.omg.CORBA.Any) Endpoint(org.apache.cxf.endpoint.Endpoint) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType) MessageInfo(org.apache.cxf.service.model.MessageInfo) BindingMessageInfo(org.apache.cxf.service.model.BindingMessageInfo) ModeType(org.apache.cxf.binding.corba.wsdl.ModeType) CorbaObjectHandler(org.apache.cxf.binding.corba.types.CorbaObjectHandler) NVList(org.omg.CORBA.NVList)

Aggregations

Any (org.omg.CORBA.Any)107 MonitorBlob (alma.TMCDB.MonitorBlob)20 MonitorDataBlock (alma.TMCDB.MonitorDataBlock)20 ComponentData (alma.acs.monitoring.DAO.ComponentData)15 ServiceContext (org.omg.IOP.ServiceContext)13 BAD_PARAM (org.omg.CORBA.BAD_PARAM)10 SASContextBody (org.omg.CSI.SASContextBody)10 AcsJException (alma.acs.exceptions.AcsJException)9 Test (org.junit.Test)9 Description (org.omg.CORBA.ContainedPackage.Description)9 FormatMismatch (org.omg.IOP.CodecPackage.FormatMismatch)8 TypeMismatch (org.omg.IOP.CodecPackage.TypeMismatch)8 ContainedOperations (org.omg.CORBA.ContainedOperations)7 NVList (org.omg.CORBA.NVList)7 InvalidTypeForEncoding (org.omg.IOP.CodecPackage.InvalidTypeForEncoding)7 TMCDB.doubleBlobData (alma.TMCDB.doubleBlobData)6 TMCDB.doubleSeqBlobData (alma.TMCDB.doubleSeqBlobData)6 TMCDB.floatBlobData (alma.TMCDB.floatBlobData)6 MonitorPointTimeSeries (alma.acs.monitoring.MonitorPointTimeSeries)6 MonitorPointValue (alma.acs.monitoring.MonitorPointValue)6