本文整理汇总了Java中org.fourthline.cling.model.Namespace类的典型用法代码示例。如果您正苦于以下问题:Java Namespace类的具体用法?Java Namespace怎么用?Java Namespace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Namespace类属于org.fourthline.cling.model包,在下文中一共展示了Namespace类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateDevice
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
@Override
protected void generateDevice(Namespace namespace, Device deviceModel, Document descriptor, Element rootElement,
RemoteClientInfo info) {
super.generateDevice(namespace, deviceModel, descriptor, rootElement, info);
NodeList deviceElements = rootElement.getElementsByTagName(org.fourthline.cling.binding.xml.Descriptor.Device.ELEMENT.device.toString());
if(deviceElements.getLength() > 0) {
Element deviceElement = (Element) deviceElements.item(0);
Element sempServiceElement = appendNewElementIfNotNull(
descriptor, deviceElement, Semp.prefixed(ELEMENT.X_SEMPSERVICE),
"", "urn:" + Semp.NAMESPACE + ":service-1-0"
);
appendNewElementIfNotNull(descriptor, sempServiceElement, Semp.prefixed(ELEMENT.server), sempServerUrl);
appendNewElementIfNotNull(descriptor, sempServiceElement, Semp.prefixed(ELEMENT.basePath), "/semp");
appendNewElementIfNotNull(descriptor, sempServiceElement, Semp.prefixed(ELEMENT.transport), "HTTP/Pull");
appendNewElementIfNotNull(descriptor, sempServiceElement, Semp.prefixed(ELEMENT.exchangeFormat), "XML");
appendNewElementIfNotNull(descriptor, sempServiceElement, Semp.prefixed(ELEMENT.wsVersion), Semp.XSD_VERSION);
}
}
开发者ID:camueller,项目名称:SmartApplianceEnabler,代码行数:23,代码来源:SempDeviceDescriptorBinderImpl.java
示例2: buildDOM
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
public Document buildDOM(Device deviceModel, RemoteClientInfo info, Namespace namespace) throws DescriptorBindingException {
try {
log.fine("Generating DOM from device model: " + deviceModel);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
Document d = factory.newDocumentBuilder().newDocument();
generateRoot(namespace, deviceModel, d, info);
return d;
} catch (Exception ex) {
throw new DescriptorBindingException("Could not generate device descriptor: " + ex.getMessage(), ex);
}
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:18,代码来源:UDA10DeviceDescriptorBinderImpl.java
示例3: generateIconList
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
protected void generateIconList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) {
if (!deviceModel.hasIcons()) return;
Element iconListElement = appendNewElement(descriptor, deviceElement, ELEMENT.iconList);
for (Icon icon : deviceModel.getIcons()) {
Element iconElement = appendNewElement(descriptor, iconListElement, ELEMENT.icon);
appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.mimetype, icon.getMimeType());
appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.width, icon.getWidth());
appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.height, icon.getHeight());
appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.depth, icon.getDepth());
if (deviceModel instanceof RemoteDevice) {
appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.url, icon.getUri());
} else if (deviceModel instanceof LocalDevice) {
appendNewElementIfNotNull(descriptor, iconElement, ELEMENT.url, namespace.getIconPath(icon));
}
}
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:20,代码来源:UDA10DeviceDescriptorBinderImpl.java
示例4: generateServiceList
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
protected void generateServiceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement) {
if (!deviceModel.hasServices()) return;
Element serviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.serviceList);
for (Service service : deviceModel.getServices()) {
Element serviceElement = appendNewElement(descriptor, serviceListElement, ELEMENT.service);
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceType, service.getServiceType());
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.serviceId, service.getServiceId());
if (service instanceof RemoteService) {
RemoteService rs = (RemoteService) service;
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, rs.getDescriptorURI());
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, rs.getControlURI());
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, rs.getEventSubscriptionURI());
} else if (service instanceof LocalService) {
LocalService ls = (LocalService) service;
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.SCPDURL, namespace.getDescriptorPath(ls));
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.controlURL, namespace.getControlPath(ls));
appendNewElementIfNotNull(descriptor, serviceElement, ELEMENT.eventSubURL, namespace.getEventSubscriptionPath(ls));
}
}
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:24,代码来源:UDA10DeviceDescriptorBinderImpl.java
示例5: discoverResources
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
@Override
public Resource[] discoverResources(Namespace namespace) {
List<Resource> discovered = new ArrayList();
// Services
for (RemoteService service : getServices()) {
if(service == null) continue;
discovered.add(new ServiceEventCallbackResource(namespace.getEventCallbackPath(service), service));
}
// Embedded devices
if (hasEmbeddedDevices()) {
for (Device embeddedDevice : getEmbeddedDevices()) {
if(embeddedDevice == null) continue;
discovered.addAll(Arrays.asList(embeddedDevice.discoverResources(namespace)));
}
}
return discovered.toArray(new Resource[discovered.size()]);
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:21,代码来源:RemoteDevice.java
示例6: generate
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
public String generate(Device deviceModel, RemoteClientInfo info, Namespace namespace) throws DescriptorBindingException {
try {
log.fine("Generating XML descriptor from device model: " + deviceModel);
return XMLUtil.documentToString(buildDOM(deviceModel, info, namespace));
} catch (Exception ex) {
throw new DescriptorBindingException("Could not build DOM: " + ex.getMessage(), ex);
}
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:11,代码来源:UDA10DeviceDescriptorBinderImpl.java
示例7: generateRoot
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
protected void generateRoot(Namespace namespace, Device deviceModel, Document descriptor, RemoteClientInfo info) {
Element rootElement = descriptor.createElementNS(Descriptor.Device.NAMESPACE_URI, ELEMENT.root.toString());
descriptor.appendChild(rootElement);
generateSpecVersion(namespace, deviceModel, descriptor, rootElement);
/* UDA 1.1 spec says: Don't use URLBase anymore
if (deviceModel.getBaseURL() != null) {
appendChildElementWithTextContent(descriptor, rootElement, "URLBase", deviceModel.getBaseURL());
}
*/
generateDevice(namespace, deviceModel, descriptor, rootElement, info);
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:16,代码来源:UDA10DeviceDescriptorBinderImpl.java
示例8: generateDeviceList
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
protected void generateDeviceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement, RemoteClientInfo info) {
if (!deviceModel.hasEmbeddedDevices()) return;
Element deviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.deviceList);
for (Device device : deviceModel.getEmbeddedDevices()) {
generateDevice(namespace, device, descriptor, deviceListElement, info);
}
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:10,代码来源:UDA10DeviceDescriptorBinderImpl.java
示例9: getEventCallbackURLs
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
synchronized public List<URL> getEventCallbackURLs(List<NetworkAddress> activeStreamServers, Namespace namespace) {
List<URL> callbackURLs = new ArrayList();
for (NetworkAddress activeStreamServer : activeStreamServers) {
callbackURLs.add(
new Location(
activeStreamServer,
namespace.getEventCallbackPath(getService())
).getURL());
}
return callbackURLs;
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:12,代码来源:RemoteGENASubscription.java
示例10: discoverResources
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
@Override
public Resource[] discoverResources(Namespace namespace) {
// TODO Auto-generated method stub
return null;
}
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:6,代码来源:UpnpClient.java
示例11: createNamespace
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
@Override
protected Namespace createNamespace() {
return new Namespace("/upnp"); // This will be the servlet context path
}
开发者ID:SyMPHOnY-,项目名称:Smart-Home-Gateway,代码行数:5,代码来源:ApacheServiceConfiguration.java
示例12: createReceivingSync
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
public ReceivingSync createReceivingSync(StreamRequestMessage message) throws ProtocolCreationException {
log.fine("Creating protocol for incoming synchronous: " + message);
if (message.getOperation().getMethod().equals(UpnpRequest.Method.GET)) {
return createReceivingRetrieval(message);
} else if (getUpnpService().getConfiguration().getNamespace().isControlPath(message.getUri())) {
if (message.getOperation().getMethod().equals(UpnpRequest.Method.POST))
return createReceivingAction(message);
} else if (getUpnpService().getConfiguration().getNamespace().isEventSubscriptionPath(message.getUri())) {
if (message.getOperation().getMethod().equals(UpnpRequest.Method.SUBSCRIBE)) {
return createReceivingSubscribe(message);
} else if (message.getOperation().getMethod().equals(UpnpRequest.Method.UNSUBSCRIBE)) {
return createReceivingUnsubscribe(message);
}
} else if (getUpnpService().getConfiguration().getNamespace().isEventCallbackPath(message.getUri())) {
if (message.getOperation().getMethod().equals(UpnpRequest.Method.NOTIFY))
return createReceivingEvent(message);
} else {
// TODO: UPNP VIOLATION: Onkyo devices send event messages with trailing garbage characters
// dev/1234/svc/upnp-org/MyService/event/callback192%2e168%2e10%2e38
if (message.getUri().getPath().contains(Namespace.EVENTS + Namespace.CALLBACK_FILE)) {
log.warning("Fixing trailing garbage in event message path: " + message.getUri().getPath());
String invalid = message.getUri().toString();
message.setUri(
URI.create(invalid.substring(
0, invalid.indexOf(Namespace.CALLBACK_FILE) + Namespace.CALLBACK_FILE.length()
))
);
if (getUpnpService().getConfiguration().getNamespace().isEventCallbackPath(message.getUri())
&& message.getOperation().getMethod().equals(UpnpRequest.Method.NOTIFY))
return createReceivingEvent(message);
}
}
throw new ProtocolCreationException("Protocol for message type not found: " + message);
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:47,代码来源:ProtocolFactoryImpl.java
示例13: generateSpecVersion
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
protected void generateSpecVersion(Namespace namespace, Device deviceModel, Document descriptor, Element rootElement) {
Element specVersionElement = appendNewElement(descriptor, rootElement, ELEMENT.specVersion);
appendNewElementIfNotNull(descriptor, specVersionElement, ELEMENT.major, deviceModel.getVersion().getMajor());
appendNewElementIfNotNull(descriptor, specVersionElement, ELEMENT.minor, deviceModel.getVersion().getMinor());
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:6,代码来源:UDA10DeviceDescriptorBinderImpl.java
示例14: generateDevice
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
protected void generateDevice(Namespace namespace, Device deviceModel, Document descriptor, Element rootElement, RemoteClientInfo info) {
Element deviceElement = appendNewElement(descriptor, rootElement, ELEMENT.device);
appendNewElementIfNotNull(descriptor, deviceElement, ELEMENT.deviceType, deviceModel.getType());
DeviceDetails deviceModelDetails = deviceModel.getDetails(info);
appendNewElementIfNotNull(
descriptor, deviceElement, ELEMENT.friendlyName,
deviceModelDetails.getFriendlyName()
);
if (deviceModelDetails.getManufacturerDetails() != null) {
appendNewElementIfNotNull(
descriptor, deviceElement, ELEMENT.manufacturer,
deviceModelDetails.getManufacturerDetails().getManufacturer()
);
appendNewElementIfNotNull(
descriptor, deviceElement, ELEMENT.manufacturerURL,
deviceModelDetails.getManufacturerDetails().getManufacturerURI()
);
}
if (deviceModelDetails.getModelDetails() != null) {
appendNewElementIfNotNull(
descriptor, deviceElement, ELEMENT.modelDescription,
deviceModelDetails.getModelDetails().getModelDescription()
);
appendNewElementIfNotNull(
descriptor, deviceElement, ELEMENT.modelName,
deviceModelDetails.getModelDetails().getModelName()
);
appendNewElementIfNotNull(
descriptor, deviceElement, ELEMENT.modelNumber,
deviceModelDetails.getModelDetails().getModelNumber()
);
appendNewElementIfNotNull(
descriptor, deviceElement, ELEMENT.modelURL,
deviceModelDetails.getModelDetails().getModelURI()
);
}
appendNewElementIfNotNull(
descriptor, deviceElement, ELEMENT.serialNumber,
deviceModelDetails.getSerialNumber()
);
appendNewElementIfNotNull(descriptor, deviceElement, ELEMENT.UDN, deviceModel.getIdentity().getUdn());
appendNewElementIfNotNull(
descriptor, deviceElement, ELEMENT.presentationURL,
deviceModelDetails.getPresentationURI()
);
appendNewElementIfNotNull(
descriptor, deviceElement, ELEMENT.UPC,
deviceModelDetails.getUpc()
);
if (deviceModelDetails.getDlnaDocs() != null) {
for (DLNADoc dlnaDoc : deviceModelDetails.getDlnaDocs()) {
appendNewElementIfNotNull(
descriptor, deviceElement, Descriptor.Device.DLNA_PREFIX + ":" + ELEMENT.X_DLNADOC,
dlnaDoc, Descriptor.Device.DLNA_NAMESPACE_URI
);
}
}
appendNewElementIfNotNull(
descriptor, deviceElement, Descriptor.Device.DLNA_PREFIX + ":" + ELEMENT.X_DLNACAP,
deviceModelDetails.getDlnaCaps(), Descriptor.Device.DLNA_NAMESPACE_URI
);
appendNewElementIfNotNull(
descriptor, deviceElement, Descriptor.Device.SEC_PREFIX + ":" + ELEMENT.ProductCap,
deviceModelDetails.getSecProductCaps(), Descriptor.Device.SEC_NAMESPACE_URI
);
appendNewElementIfNotNull(
descriptor, deviceElement, Descriptor.Device.SEC_PREFIX + ":" + ELEMENT.X_ProductCap,
deviceModelDetails.getSecProductCaps(), Descriptor.Device.SEC_NAMESPACE_URI
);
generateIconList(namespace, deviceModel, descriptor, deviceElement);
generateServiceList(namespace, deviceModel, descriptor, deviceElement);
generateDeviceList(namespace, deviceModel, descriptor, deviceElement, info);
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:81,代码来源:UDA10DeviceDescriptorBinderImpl.java
示例15: discoverResources
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
@Override
public Resource[] discoverResources(Namespace namespace) {
List<Resource> discovered = new ArrayList();
// Device
if (isRoot()) {
// This should guarantee that each logical local device tree (with all its embedded devices) has only
// one device descriptor resource - because only one device in the tree isRoot().
discovered.add(new DeviceDescriptorResource(namespace.getDescriptorPath(this), this));
}
// Services
for (LocalService service : getServices()) {
discovered.add(
new ServiceDescriptorResource(namespace.getDescriptorPath(service), service)
);
// Control
discovered.add(
new ServiceControlResource(namespace.getControlPath(service), service)
);
// Event subscription
discovered.add(
new ServiceEventSubscriptionResource(namespace.getEventSubscriptionPath(service), service)
);
}
// Icons
for (Icon icon : getIcons()) {
discovered.add(new IconResource(namespace.prefixIfRelative(this, icon.getUri()), icon));
}
// Embedded devices
if (hasEmbeddedDevices()) {
for (Device embeddedDevice : getEmbeddedDevices()) {
discovered.addAll(Arrays.asList(embeddedDevice.discoverResources(namespace)));
}
}
return discovered.toArray(new Resource[discovered.size()]);
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:45,代码来源:LocalDevice.java
示例16: getNamespace
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
public Namespace getNamespace() {
return namespace;
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:4,代码来源:ManagedUpnpServiceConfiguration.java
示例17: createNamespace
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
protected Namespace createNamespace() {
return new Namespace();
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:4,代码来源:ManagedUpnpServiceConfiguration.java
示例18: createNamespace
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
@Override
protected Namespace createNamespace() {
// For the Jetty server, this is the servlet context path
return new Namespace("/upnp");
}
开发者ID:offbye,项目名称:DroidDLNA,代码行数:6,代码来源:AndroidUpnpServiceConfiguration.java
示例19: getNamespace
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
/**
* @return An instance of {@link org.fourthline.cling.model.Namespace} for this UPnP stack.
*/
public Namespace getNamespace();
开发者ID:offbye,项目名称:DroidDLNA,代码行数:5,代码来源:UpnpServiceConfiguration.java
示例20: generate
import org.fourthline.cling.model.Namespace; //导入依赖的package包/类
public String generate(Device device, RemoteClientInfo info, Namespace namespace) throws DescriptorBindingException;
开发者ID:offbye,项目名称:DroidDLNA,代码行数:2,代码来源:DeviceDescriptorBinder.java
注:本文中的org.fourthline.cling.model.Namespace类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论