Francesco Furfari | ec7e175 | 2006-10-02 13:37:04 +0000 | [diff] [blame] | 1 | /*
|
| 2 | * Licensed to the Apache Software Foundation (ASF) under one
|
| 3 | * or more contributor license agreements. See the NOTICE file
|
| 4 | * distributed with this work for additional information
|
| 5 | * regarding copyright ownership. The ASF licenses this file
|
| 6 | * to you under the Apache License, Version 2.0 (the
|
| 7 | * "License"); you may not use this file except in compliance
|
| 8 | * with the License. You may obtain a copy of the License at
|
Francesco Furfari | d1072b5 | 2006-05-03 07:44:48 +0000 | [diff] [blame] | 9 | *
|
Francesco Furfari | ec7e175 | 2006-10-02 13:37:04 +0000 | [diff] [blame] | 10 | * http://www.apache.org/licenses/LICENSE-2.0
|
Francesco Furfari | d1072b5 | 2006-05-03 07:44:48 +0000 | [diff] [blame] | 11 | *
|
Francesco Furfari | ec7e175 | 2006-10-02 13:37:04 +0000 | [diff] [blame] | 12 | * Unless required by applicable law or agreed to in writing,
|
| 13 | * software distributed under the License is distributed on an
|
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 15 | * KIND, either express or implied. See the License for the
|
| 16 | * specific language governing permissions and limitations
|
| 17 | * under the License.
|
Francesco Furfari | d1072b5 | 2006-05-03 07:44:48 +0000 | [diff] [blame] | 18 | */
|
| 19 |
|
| 20 | package org.apache.felix.upnp.sample.binaryLight;
|
| 21 |
|
| 22 | import java.util.Dictionary;
|
| 23 | import java.util.Hashtable;
|
| 24 |
|
| 25 | import org.osgi.service.upnp.UPnPAction;
|
| 26 | import org.osgi.service.upnp.UPnPStateVariable;
|
| 27 |
|
| 28 | /*
|
Karl Pauls | d312acc | 2007-06-18 20:38:33 +0000 | [diff] [blame^] | 29 | * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
|
Francesco Furfari | d1072b5 | 2006-05-03 07:44:48 +0000 | [diff] [blame] | 30 | */
|
| 31 |
|
| 32 | public class GetTargetAction implements UPnPAction {
|
| 33 |
|
| 34 | final private String NAME = "GetTarget";
|
| 35 | final private String RET_TARGET_VALUE = "RetTargetValue";
|
| 36 | final private String[] OUT_ARG_NAMES = new String[]{RET_TARGET_VALUE};
|
| 37 | private UPnPStateVariable state;
|
| 38 | private LightModel model;
|
| 39 |
|
| 40 |
|
| 41 | public GetTargetAction(LightModel model,UPnPStateVariable state){
|
| 42 | this.state = state;
|
| 43 | this.model=model;
|
| 44 | }
|
| 45 |
|
| 46 | /* (non-Javadoc)
|
| 47 | * @see org.osgi.service.upnp.UPnPAction#getName()
|
| 48 | */
|
| 49 | public String getName() {
|
| 50 | return NAME;
|
| 51 | }
|
| 52 |
|
| 53 | /* (non-Javadoc)
|
| 54 | * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
|
| 55 | */
|
| 56 | public String getReturnArgumentName() {
|
| 57 | return null;
|
| 58 | }
|
| 59 |
|
| 60 | /* (non-Javadoc)
|
| 61 | * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
|
| 62 | */
|
| 63 | public String[] getInputArgumentNames() {
|
| 64 |
|
| 65 | return null;
|
| 66 | }
|
| 67 |
|
| 68 | /* (non-Javadoc)
|
| 69 | * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
|
| 70 | */
|
| 71 | public String[] getOutputArgumentNames() {
|
| 72 | return OUT_ARG_NAMES;
|
| 73 | }
|
| 74 |
|
| 75 | /* (non-Javadoc)
|
| 76 | * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
|
| 77 | */
|
| 78 | public UPnPStateVariable getStateVariable(String argumentName) {
|
| 79 | return state;
|
| 80 | }
|
| 81 |
|
| 82 | /* (non-Javadoc)
|
| 83 | * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
|
| 84 | */
|
| 85 | public Dictionary invoke(Dictionary args) throws Exception {
|
| 86 | boolean target = model.getTarget();
|
| 87 | Hashtable result = new Hashtable();
|
| 88 | result.put(RET_TARGET_VALUE,new Boolean(target));
|
| 89 | return result;
|
| 90 | }
|
| 91 | }
|