• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ValidationException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.fourthline.cling.model.ValidationException的典型用法代码示例。如果您正苦于以下问题:Java ValidationException类的具体用法?Java ValidationException怎么用?Java ValidationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ValidationException类属于org.fourthline.cling.model包,在下文中一共展示了ValidationException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCreate

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    //Create LocalDevice
    LocalService localService = new AnnotationLocalServiceBinder().read(BeyondContentDirectoryService.class);
    localService.setManager(new DefaultServiceManager<>(
            localService, BeyondContentDirectoryService.class));

    String macAddress = Utils.getMACAddress(Utils.WLAN0);
    //Generate UUID by MAC address
    UDN udn = UDN.valueOf(UUID.nameUUIDFromBytes(macAddress.getBytes()).toString());

    try {
        mLocalDevice = new LocalDevice(new DeviceIdentity(udn), new UDADeviceType("MediaServer"),
                new DeviceDetails("Local Media Server"), new LocalService[]{localService});
    } catch (ValidationException e) {
        e.printStackTrace();
    }
    upnpService.getRegistry().addDevice(mLocalDevice);

    //LocalBinder instead of binder
    binder = new LocalBinder();
}
 
开发者ID:kevinshine,项目名称:BeyondUPnP,代码行数:25,代码来源:BeyondUpnpService.java


示例2: createDevice

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
private LocalDevice createDevice()
        throws ValidationException, LocalServiceBindingException, IOException {

    DeviceIdentity identity =
            new DeviceIdentity(
                    UDN.uniqueSystemIdentifier(SmartApplianceEnabler.class.getSimpleName())
            );

    DeviceType type = new SmartApplianceEnablerDeviceType();

    DeviceDetails details =
            new DeviceDetails(
                    SmartApplianceEnabler.class.getSimpleName(),
                    new ManufacturerDetails(SmartApplianceEnabler.MANUFACTURER_NAME, URI.create(SmartApplianceEnabler.MANUFACTURER_URI)),
                    new ModelDetails(
                            SmartApplianceEnabler.class.getSimpleName(),
                            SmartApplianceEnabler.DESCRIPTION,
                            SmartApplianceEnabler.VERSION,
                            URI.create(SmartApplianceEnabler.MODEL_URI)
                    )
            );

    return new LocalDevice(identity, type, details, (Icon) null, (LocalService) null);
}
 
开发者ID:camueller,项目名称:SmartApplianceEnabler,代码行数:25,代码来源:SempDiscovery.java


示例3: build

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public Device build(Device prototype, UDAVersion deviceVersion, URL baseURL) throws ValidationException {

        List<Device> embeddedDevicesList = new ArrayList();
        for (MutableDevice embeddedDevice : embeddedDevices) {
            embeddedDevicesList.add(embeddedDevice.build(prototype, deviceVersion, baseURL));
        }
        return prototype.newInstance(
                udn,
                deviceVersion,
                createDeviceType(),
                createDeviceDetails(baseURL),
                createIcons(),
                createServices(prototype),
                embeddedDevicesList
        );
    }
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:17,代码来源:MutableDevice.java


示例4: read

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public LocalService read(Class<?> clazz, ServiceId id, ServiceType type,
                               boolean supportsQueryStateVariables, Set<Class> stringConvertibleTypes)
        throws LocalServiceBindingException {

    Map<StateVariable, StateVariableAccessor> stateVariables = readStateVariables(clazz, stringConvertibleTypes);
    Map<Action, ActionExecutor> actions = readActions(clazz, stateVariables, stringConvertibleTypes);

    // Special treatment of the state variable querying action
    if (supportsQueryStateVariables) {
        actions.put(new QueryStateVariableAction(), new QueryStateVariableExecutor());
    }

    try {
        return new LocalService(type, id, actions, stateVariables, stringConvertibleTypes, supportsQueryStateVariables);

    } catch (ValidationException ex) {
        log.severe("Could not validate device model: " + ex.toString());
        for (ValidationError validationError : ex.getErrors()) {
            log.severe(validationError.toString());
        }
        throw new LocalServiceBindingException("Validation of model failed, check the log");
    }
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:24,代码来源:AnnotationLocalServiceBinder.java


示例5: Service

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public Service(ServiceType serviceType, ServiceId serviceId,
               Action<S>[] actions, StateVariable<S>[] stateVariables) throws ValidationException {

    this.serviceType = serviceType;
    this.serviceId = serviceId;

    if (actions != null) {
        for (Action action : actions) {
            this.actions.put(action.getName(), action);
            action.setService(this);
        }
    }

    if (stateVariables != null) {
        for (StateVariable stateVariable : stateVariables) {
            this.stateVariables.put(stateVariable.getName(), stateVariable);
            stateVariable.setService(this);
        }
    }

}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:22,代码来源:Service.java


示例6: LocalService

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public LocalService(ServiceType serviceType, ServiceId serviceId,
                    Map<Action, ActionExecutor> actionExecutors,
                    Map<StateVariable, StateVariableAccessor> stateVariableAccessors,
                    Set<Class> stringConvertibleTypes,
                    boolean supportsQueryStateVariables) throws ValidationException {

    super(serviceType, serviceId,
            actionExecutors.keySet().toArray(new Action[actionExecutors.size()]),
            stateVariableAccessors.keySet().toArray(new StateVariable[stateVariableAccessors.size()])
    );

    this.supportsQueryStateVariables = supportsQueryStateVariables;
    this.stringConvertibleTypes = stringConvertibleTypes;
    this.stateVariableAccessors = stateVariableAccessors;
    this.actionExecutors = actionExecutors;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:17,代码来源:LocalService.java


示例7: createDevice

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public static LocalDevice createDevice() throws ValidationException, LocalServiceBindingException, IOException {
  DeviceIdentity identity = new DeviceIdentity(UDN.uniqueSystemIdentifier("tinyMediaManager"));
  DeviceType type = new UDADeviceType("MediaServer", 1);
  String hostname = NetworkUtil.getMachineHostname();
  if (hostname == null) {
    hostname = Upnp.IP;
  }
  DeviceDetails details = new DeviceDetails("tinyMediaManager (" + hostname + ")",
      new ManufacturerDetails("tinyMediaManager", "http://www.tinymediamanager.org/"),
      new ModelDetails("tinyMediaManager", "tinyMediaManager - Media Server", ReleaseInfo.getVersion()));

  LOGGER.info("Hello, i'm " + identity.getUdn().getIdentifierString());

  // Content Directory Service
  LocalService cds = new AnnotationLocalServiceBinder().read(ContentDirectoryService.class);
  cds.setManager(new DefaultServiceManager<ContentDirectoryService>(cds, ContentDirectoryService.class));

  // Connection Manager Service
  LocalService<ConnectionManagerService> cms = new AnnotationLocalServiceBinder().read(ConnectionManagerService.class);
  cms.setManager(new DefaultServiceManager<>(cms, ConnectionManagerService.class));

  return new LocalDevice(identity, type, details, new LocalService[] { cds, cms });
}
 
开发者ID:tinyMediaManager,项目名称:tinyMediaManager,代码行数:25,代码来源:MediaServer.java


示例8: MediaServer

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public MediaServer(InetAddress localAddress, Context ctx) throws ValidationException
{
	super(null, port, null, true);

	Log.i(TAG, "Creating media server !");

	localService = new AnnotationLocalServiceBinder()
			.read(ContentDirectoryService.class);

	localService.setManager(new DefaultServiceManager<ContentDirectoryService>(
			localService, ContentDirectoryService.class));

	udn = UDN.valueOf(new UUID(0,10).toString());
	this.localAddress = localAddress;
	this.ctx = ctx;
	createLocalDevice();

	ContentDirectoryService contentDirectoryService = (ContentDirectoryService)localService.getManager().getImplementation();
	contentDirectoryService.setContext(ctx);
	contentDirectoryService.setBaseURL(getAddress());
}
 
开发者ID:trishika,项目名称:DroidUPnP,代码行数:22,代码来源:MediaServer.java


示例9: getLocalDummyDevice

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public Device<?, ?, ?> getLocalDummyDevice() {
    Device result = null;
    try {
        result = new LocalDummyDevice();
    } catch (ValidationException e) {
        // TODO Auto-generated catch block
        // Ignore
        Log.d(this.getClass().getName(), "Something wrong with the LocalDummyDevice...", e);
    }
    return result;
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:12,代码来源:UpnpClient.java


示例10: createDevice

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
LocalDevice createDevice() throws ValidationException, LocalServiceBindingException, IOException {

    DeviceIdentity identity = new DeviceIdentity(UDN.uniqueSystemIdentifier("SensoryEffectRendererDevice"));
    DeviceType type = new UDADeviceType("SensoryEffectRenderer", 1);
    DeviceDetails details =
            new DeviceDetails(
                    "LPRM - PlaySEM - Sensory Effect Renderer Device",
                    new ManufacturerDetails("LPRM"),
                    new ModelDetails(
                            "PlaySEM.SERendererDevice.ModelA",
                            "A remote Sensory Effect Renderer Device. Model A supports Light, Fan and Vibration.",
                            "v1"
                    )
            );

    String iconResource = "br/ufes/inf/lprm/sensoryeffect/renderer/icon.png";
    Icon icon = new Icon("image/png", 48, 48, 8, "icon.png", Thread.currentThread().getContextClassLoader().getResourceAsStream(iconResource));

    LocalService<SERendererService> seRendererService = new AnnotationLocalServiceBinder().read(SERendererService.class);
    seRendererService.setManager(new DefaultServiceManager(seRendererService, SERendererService.class));

    try {
    	return new LocalDevice(identity, type, details, icon, seRendererService);
    }
    catch (Exception e) {
    	System.out.print("An exception has occured: " + e.getMessage());
    	e.printStackTrace();
    	return null;
    }
}
 
开发者ID:estevaosaleme,项目名称:PlaySEM_SERenderer,代码行数:32,代码来源:SERendererDevice.java


示例11: createDevice

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public LocalDevice createDevice( ) 
		throws ValidationException,
		LocalServiceBindingException, 
		IOException {

	DeviceIdentity identity = new DeviceIdentity(
			UDN.uniqueSystemIdentifier(deviceIdentity));

	DeviceType type = new UDADeviceType("BinaryLight", 1);

	DeviceDetails details = new DeviceDetails(friendlyName,
			new ManufacturerDetails(manufacturerName), new ModelDetails(
					modelName, modelDescription, modelNumber));

	/*Icon icon = new Icon("image/png", 48, 48, 8, getClass().getResource(
			"icon.png"));*/

	LocalService switchPowerService = new AnnotationLocalServiceBinder()
			.read(implClass);

	switchPowerService.setManager(new DefaultServiceManager(
			switchPowerService, implClass));

	return new LocalDevice(identity, type, details, /*icon,*/
			switchPowerService);

	/*
	 * Several services can be bound to the same device: return new
	 * LocalDevice( identity, type, details, icon, new LocalService[]
	 * {switchPowerService, myOtherService} );
	 */

}
 
开发者ID:cyclingengineer,项目名称:UpnpHomeAutomationBridge,代码行数:34,代码来源:BinaryLightDevice.java


示例12: createServices

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public Service[] createServices(Device prototype) throws ValidationException {
    Service[] services = prototype.newServiceArray(this.services.size());
    int i = 0;
    for (MutableService service : this.services) {
        services[i++] = service.build(prototype);
    }
    return services;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:9,代码来源:MutableDevice.java


示例13: build

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public Service build(Device prototype) throws ValidationException {
    return prototype.newInstance(
            serviceType, serviceId,
            descriptorURI, controlURI, eventSubscriptionURI,
            createActions(),
            createStateVariables()
    );
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:9,代码来源:MutableService.java


示例14: RemoteService

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public RemoteService(ServiceType serviceType, ServiceId serviceId,
                     URI descriptorURI, URI controlURI, URI eventSubscriptionURI,
                     Action<RemoteService>[] actions, StateVariable<RemoteService>[] stateVariables) throws ValidationException {
    super(serviceType, serviceId, actions, stateVariables);

    this.descriptorURI = descriptorURI;
    this.controlURI = controlURI;
    this.eventSubscriptionURI = eventSubscriptionURI;

    List<ValidationError> errors = validateThis();
    if (errors.size() > 0) {
        throw new ValidationException("Validation of device graph failed, call getErrors() on exception", errors);
    }
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:15,代码来源:RemoteService.java


示例15: newInstance

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
@Override
public RemoteDevice newInstance(UDN udn, UDAVersion version, DeviceType type, DeviceDetails details,
                                Icon[] icons, RemoteService[] services,
                                List<RemoteDevice> embeddedDevices) throws ValidationException {
    return new RemoteDevice(
            new RemoteDeviceIdentity(udn, getIdentity()),
            version, type, details, icons,
            services,
            embeddedDevices.size() > 0 ? embeddedDevices.toArray(new RemoteDevice[embeddedDevices.size()]) : null
    );
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:12,代码来源:RemoteDevice.java


示例16: newInstance

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
@Override
public LocalDevice newInstance(UDN udn, UDAVersion version, DeviceType type, DeviceDetails details,
                               Icon[] icons, LocalService[] services, List<LocalDevice> embeddedDevices)
        throws ValidationException {
    return new LocalDevice(
            new DeviceIdentity(udn, getIdentity().getMaxAgeSeconds()),
            version, type, details, icons,
            services,
            embeddedDevices.size() > 0 ? embeddedDevices.toArray(new LocalDevice[embeddedDevices.size()]) : null
    );
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:12,代码来源:LocalDevice.java


示例17: getResources

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
Resource[] getResources(Device device) throws RegistrationException {
    try {
        return registry.getConfiguration().getNamespace().getResources(device);
    } catch (ValidationException ex) {
        throw new RegistrationException("Resource discover error: " + ex.toString(), ex);
    }
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:8,代码来源:RegistryItems.java


示例18: MediaServer

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public MediaServer(Context context ) throws ValidationException {
    mContext = context;
    DeviceType type = new UDADeviceType(deviceType, version);

    DeviceDetails details = new DeviceDetails(SettingActivity.getDeviceName(context) + " ("
            + android.os.Build.MODEL + ")", new ManufacturerDetails(
            android.os.Build.MANUFACTURER), new ModelDetails(android.os.Build.MODEL,
            Utils.DMS_DESC, "v1"));

    LocalService service = new AnnotationLocalServiceBinder()
            .read(ContentDirectoryService.class);

    service.setManager(new DefaultServiceManager<ContentDirectoryService>(service,
            ContentDirectoryService.class));

    udn = UpnpUtil.uniqueSystemIdentifier("msidms");

    localDevice = new LocalDevice(new DeviceIdentity(udn), type, details, createDefaultDeviceIcon(), service);

    Log.v(LOGTAG, "MediaServer device created: ");
    Log.v(LOGTAG, "friendly name: " + details.getFriendlyName());
    Log.v(LOGTAG, "manufacturer: " + details.getManufacturerDetails().getManufacturer());
    Log.v(LOGTAG, "model: " + details.getModelDetails().getModelName());

    // start http server
    try {
        new HttpServer(PORT);
    } catch (IOException ioe) {
        System.err.println("Couldn't start server:\n" + ioe);
        System.exit(-1);
    }

    Log.v(LOGTAG, "Started Http Server on port " + PORT);
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:35,代码来源:MediaServer.java


示例19: startMediaServer

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public void startMediaServer() {
  createUpnpService();
  try {
    this.upnpService.getRegistry().addDevice(MediaServer.createDevice());
  }
  catch (RegistrationException | LocalServiceBindingException | ValidationException | IOException e) {
    LOGGER.warn("could not start UPNP MediaServer!", e);
  }
}
 
开发者ID:tinyMediaManager,项目名称:tinyMediaManager,代码行数:10,代码来源:Upnp.java


示例20: createLocalDevice

import org.fourthline.cling.model.ValidationException; //导入依赖的package包/类
public void createLocalDevice() throws ValidationException
{
	String version = "";
	try {
		version = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0).versionName;
	} catch (PackageManager.NameNotFoundException e) {
		Log.e(TAG, "Application version name not found");
	}

	DeviceDetails details = new DeviceDetails(
		SettingsActivity.getSettingContentDirectoryName(ctx),
		new ManufacturerDetails(ctx.getString(R.string.app_name), ctx.getString(R.string.app_url)),
		new ModelDetails(ctx.getString(R.string.app_name), ctx.getString(R.string.app_url)),
		ctx.getString(R.string.app_name), version);

	List<ValidationError> l = details.validate();
	for( ValidationError v : l )
	{
		Log.e(TAG, "Validation pb for property "+ v.getPropertyName());
		Log.e(TAG, "Error is " + v.getMessage());
	}


	DeviceType type = new UDADeviceType("MediaServer", 1);

	localDevice = new LocalDevice(new DeviceIdentity(udn), type, details, localService);
}
 
开发者ID:trishika,项目名称:DroidUPnP,代码行数:28,代码来源:MediaServer.java



注:本文中的org.fourthline.cling.model.ValidationException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EncodeException类代码示例发布时间:2022-05-22
下一篇:
Java NodeRegistration类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap