当前位置: 首页>>代码示例>>Java>>正文


Java Action类代码示例

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


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

示例1: browse

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
private void browse(DeviceDisplay device, String id) {

        mBrowsingDevices = id == null;

        updateTitleAndDescription();

        if (mBrowsingDevices) {
            mParentIdMap.clear();
            mListView.setAdapter(mListAdapter);
        } else {
            Service foundService = null;
            for (Service s : device.getDevice().getServices())
                for (Action a : s.getActions())
                    if ("browse".equalsIgnoreCase(a.getName())) {
                        foundService = s;
                        break;
                    }

            if (foundService != null) {
                mUpnpService.getControlPoint().execute(
                        new BrowseCallback(foundService, id, BrowseFlag.DIRECT_CHILDREN));
            }
        }
    }
 
开发者ID:MizzleDK,项目名称:Mizuu-Android-TV,代码行数:25,代码来源:AddUpnpSourceActivity.java

示例2: appendAction

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
public Action appendAction(Map<Action, ActionExecutor> actions) throws LocalServiceBindingException {

        String name;
        if (getAnnotation().name().length() != 0) {
            name = getAnnotation().name();
        } else {
            name = AnnotationLocalServiceBinder.toUpnpActionName(getMethod().getName());
        }

        log.fine("Creating action and executor: " + name);

        List<ActionArgument> inputArguments = createInputArguments();
        Map<ActionArgument<LocalService>, StateVariableAccessor> outputArguments = createOutputArguments();

        inputArguments.addAll(outputArguments.keySet());
        ActionArgument<LocalService>[] actionArguments =
                inputArguments.toArray(new ActionArgument[inputArguments.size()]);

        Action action = new Action(name, actionArguments);
        ActionExecutor executor = createExecutor(outputArguments);

        actions.put(action, executor);
        return action;
    }
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:25,代码来源:AnnotationActionBinder.java

示例3: read

import org.fourthline.cling.model.meta.Action; //导入依赖的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

示例4: readActions

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
protected Map<Action, ActionExecutor> readActions(Class<?> clazz,
                                                  Map<StateVariable, StateVariableAccessor> stateVariables,
                                                  Set<Class> stringConvertibleTypes)
        throws LocalServiceBindingException {

    Map<Action, ActionExecutor> map = new HashMap();

    for (Method method : Reflections.getMethods(clazz, UpnpAction.class)) {
        AnnotationActionBinder actionBinder =
                new AnnotationActionBinder(method, stateVariables, stringConvertibleTypes);
        Action action = actionBinder.appendAction(map);
        if(isActionExcluded(action)) {
        	map.remove(action);
        }
    }

    return map;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:19,代码来源:AnnotationLocalServiceBinder.java

示例5: readOutputArgumentValues

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
/**
 * Reads the output arguments after an action execution using accessors.
 *
 * @param action The action of which the output arguments are read.
 * @param instance The instance on which the accessors will be invoked.
 * @return <code>null</code> if the action has no output arguments, a single instance if it has one, an
 *         <code>Object[]</code> otherwise.
 * @throws Exception
 */
protected Object readOutputArgumentValues(Action<LocalService> action, Object instance) throws Exception {
    Object[] results = new Object[action.getOutputArguments().length];
    log.fine("Attempting to retrieve output argument values using accessor: " + results.length);

    int i = 0;
    for (ActionArgument outputArgument : action.getOutputArguments()) {
        log.finer("Calling acccessor method for: " + outputArgument);

        StateVariableAccessor accessor = getOutputArgumentAccessors().get(outputArgument);
        if (accessor != null) {
            log.fine("Calling accessor to read output argument value: " + accessor);
            results[i++] = accessor.read(instance);
        } else {
            throw new IllegalStateException("No accessor bound for: " + outputArgument);
        }
    }

    if (results.length == 1) {
        return results[0];
    }
    return results.length > 0 ? results : null;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:32,代码来源:AbstractActionExecutor.java

示例6: testRendererGetProtocolInfo

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
public void testRendererGetProtocolInfo(){
		
	waitForService();
	LocalDevice rendererDevice = getService().getUpnpClient().getRegistry().getLocalDevice(new UDN(YaaccUpnpServerService.MEDIA_RENDERER_UDN_ID),false);
	LocalService connectionService = rendererDevice.findService(new ServiceId(UDAServiceId.DEFAULT_NAMESPACE,"ConnectionManager"));
	Action action = connectionService.getAction("GetProtocolInfo");
	ActionInvocation<LocalService> actionInvocation = new ActionInvocation<LocalService>(action);
	connectionService.getExecutor(action).execute(actionInvocation);
	if(actionInvocation.getFailure() != null){
		throw new RuntimeException(actionInvocation.getFailure().fillInStackTrace());
	}		
	
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:14,代码来源:YaaccUpnpServerServiceTest.java

示例7: testServerGetProtocolInfo

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
public void testServerGetProtocolInfo(){
	
	waitForService();
	LocalDevice serverDevice = getService().getUpnpClient().getRegistry().getLocalDevice(new UDN(YaaccUpnpServerService.MEDIA_SERVER_UDN_ID),false);
	LocalService connectionService = serverDevice.findService(new ServiceId(UDAServiceId.DEFAULT_NAMESPACE,"ConnectionManager"));
	Action action = connectionService.getAction("GetProtocolInfo");
	ActionInvocation<LocalService> actionInvocation = new ActionInvocation<LocalService>(action);
	connectionService.getExecutor(action).execute(actionInvocation);
	if(actionInvocation.getFailure() != null){
		throw new RuntimeException(actionInvocation.getFailure().fillInStackTrace());
	}		
	
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:14,代码来源:YaaccUpnpServerServiceTest.java

示例8: getConnectionInfos

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private void getConnectionInfos(UpnpClient upnpClient,
		final List<Device<?, ?, ?>> devices) throws Exception {
	for (Device<?, ?, ?> device : devices) {
		Service service = device.findService(new UDAServiceId(
				"ConnectionManager"));
		if (service != null) {
			Action getCurrentConnectionIds = service
					.getAction("GetCurrentConnectionIDs");
			assertNotNull(getCurrentConnectionIds);
			ActionInvocation getCurrentConnectionIdsInvocation = new ActionInvocation(
					getCurrentConnectionIds);
			ActionCallback getCurrentConnectionCallback = new ActionCallback(
					getCurrentConnectionIdsInvocation) {
				
				@Override
				public void success(ActionInvocation invocation) {
					ActionArgumentValue[] connectionIds = invocation
							.getOutput();
				    for (ActionArgumentValue connectionId : connectionIds) {
				    	Log.d(getClass().getName(), connectionId.getValue().toString());
						
					}
				}

				@Override
				public void failure(ActionInvocation actioninvocation,
						UpnpResponse upnpresponse, String s) {
					Log.d(getClass().getName(),"Failure:" + upnpresponse);

				}
			};

			upnpClient.getUpnpService().getControlPoint()
					.execute(getCurrentConnectionCallback);

		}
	}
	myWait();
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:41,代码来源:UpnpClientTest.java

示例9: createActions

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
public Action[] createActions() {
    Action[] array = new Action[actions.size()];
    int i = 0;
    for (MutableAction action : actions) {
        array[i++] = action.build();
    }
    return array;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:9,代码来源:MutableService.java

示例10: generateActionList

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
private void generateActionList(Service serviceModel, Document descriptor, Element scpdElement) {

        Element actionListElement = appendNewElement(descriptor, scpdElement, ELEMENT.actionList);

        for (Action action : serviceModel.getActions()) {
            if (!action.getName().equals(QueryStateVariableAction.ACTION_NAME))
                generateAction(action, descriptor, actionListElement);
        }
    }
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:10,代码来源:UDA10ServiceDescriptorBinderImpl.java

示例11: generateAction

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
private void generateAction(Action action, Document descriptor, Element actionListElement) {

        Element actionElement = appendNewElement(descriptor, actionListElement, ELEMENT.action);

        appendNewElementIfNotNull(descriptor, actionElement, ELEMENT.name, action.getName());

        if (action.hasArguments()) {
            Element argumentListElement = appendNewElement(descriptor, actionElement, ELEMENT.argumentList);
            for (ActionArgument actionArgument : action.getArguments()) {
                generateActionArgument(actionArgument, descriptor, argumentListElement);
            }
        }
    }
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:14,代码来源:UDA10ServiceDescriptorBinderImpl.java

示例12: OutgoingActionResponseMessage

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
public OutgoingActionResponseMessage(UpnpResponse.Status status, Action action) {
    super(new UpnpResponse(status));

    if (action != null) {
        if (action instanceof QueryStateVariableAction) {
            this.actionNamespace = Constants.NS_UPNP_CONTROL_10;
        } else {
            this.actionNamespace = action.getService().getServiceType().toString();
        }
    }

    addHeaders();
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:14,代码来源:OutgoingActionResponseMessage.java

示例13: RemoteActionInvocation

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
public RemoteActionInvocation(Action action,
                              ActionArgumentValue[] input,
                              ActionArgumentValue[] output,
                              RemoteClientInfo remoteClientInfo) {
    super(action, input, output, null);
    this.remoteClientInfo = remoteClientInfo;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:8,代码来源:RemoteActionInvocation.java

示例14: ActionInvocation

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
public ActionInvocation(Action<S> action,
                        ActionArgumentValue<S>[] input,
                        ActionArgumentValue<S>[] output,
                        ClientInfo clientInfo) {
    if (action == null) {
        throw new IllegalArgumentException("Action can not be null");
    }
    this.action = action;

    setInput(input);
    setOutput(output);

    this.clientInfo = clientInfo;
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:15,代码来源:ActionInvocation.java

示例15: buildActionInvocation

import org.fourthline.cling.model.meta.Action; //导入依赖的package包/类
private static ActionInvocation buildActionInvocation(Service service) {
     // not really a A_ARG_TYPE_Result type but close enough
    ActionArgument argument = new ActionArgument("FeatureList", "A_ARG_TYPE_Result", ActionArgument.Direction.OUT);
    Action action = new Action("X_GetFeatureList", new ActionArgument[]{argument});
    try {
        // package method must be reflected
        Method m = Action.class.getDeclaredMethod("setService", Service.class);
        m.setAccessible(true);
        m.invoke(action, service);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return new ActionInvocation(action);
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:15,代码来源:GetFeatureList.java


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