Create a state

@param clazz
@param field
@param device
@param businessObject
@throws DevFailed
342336
public void build(final Class<?> clazz, final Field field, final DeviceImpl device, final Object businessObject)
            throws DevFailed {
        xlogger.entry();
        BuilderUtils.checkStatic(field);
        Method getter;
        final String stateName = field.getName();
        final String getterName = BuilderUtils.GET + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH)
                + stateName.substring(1);
        try {
            getter = clazz.getMethod(getterName);
        } catch (final NoSuchMethodException e) {
            throw DevFailedUtils.newDevFailed(e);
        }
        if (getter.getParameterTypes().length != 0) {
            throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must not have a parameter");
        }

        logger.debug("Has an state : {}", field.getName());
        if (getter.getReturnType() != DeviceState.class && getter.getReturnType() != DevState.class) {
            throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must have a return type of  "
                    + DeviceState.class.getCanonicalName() + " or " + DevState.class.getCanonicalName());
        }
        Method setter;
        final String setterName = BuilderUtils.SET + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH)
                + stateName.substring(1);
        try {
            setter = clazz.getMethod(setterName, DeviceState.class);
        } catch (final NoSuchMethodException e) {
            try {
                setter = clazz.getMethod(setterName, DevState.class);
            } catch (final NoSuchMethodException e1) {
                throw DevFailedUtils.newDevFailed(e1);
            }
        }
        device.setStateImpl(new StateImpl(businessObject, getter, setter));
        final State annot = field.getAnnotation(State.class);
        if (annot.isPolled()) {
            device.addAttributePolling(DeviceImpl.STATE_NAME, annot.pollingPeriod());
        }
        xlogger.exit();
    }
453302
public void putPipeProperty(ArrayList<DbPipe> dbPipes) throws DevFailed {
        for (DbPipe dbPipe : dbPipes) database.putDevicePipeProperty(deviceName, dbPipe);
    }
672910
public void put_device_attribute_property(String devname, DbAttribute[] attr) throws DevFailed {
		databaseDAO.put_device_attribute_property(this, devname, attr);
	}
322399
@Command(name = STATE_NAME, outTypeDesc = "Device state")
    public DevState executeStateCmd() throws DevFailed {
        MDC.setContextMap(contextMap);
        xlogger.entry();
        xlogger.exit();
        return getState();
    }
154615
public int write_attribute_asynch(final DeviceProxy deviceProxy, final DeviceAttribute attr)
            throws DevFailed {
        return write_attribute_asynch(deviceProxy, attr, false);
    }
837171
public void write_asynch(DeviceAttribute attr, CallBack cb)  throws DevFailed {
        dev.write_attribute_asynch(attr, cb);
    }
1103944
public void insert(final Object value) throws DevFailed {
        for (int i = 0; i < group.get_size(true); i++) {
            final int arginType = group.get_device(i + 1).command_query(commandName).in_type;
            InsertExtractUtils.insert(inData[i], arginType, value);
        }
    }
579132
@Override
    public void exportDevice(final DeviceExportInfo info) throws DevFailed {
        final String[] array = info.toStringArray();
        final DeviceData argin = new DeviceData();
        argin.insert(array);
        database.command_inout("DbExportDevice", argin);
    }
574783
public synchronized void statusMachine(final String status, final DeviceState state) throws DevFailed {
        if (status != null) {
            logger.debug("Changing status to: {}", status);
            this.status = status;
            if (setStatusMethod != null) {
                try {
                    setStatusMethod.invoke(businessObject, status);
                } catch (final IllegalArgumentException e) {
                    throw DevFailedUtils.newDevFailed(e);
                } catch (final IllegalAccessException e) {
                    throw DevFailedUtils.newDevFailed(e);
                } catch (final InvocationTargetException e) {
                    if (e.getCause() instanceof DevFailed) {
                        throw (DevFailed) e.getCause();
                    } else {
                        throw DevFailedUtils.newDevFailed(e.getCause());
                    }
                }
            }
        }
    }
1101138
public void write_attribute_asynch(DeviceAttribute[] attribs, CallBack cb) throws DevFailed {
        deviceProxyDAO.write_attribute_asynch(this, attribs, cb);
    }
576220
public void write_attribute_asynch(final DeviceProxy deviceProxy, final DeviceAttribute attr,
	    final CallBack cb) throws DevFailed {
        final DeviceAttribute[] attribs = new DeviceAttribute[1];
        attribs[0] = attr;
        write_attribute_asynch(deviceProxy, attribs, cb);
    }
284275
public void restart_server() throws DevFailed {
        Util.out4.println("In DServer.restart_server() method");

        //
        // Reset initial state and status
        //

        set_state(DevState.ON);
        set_status("The device is ON");

        //
        // Destroy and recreate the muli attribute object
        //

        final MultiAttribute tmp = new MultiAttribute(device_name, get_device_class());
        set_device_attr(tmp);

        //
        // Deleting the dserver device is a specific case. We must also delete
        // all
        // TDSOM embedded in this server
        //

        if (class_list.isEmpty() == false) {

            //
            // Destroy already registered classes, devices and commands
            // To destroy already created devices, we must disconnect them from
            // the ORB
            // otherwise their reference count will never decrease to 0 and the
            // object will
            // not be eligable for garbage collection.
            //

            final int nb_class = class_list.size();
            final POA r_poa = Util.instance().get_poa();
            for (int j = 0; j < nb_class; j++) {
                final Vector v = ((DeviceClass) class_list.elementAt(j)).get_device_list();
                final int nb_dev = v.size();

                for (int k = 0; k < nb_dev; k++) {
                    final DeviceImpl dev = (DeviceImpl) v.elementAt(k);
                    if (dev.get_exported_flag() == true) {
                        dev.delete_device();
                        try {
                            r_poa.deactivate_object(((DeviceImpl) v.elementAt(k)).get_obj_id());
                        } catch (final WrongPolicy ex) {
                            ex.printStackTrace();
                        } catch (final ObjectNotActive ex) {
                            ex.printStackTrace();
                        }
                    }
                }
                v.removeAllElements();
                ((DeviceClass) class_list.elementAt(j)).initClass();
            }
            class_list.removeAllElements();
            System.out.println("DServer.restart_server - class list " + class_list);

        }

        // Restart everything
        init_device();

        // Restart polling (if any)
        Util.instance().polling_configure();
    }
394043
public Any execute(DeviceImpl device, Any in_any) throws DevFailed
	{
		Util.out4.println("StartLoggingCmd::execute(): arrived");
    
    Logging.instance().start_logging();

		Util.out4.println("Leaving StartLoggingCmd.execute()");	
    
    return Util.return_empty_any("StartLogging");
	}
1280737
private static void exportDeviceWithDatabase(final DeviceImpl dev, final String hostName, final String pid)
            throws DevFailed {
        XLOGGER.entry(dev.getName());

        final ORB orb = ORBManager.getOrb();
        // Activate the CORBA object incarnated by the Java object
        final Device_5 d = dev._this(orb);

        // Get the object id and store it

        final POA poa = ORBManager.getPoa();

        try {
            dev.setObjId(poa.reference_to_id(d));
        } catch (final WrongAdapter e) {
            throw DevFailedUtils.newDevFailed(e);
        } catch (final WrongPolicy e) {
            throw DevFailedUtils.newDevFailed(e);
        }

        final DeviceExportInfo info = new DeviceExportInfo(dev.getName(), orb.object_to_string(d), hostName,
                Integer.toString(DeviceImpl.SERVER_VERSION), pid, dev.getClassName());
        DatabaseFactory.getDatabase().exportDevice(info);

        XLOGGER.exit();
    }
1305692
public Any execute(DeviceImpl device, Any in_any) throws DevFailed
	{

		Util.out4.println("RemObjPollingCmd.execute(): arrived ");

		// Call the device method and return to caller
		String[] argin = extract_DevVarStringArray(in_any);
		((DServer)(device)).rem_obj_polling(argin);
		return insert();
	}
209778
public void put_property(DbDatum[] properties)
            throws DevFailed {
        DbAttribute db_att = new DbAttribute(deviceName);
        Collections.addAll(db_att, properties);
        dev.put_attribute_property(db_att);
    }
554361
public void write_attribute_asynch(final DeviceProxy deviceProxy,
	    final DeviceAttribute[] attribs, final CallBack cb) throws DevFailed {
        final int id = write_attribute_asynch(deviceProxy, attribs);
        ApiUtil.set_async_reply_model(id, CALLBACK);
        ApiUtil.set_async_reply_cb(id, cb);

        // if push callback, start a thread to do it
        if (ApiUtil.get_asynch_cb_sub_model() == PUSH_CALLBACK) {
            final AsyncCallObject aco = ApiUtil.get_async_object(id);
            new CallbackThread(aco).start();
        }
    }