Export a server into the tango db (execute DbUnExportServer on DB device)

@param serverName
The server name
@throws DevFailed
173706
@Override
    public void unexportServer(final String serverName) throws DevFailed {
        final DeviceData argin = new DeviceData();
        argin.insert(serverName);
        database.command_inout("DbUnExportServer", argin);
    }
529162
private void connect(DeviceProxy deviceProxy, String attributeName,
                         String eventName, DeviceData deviceData) throws DevFailed {
        String deviceName = deviceProxy.fullName();
        int tangoVersion = deviceData.extractLongStringArray().lvalue[0];
        try {
            String adminName = deviceProxy.adm_name();  //.toLowerCase();
            //  Since Tango 8.1, heartbeat is sent in lower case.
            //tangoVersion = new DeviceProxy(adm_name).getTangoVersion();
            if (tangoVersion>=810)
                adminName = adminName.toLowerCase();

            // If no connection exists to this channel, create it
            Database database = null;
            if (!channel_map.containsKey(adminName)) {
                if (deviceProxy.use_db())
                    database = deviceProxy.get_db_obj();
                ConnectionStructure connectionStructure =
                        new ConnectionStructure(deviceProxy.get_tango_host(),
                                adminName, deviceName, attributeName,
                                eventName, database, deviceData, false);
                connect_event_channel(connectionStructure);
            } else if (deviceProxy.use_db()) {
                database = deviceProxy.get_db_obj();
                ZMQutils.connectEvent(deviceProxy.get_tango_host(), deviceName,
                        attributeName, deviceData.extractLongStringArray(), eventName,false);
            }
            EventChannelStruct eventChannelStruct = channel_map.get(adminName);
            eventChannelStruct.adm_device_proxy =  new DeviceProxy(adminName);
            eventChannelStruct.use_db = deviceProxy.use_db();
            eventChannelStruct.dbase = database;
            eventChannelStruct.setTangoRelease(tangoVersion);

            device_channel_map.put(deviceName, adminName);
        }
        catch (DevFailed e) {
            Except.throw_event_system_failed("API_BadConfigurationProperty",
                    "Can't subscribe to event for device " + deviceName
                            + "\n Check that device server is running...",
                    "ZmqEventConsumer.connect");
        }
    }
797833
public void add_server(String servname, DbDevInfo[] devinfo) throws DevFailed {
		databaseDAO.add_server(this, servname, devinfo);
	}
129034
public void init(final Connection connection) throws DevFailed {
		// Check Tango Host Properties (host name, port number)
		// ------------------------------------------------------------
		connection.url = new TangoUrl();
		connection.setDevice_is_dbase(true);
		connection.transparent_reconnection = true; // Always true for Database
		//connection.url.trace();

		ApiUtil.get_orb();
		connect_to_dbase(connection);
		connection.devname = connection.device.name();
		connection.setAlready_connected(true);
    }
252069
public void init(Database database, String host, String port) throws DevFailed {
        super.init(database, host, port);
    }
681148
public Database set_db_obj(final String tango_host) throws DevFailed {
	final int i = tango_host.indexOf(":");
	if (i <= 0) {
	    Except.throw_connection_failed("TangoApi_TANGO_HOST_NOT_SET",
		    "Cannot parse port number", "ApiUtil.set_db_obj()");
	}
	return change_db_obj(tango_host.substring(0, i), tango_host.substring(i + 1));
    }
1346300
public void init(final Connection connection, final String host, final String port)
	    	throws DevFailed {
		connection.url = new TangoUrl(buildUrlName(TangoUrl.getCanonicalName(host), port));
		connection.setDevice_is_dbase(true);
		connection.transparent_reconnection = true; // Always true for Database

		ApiUtil.get_orb();
		connect_to_dbase(connection);
		connection.devname = connection.device.name();
		connection.setAlready_connected(true);
    }
1277215
public void stop() throws DevFailed {
        try {
            if (isStarted.get()) {
                tangoClasses.clear();
                if (tangoExporter != null) {
                    tangoExporter.clearClass();
                    tangoExporter.unexportAll();
                }
                TangoCacheManager.shutdown();
                EventManager.getInstance().close();
                if (monitoring != null) {
                    monitoring.stop();
                }
            }
        } finally {
            ORBManager.shutdown();
            logger.info("everything has been shutdown normally");
            isStarted.set(false);
        }
    }
95846
public DbDevImportInfo import_device(Database database, String deviceName)
            throws DevFailed {
        DevVarLongStringArray info;

        //	ALWAYS Authorized (e.g. import TAC itself)
        int tmp_access = database.access;
        database.access = TangoConst.ACCESS_WRITE;
        try {
            DeviceData argIn = new DeviceData();
            argIn.insert(deviceName);
            //System.out.println("DbImportDevice " + deviceName);
            DeviceData argOut = command_inout(database, "DbImportDevice", argIn);
            info = argOut.extractLongStringArray();
            database.access = tmp_access;
        } catch (DevFailed e) {
            database.access = tmp_access;
            throw e;
        }
        return new DbDevImportInfo(info);
    }
1259922
public void add_device(Database database, String deviceName, String classname, String serverName)
            throws DevFailed {
        if (!database.isAccess_checked()) checkAccess(database);

        DbDevInfo devinfo = new DbDevInfo(deviceName, classname, serverName);
        DeviceData argIn = new DeviceData();
        argIn.insert(devinfo.toStringArray());
        command_inout(database, "DbAddDevice", argIn);
        //System.out.println(devinfo.name + " created");
    }
1093632
public void add_device(String devname, String classname, String servname) throws DevFailed {
		databaseDAO.add_device(this, devname, classname, servname);
    }
1274076
public String[] get_device_name(Database database, String serverName, String classname)
            throws DevFailed {
        if (!database.isAccess_checked()) checkAccess(database);

        String[] array;
        array = new String[2];
        array[0] = serverName;
        array[1] = classname;
        DeviceData argIn = new DeviceData();
        argIn.insert(array);
        DeviceData argOut = command_inout(database, "DbGetDeviceList", argIn);

        return argOut.extractStringArray();
    }
391101
public DbServInfo get_server_info(Database database, String serverName) throws DevFailed {
        if (!database.isAccess_checked()) checkAccess(database);

        //	Query info from database
        DeviceData argIn = new DeviceData();
        argIn.insert(serverName);
        DeviceData argOut = command_inout(database, "DbGetServerInfo", argIn);
        String[] info = argOut.extractStringArray();
        return new DbServInfo(info);
    }
671462
public void init(final Connection connection, final DbDevImportInfo info) throws DevFailed {
		connection.url = new TangoUrl(info.name);
		connection.setDevice_is_dbase(false);
		connection.devname = connection.url.devname;

		// Check if connection is possible
		if (connection.url.protocol == TANGO && connection.url.use_db) {
	    	connection.ior = info.ior;
		}
		connection.classname = info.classname;
		
		try {
			initCtrlAccess(connection);
		}
		catch(DevFailed e) {
			System.err.println(e.errors[0].desc);
		}
    }
1340171
public void putDevicePipeProperty(String deviceName, ArrayList<DbPipe> dbPipes) throws DevFailed {
        for (DbPipe dbPipe : dbPipes)
            databaseDAO.putDevicePipeProperty(this, deviceName, dbPipe);
    }
44346
private void connect_to_dbase(final Connection connection) throws DevFailed {
		if (connection.device == null) {
	    	try {
                // Prepare the connection string
                final String db_corbaloc = "corbaloc:iiop:" + connection.url.host + ":"
                    + connection.url.strPort + "/database";
                // And connect to database.
                createDevice(connection, db_corbaloc);
                connection.classname = "Database";
 	    	} catch (final SystemException ex) {
				if (connection.transparent_reconnection) {
		    		try {
                        final DbRedundancy dbr = DbRedundancy.get_instance();
                        final String th2 = dbr.get(connection.url.host + ":" + connection.url.port);

                        // Prepare the connection string
                        final String db_corbaloc = "corbaloc:iiop:" + th2 + "/database";

                        // And connect to database.
                        createDevice(connection, db_corbaloc);
                        // System.out.println("Connected to " + db_corbaloc);
                    } catch (final SystemException e) {
                        // e.printStackTrace();
                        connection.device = null;
                        connection.ior = null;
                        Except.throw_connection_failed("TangoApi_DATABASE_CONNECTION_FAILED",
                            "Connection to database failed  !\n" + e, "connect_to_dbase("
                                + connection.url.host + "," + connection.url.strPort + ")");
 		    		}
				} else {
		    		// e.printStackTrace();
		    		connection.device = null;
		    		connection.ior = null;
    		    	Except.throw_connection_failed("TangoApi_DATABASE_CONNECTION_FAILED",
	    		    	"Connection to database failed  !\n" + ex, "connect_to_dbase("
		    		    	+ connection.url.host + "," + connection.url.strPort + ")");
				}
	    	}
		}
    }
212400
public void init(final DeviceProxy deviceProxy, final String devname) throws DevFailed {
        // super.init(deviceProxy, devname);
        deviceProxy.setFull_class_name("DeviceProxy(" + name(deviceProxy) + ")");
    }