Search in sources :

Example 1 with ObjectFactory

use of org.eclipse.kura.core.configuration.metatype.ObjectFactory in project kura by eclipse.

the class FirewallConfigurationServiceImpl method getDefinition.

private Tocd getDefinition() throws KuraException {
    ObjectFactory objectFactory = new ObjectFactory();
    Tocd tocd = objectFactory.createTocd();
    tocd.setName("FirewallConfigurationService");
    tocd.setId("org.eclipse.kura.net.admin.FirewallConfigurationService");
    tocd.setDescription("Firewall Configuration Service");
    Tad tad = objectFactory.createTad();
    tad.setId(FirewallConfiguration.OPEN_PORTS_PROP_NAME);
    tad.setName(FirewallConfiguration.OPEN_PORTS_PROP_NAME);
    tad.setType(Tscalar.STRING);
    tad.setCardinality(10000);
    tad.setRequired(true);
    tad.setDefault(FirewallConfiguration.DFLT_OPEN_PORTS_VALUE);
    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.PLATFORM_INTERFACES));
    tocd.addAD(tad);
    tad = objectFactory.createTad();
    tad.setId(FirewallConfiguration.PORT_FORWARDING_PROP_NAME);
    tad.setName(FirewallConfiguration.PORT_FORWARDING_PROP_NAME);
    tad.setType(Tscalar.STRING);
    tad.setCardinality(10000);
    tad.setRequired(true);
    tad.setDefault(FirewallConfiguration.DFLT_PORT_FORWARDING_VALUE);
    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.PLATFORM_INTERFACES));
    tocd.addAD(tad);
    tad = objectFactory.createTad();
    tad.setId(FirewallConfiguration.NAT_PROP_NAME);
    tad.setName(FirewallConfiguration.NAT_PROP_NAME);
    tad.setType(Tscalar.STRING);
    tad.setCardinality(10000);
    tad.setRequired(true);
    tad.setDefault(FirewallConfiguration.DFLT_NAT_VALUE);
    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.PLATFORM_INTERFACES));
    tocd.addAD(tad);
    return tocd;
}
Also used : ObjectFactory(org.eclipse.kura.core.configuration.metatype.ObjectFactory) Tad(org.eclipse.kura.core.configuration.metatype.Tad) Tocd(org.eclipse.kura.core.configuration.metatype.Tocd)

Example 2 with ObjectFactory

use of org.eclipse.kura.core.configuration.metatype.ObjectFactory in project kura by eclipse.

the class NetworkConfigurationServiceImpl method getDefinition.

private Tocd getDefinition() throws KuraException {
    ObjectFactory objectFactory = new ObjectFactory();
    Tocd tocd = objectFactory.createTocd();
    tocd.setName("NetworkConfigurationService");
    tocd.setId("org.eclipse.kura.net.admin.NetworkConfigurationService");
    tocd.setDescription("Network Configuration Service");
    // get the USB network interfaces (if any)
    List<UsbNetDevice> usbNetDevices = this.m_usbService.getUsbNetDevices();
    Tad tad = objectFactory.createTad();
    tad.setId("net.interfaces");
    tad.setName("net.interfaces");
    tad.setType(Tscalar.STRING);
    tad.setCardinality(10000);
    tad.setRequired(true);
    tad.setDefault("");
    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.PLATFORM_INTERFACES));
    tocd.addAD(tad);
    // Get the network interfaces on the platform
    try {
        List<String> networkInterfaceNames = LinuxNetworkUtil.getAllInterfaceNames();
        for (String ifaceName : networkInterfaceNames) {
            // get the current configuration for this interface
            NetInterfaceType type = LinuxNetworkUtil.getType(ifaceName);
            String prefix = "net.interface.";
            if (type == NetInterfaceType.LOOPBACK) {
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.mtu").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.mtu").toString());
                tad.setType(Tscalar.INTEGER);
                tad.setCardinality(0);
                tad.setRequired(true);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_MTU));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.autoconnect").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.autoconnect").toString());
                tad.setType(Tscalar.BOOLEAN);
                tad.setCardinality(0);
                tad.setRequired(true);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_AUTOCONNECT));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.driver").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.driver").toString());
                tad.setType(Tscalar.STRING);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_DRIVER));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.ip4.address").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.ip4.address").toString());
                tad.setType(Tscalar.STRING);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_ADDRESS));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.ip4.prefix").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.ip4.prefix").toString());
                tad.setType(Tscalar.SHORT);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_PREFIX));
                tocd.addAD(tad);
            } else if (type == NetInterfaceType.ETHERNET || type == NetInterfaceType.WIFI) {
                if (usbNetDevices != null) {
                    for (UsbNetDevice usbNetDevice : usbNetDevices) {
                        if (usbNetDevice.getInterfaceName().equals(ifaceName)) {
                            // found a match - add the read only fields?
                            tad = objectFactory.createTad();
                            tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".usb.port").toString());
                            tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".usb.port").toString());
                            tad.setType(Tscalar.STRING);
                            tad.setCardinality(0);
                            tad.setRequired(false);
                            tad.setDefault("");
                            tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.USB_PORT));
                            tocd.addAD(tad);
                            tad = objectFactory.createTad();
                            tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".usb.manufacturer").toString());
                            tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".usb.manfacturer").toString());
                            tad.setType(Tscalar.STRING);
                            tad.setCardinality(0);
                            tad.setRequired(false);
                            tad.setDefault("");
                            tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.USB_MANUFACTURER));
                            tocd.addAD(tad);
                            tad = objectFactory.createTad();
                            tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".usb.product").toString());
                            tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".usb.product").toString());
                            tad.setType(Tscalar.STRING);
                            tad.setCardinality(0);
                            tad.setRequired(false);
                            tad.setDefault("");
                            tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.USB_PRODUCT));
                            tocd.addAD(tad);
                            tad = objectFactory.createTad();
                            tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".usb.manufacturer.id").toString());
                            tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".usb.manfacturer.id").toString());
                            tad.setType(Tscalar.STRING);
                            tad.setCardinality(0);
                            tad.setRequired(false);
                            tad.setDefault("");
                            tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.USB_MANUFACTURER_ID));
                            tocd.addAD(tad);
                            tad = objectFactory.createTad();
                            tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".usb.product.id").toString());
                            tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".usb.product.id").toString());
                            tad.setType(Tscalar.STRING);
                            tad.setCardinality(0);
                            tad.setRequired(false);
                            tad.setDefault("");
                            tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.USB_PRODUCT_ID));
                            tocd.addAD(tad);
                            // no need to continue
                            break;
                        }
                    }
                }
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.mtu").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.mtu").toString());
                tad.setType(Tscalar.INTEGER);
                tad.setCardinality(0);
                tad.setRequired(true);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_MTU));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.autoconnect").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.autoconnect").toString());
                tad.setType(Tscalar.BOOLEAN);
                tad.setCardinality(0);
                tad.setRequired(true);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_AUTOCONNECT));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpClient4.enabled").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpClient4.enabled").toString());
                tad.setType(Tscalar.BOOLEAN);
                tad.setCardinality(0);
                tad.setRequired(true);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_DHCP_CLIENT_ENABLED));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.ip4.address").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.ip4.address").toString());
                tad.setType(Tscalar.STRING);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_ADDRESS));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.ip4.prefix").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.ip4.prefix").toString());
                tad.setType(Tscalar.SHORT);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_PREFIX));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.ip4.gateway").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.ip4.gateway").toString());
                tad.setType(Tscalar.STRING);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_GATEWAY));
                tocd.addAD(tad);
                // DNS and WINS
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.dnsServers").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.dnsServers").toString());
                tad.setType(Tscalar.STRING);
                tad.setCardinality(10000);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_DNS_SERVERS));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.winsServers").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.winsServers").toString());
                tad.setType(Tscalar.STRING);
                tad.setCardinality(10000);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WINS_SERVERS));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.enabled").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.enabled").toString());
                tad.setType(Tscalar.BOOLEAN);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_DHCP_SERVER_ENABLED));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.defaultLeaseTime").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.defaultLeaseTime").toString());
                tad.setType(Tscalar.INTEGER);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_DHCP_SERVER_DEFAULT_LEASE_TIME));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.maxLeaseTime").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.maxLeaseTime").toString());
                tad.setType(Tscalar.INTEGER);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_DHCP_SERVER_MAX_LEASE_TIME));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.prefix").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.prefix").toString());
                tad.setType(Tscalar.SHORT);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_DHCP_SERVER_PREFIX));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.rangeStart").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.rangeStart").toString());
                tad.setType(Tscalar.STRING);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_DHCP_SERVER_RANGE_START));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.rangeEnd").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.rangeEnd").toString());
                tad.setType(Tscalar.STRING);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_DHCP_SERVER_RANGE_END));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.passDns").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.dhcpServer4.passDns").toString());
                tad.setType(Tscalar.BOOLEAN);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_DHCP_SERVER_PASS_DNS));
                tocd.addAD(tad);
                tad = objectFactory.createTad();
                tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.nat.enabled").toString());
                tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.nat.enabled").toString());
                tad.setType(Tscalar.BOOLEAN);
                tad.setCardinality(0);
                tad.setRequired(false);
                tad.setDefault("");
                tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_IPV4_DHCP_SERVER_NAT_ENABLED));
                tocd.addAD(tad);
                if (type == NetInterfaceType.WIFI) {
                    // Common
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".wifi.capabilities").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".wifi.capabilities").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.WIFI_CAPABILITIES));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.mode").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.mode").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_MODE));
                    tocd.addAD(tad);
                    // INFRA
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.ssid").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.ssid").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_INFRA_SSID));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.hardwareMode").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.hardwareMode").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_INFRA_HARDWARE_MODE));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.radioMode").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.radioMode").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_INFRA_HARDWARE_MODE));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.securityType").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.securityType").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_INFRA_SECURITY_TYPE));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.passphrase").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.passphrase").toString());
                    tad.setType(Tscalar.PASSWORD);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_INFRA_PASSPHRASE));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.pairwiseCiphers").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.pairwiseCiphers").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_INFRA_PAIRWISE_CIPHERS));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.groupCiphers").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.groupCiphers").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_INFRA_GROUP_CIPHERS));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.channel").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.infra.channel").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_INFRA_CHANNEL));
                    tocd.addAD(tad);
                    // MASTER
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.ssid").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.ssid").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_MASTER_SSID));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.broadcast").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.broadcast").toString());
                    tad.setType(Tscalar.BOOLEAN);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_MASTER_BROADCAST_ENABLED));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.hardwareMode").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.hardwareMode").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_MASTER_HARDWARE_MODE));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.radioMode").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.radioMode").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_MASTER_HARDWARE_MODE));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.securityType").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.securityType").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_MASTER_SECURITY_TYPE));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.passphrase").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.passphrase").toString());
                    tad.setType(Tscalar.PASSWORD);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_MASTER_PASSPHRASE));
                    tocd.addAD(tad);
                    tad = objectFactory.createTad();
                    tad.setId(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.channel").toString());
                    tad.setName(new StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.master.channel").toString());
                    tad.setType(Tscalar.STRING);
                    tad.setCardinality(0);
                    tad.setRequired(false);
                    tad.setDefault("");
                    tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.CONFIG_WIFI_MASTER_CHANNEL));
                    tocd.addAD(tad);
                /*
                         * // ADHOC
                         * tad = objectFactory.createTad();
                         * tad.setId((new
                         * StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.adhoc.ssid")).toString()
                         * );
                         * tad.setName((new
                         * StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.adhoc.ssid")).toString()
                         * );
                         * tad.setType(Tscalar.STRING);
                         * tad.setCardinality(0);
                         * tad.setRequired(false);
                         * tad.setDefault("");
                         * tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.
                         * CONFIG_WIFI_ADHOC_SSID));
                         * tocd.addAD(tad);
                         *
                         * tad = objectFactory.createTad();
                         * tad.setId((new
                         * StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.adhoc.hardwareMode")).
                         * toString());
                         * tad.setName((new
                         * StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.adhoc.hardwareMode")).
                         * toString());
                         * tad.setType(Tscalar.STRING);
                         * tad.setCardinality(0);
                         * tad.setRequired(false);
                         * tad.setDefault("");
                         * tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.
                         * CONFIG_WIFI_ADHOC_HARDWARE_MODE));
                         * tocd.addAD(tad);
                         *
                         * tad = objectFactory.createTad();
                         * tad.setId((new
                         * StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.adhoc.radioMode")).
                         * toString());
                         * tad.setName((new
                         * StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.adhoc.radioMode")).
                         * toString());
                         * tad.setType(Tscalar.STRING);
                         * tad.setCardinality(0);
                         * tad.setRequired(false);
                         * tad.setDefault("");
                         * tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.
                         * CONFIG_WIFI_ADHOC_HARDWARE_MODE));
                         * tocd.addAD(tad);
                         *
                         * tad = objectFactory.createTad();
                         * tad.setId((new
                         * StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.adhoc.securityType")).
                         * toString());
                         * tad.setName((new
                         * StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.adhoc.securityType")).
                         * toString());
                         * tad.setType(Tscalar.STRING);
                         * tad.setCardinality(0);
                         * tad.setRequired(false);
                         * tad.setDefault("");
                         * tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.
                         * CONFIG_WIFI_ADHOC_SECURITY_TYPE));
                         * tocd.addAD(tad);
                         *
                         * tad = objectFactory.createTad();
                         * tad.setId((new
                         * StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.adhoc.passphrase")).
                         * toString());
                         * tad.setName((new
                         * StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.adhoc.passphrase")).
                         * toString());
                         * tad.setType(Tscalar.STRING);
                         * tad.setCardinality(0);
                         * tad.setRequired(false);
                         * tad.setDefault("");
                         * tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.
                         * CONFIG_WIFI_ADHOC_PASSPHRASE));
                         * tocd.addAD(tad);
                         *
                         * tad = objectFactory.createTad();
                         * tad.setId((new
                         * StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.adhoc.channel")).
                         * toString());
                         * tad.setName((new
                         * StringBuffer().append(prefix).append(ifaceName).append(".config.wifi.adhoc.channel")).
                         * toString());
                         * tad.setType(Tscalar.STRING);
                         * tad.setCardinality(0);
                         * tad.setRequired(false);
                         * tad.setDefault("");
                         * tad.setDescription(NetworkAdminConfigurationMessages.getMessage(NetworkAdminConfiguration.
                         * CONFIG_WIFI_ADHOC_CHANNEL));
                         * tocd.addAD(tad);
                         */
                }
            // TODO - deal with USB devices (READ ONLY)
            }
        }
    } catch (Exception e) {
        throw new KuraException(KuraErrorCode.CONFIGURATION_ERROR, e);
    }
    return tocd;
}
Also used : ObjectFactory(org.eclipse.kura.core.configuration.metatype.ObjectFactory) NetInterfaceType(org.eclipse.kura.net.NetInterfaceType) Tad(org.eclipse.kura.core.configuration.metatype.Tad) KuraException(org.eclipse.kura.KuraException) UsbNetDevice(org.eclipse.kura.usb.UsbNetDevice) Tocd(org.eclipse.kura.core.configuration.metatype.Tocd) KuraException(org.eclipse.kura.KuraException)

Aggregations

ObjectFactory (org.eclipse.kura.core.configuration.metatype.ObjectFactory)2 Tad (org.eclipse.kura.core.configuration.metatype.Tad)2 Tocd (org.eclipse.kura.core.configuration.metatype.Tocd)2 KuraException (org.eclipse.kura.KuraException)1 NetInterfaceType (org.eclipse.kura.net.NetInterfaceType)1 UsbNetDevice (org.eclipse.kura.usb.UsbNetDevice)1