001/*
002# Licensed Materials - Property of IBM
003# Copyright IBM Corp. 2016 
004 */
005package com.ibm.streamsx.iot.spl;
006
007import static com.ibm.streams.operator.Type.Factory.getStreamSchema;
008import static com.ibm.streams.operator.Type.MetaType.RSTRING;
009import static com.ibm.streamsx.topology.spl.SPLSchemas.JSON;
010
011import com.ibm.streams.operator.StreamSchema;
012import com.ibm.streamsx.topology.spl.SPLSchemas;
013
014/**
015 * SPL schemas for {@code com.ibm.streamsx.iot} toolkit.
016 *
017 */
018public class Schemas {
019    public static final String JSON_STRING = SPLSchemas.JSON.getAttribute(0).getName();
020
021    public static final String TYPE_ID = "typeId"; //$NON-NLS-1$
022    public static final String DEVICE_ID = "deviceId"; //$NON-NLS-1$
023    
024    public static final String EVENT_ID = "eventId"; //$NON-NLS-1$
025    public static final String CMD_ID = "cmdId"; //$NON-NLS-1$
026
027
028    /**
029     * A device. Matches {@code com.ibm.streamsx.iot::Device}.
030     */
031    public static final StreamSchema DEVICE = getStreamSchema("tuple<rstring typeId, rstring deviceId>"); //$NON-NLS-1$
032
033    /**
034     * A device event. Matches {@code com.ibm.streamsx.iot::DeviceEvent}.
035     */
036    public static final StreamSchema DEVICE_EVENT = DEVICE.extend(RSTRING.getLanguageType(), EVENT_ID)
037            .extendBySchemas(JSON);
038
039    /**
040     * A device command. Matches {@code com.ibm.streamsx.iot::DeviceCmd}.
041     */
042    public static final StreamSchema DEVICE_CMD = DEVICE.extend(RSTRING.getLanguageType(), CMD_ID)
043            .extendBySchemas(JSON);
044    
045    /**
046     * A device status. Matches {@code com.ibm.streamsx.iot::DeviceStatus}.
047     */
048    public static final StreamSchema DEVICE_STATUS = DEVICE.extendBySchemas(JSON);
049
050}