You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by le...@apache.org on 2008/07/08 18:59:57 UTC
svn commit: r674879 [8/12] - in /felix/trunk/upnp: ./ basedriver/
basedriver/src/main/java/org/apache/felix/upnp/basedriver/
basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/
basedriver/src/main/java/org/apache/felix/upnp/basedriver...
Modified: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockPane.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockPane.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockPane.java (original)
+++ felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockPane.java Tue Jul 8 09:59:54 2008
@@ -1,212 +1,212 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.FontMetrics;
-import java.awt.Graphics;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-
-import javax.imageio.ImageIO;
-import javax.swing.JPanel;
-
-/*
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class ClockPane extends JPanel // MouseListener
-{
- public ClockPane()
- {
- loadImage();
- initPanel();
- }
-
- ////////////////////////////////////////////////
- // Background
- ////////////////////////////////////////////////
-
-
- private BufferedImage panelmage;
-
- private void loadImage()
- {
-
- try {
- panelmage = ImageIO.read(ClockPane.class.getResourceAsStream("images/clock.jpg"));
- }
- catch (Exception e) {
- System.out.println(e);
- }
- }
-
- private BufferedImage getPaneImage()
- {
- return panelmage;
- }
-
- ////////////////////////////////////////////////
- // Background
- ////////////////////////////////////////////////
-
- private void initPanel()
- {
- BufferedImage panelmage = getPaneImage();
- setPreferredSize(new Dimension(panelmage.getWidth(), panelmage.getHeight()));
- }
-
- ////////////////////////////////////////////////
- // Font
- ////////////////////////////////////////////////
-
- private final static String DEFAULT_FONT_NAME = "Lucida Console";
- private final static int DEFAULT_TIME_FONT_SIZE = 60;
- private final static int DEFAULT_DATE_FONT_SIZE = 18;
- private final static int DEFAULT_SECOND_BLOCK_HEIGHT = 8;
- private final static int DEFAULT_SECOND_BLOCK_FONT_SIZE = 10;
-
- private Font timeFont = null;
- private Font dateFont = null;
- private Font secondFont = null;
-
- private Font getFont(Graphics g, int size)
- {
- Font font = new Font(DEFAULT_FONT_NAME, Font.PLAIN, size);
- if (font != null)
- return font;
- return g.getFont();
- }
-
- private Font getTimeFont(Graphics g)
- {
- if (timeFont == null)
- timeFont = getFont(g, DEFAULT_TIME_FONT_SIZE);
- return timeFont;
- }
-
- private Font getDateFont(Graphics g)
- {
- if (dateFont == null)
- dateFont = getFont(g, DEFAULT_DATE_FONT_SIZE);
- return dateFont;
- }
-
- private Font getSecondFont(Graphics g)
- {
- if (secondFont == null)
- secondFont = getFont(g, DEFAULT_SECOND_BLOCK_FONT_SIZE);
- return secondFont;
- }
-
- ////////////////////////////////////////////////
- // paint
- ////////////////////////////////////////////////
-
- private void drawClockInfo(Graphics g)
- {
- Clock clock = Clock.getInstance();
-
- int winWidth = getWidth();
- int winHeight = getHeight();
-
- g.setColor(Color.BLACK);
-
- //// Time String ////
-
- String timeStr = clock.getTimeString();
-
- Font timeFont = getTimeFont(g);
- g.setFont(timeFont);
-
- FontMetrics timeFontMetric = g.getFontMetrics();
- Rectangle2D timeStrBounds = timeFontMetric.getStringBounds(timeStr, g);
-
- int timeStrWidth = (int)timeStrBounds.getWidth();
- int timeStrHeight = (int)timeStrBounds.getHeight();
- int timeStrX = (winWidth-timeStrWidth)/2;
- int timeStrY = (winHeight+timeStrHeight)/2;
- int timeStrOffset = timeStrHeight/8/2;
- g.drawString(
- timeStr,
- timeStrX,
- timeStrY);
-
- //// Date String ////
-
- String dateStr = clock.getDateString();
-
- Font dateFont = getDateFont(g);
- g.setFont(dateFont);
-
- FontMetrics dateFontMetric = g.getFontMetrics();
- Rectangle2D dateStrBounds = dateFontMetric.getStringBounds(dateStr, g);
-
- g.drawString(
- dateStr,
- (winWidth-(int)dateStrBounds.getWidth())/2,
- timeStrY-timeStrHeight-timeStrOffset);
-
- //// Second Bar ////
-
- Font secFont = getSecondFont(g);
- g.setFont(secFont);
- int sec = clock.getSecond();
- int secBarBlockSize = timeStrWidth / 60;
- int secBarBlockY = timeStrY + timeStrOffset;
- for (int n=0; n<sec; n++) {
- int x = timeStrX + (secBarBlockSize*n);
- g.fillRect(
- x,
- secBarBlockY,
- secBarBlockSize-1,
- DEFAULT_SECOND_BLOCK_HEIGHT);
- }
- if (sec != 0 && (sec % 10) == 0) {
- int x = timeStrX + (secBarBlockSize*sec);
- g.drawString(
- Integer.toString(sec),
- x + secBarBlockSize,
- secBarBlockY + DEFAULT_SECOND_BLOCK_HEIGHT);
- }
- }
-
- private void clear(Graphics g)
- {
- g.setColor(Color.GRAY);
- g.clearRect(0, 0, getWidth(), getHeight());
- }
-
-
- private void drawPanelImage(Graphics g)
- {
- g.drawImage(getPaneImage(), 0, 0, null);
- }
-
- public void paint(Graphics g)
- {
- clear(g);
- drawPanelImage(g);
- drawClockInfo(g);
- }
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+
+import javax.imageio.ImageIO;
+import javax.swing.JPanel;
+
+/*
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class ClockPane extends JPanel // MouseListener
+{
+ public ClockPane()
+ {
+ loadImage();
+ initPanel();
+ }
+
+ ////////////////////////////////////////////////
+ // Background
+ ////////////////////////////////////////////////
+
+
+ private BufferedImage panelmage;
+
+ private void loadImage()
+ {
+
+ try {
+ panelmage = ImageIO.read(ClockPane.class.getResourceAsStream("images/clock.jpg"));
+ }
+ catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+
+ private BufferedImage getPaneImage()
+ {
+ return panelmage;
+ }
+
+ ////////////////////////////////////////////////
+ // Background
+ ////////////////////////////////////////////////
+
+ private void initPanel()
+ {
+ BufferedImage panelmage = getPaneImage();
+ setPreferredSize(new Dimension(panelmage.getWidth(), panelmage.getHeight()));
+ }
+
+ ////////////////////////////////////////////////
+ // Font
+ ////////////////////////////////////////////////
+
+ private final static String DEFAULT_FONT_NAME = "Lucida Console";
+ private final static int DEFAULT_TIME_FONT_SIZE = 60;
+ private final static int DEFAULT_DATE_FONT_SIZE = 18;
+ private final static int DEFAULT_SECOND_BLOCK_HEIGHT = 8;
+ private final static int DEFAULT_SECOND_BLOCK_FONT_SIZE = 10;
+
+ private Font timeFont = null;
+ private Font dateFont = null;
+ private Font secondFont = null;
+
+ private Font getFont(Graphics g, int size)
+ {
+ Font font = new Font(DEFAULT_FONT_NAME, Font.PLAIN, size);
+ if (font != null)
+ return font;
+ return g.getFont();
+ }
+
+ private Font getTimeFont(Graphics g)
+ {
+ if (timeFont == null)
+ timeFont = getFont(g, DEFAULT_TIME_FONT_SIZE);
+ return timeFont;
+ }
+
+ private Font getDateFont(Graphics g)
+ {
+ if (dateFont == null)
+ dateFont = getFont(g, DEFAULT_DATE_FONT_SIZE);
+ return dateFont;
+ }
+
+ private Font getSecondFont(Graphics g)
+ {
+ if (secondFont == null)
+ secondFont = getFont(g, DEFAULT_SECOND_BLOCK_FONT_SIZE);
+ return secondFont;
+ }
+
+ ////////////////////////////////////////////////
+ // paint
+ ////////////////////////////////////////////////
+
+ private void drawClockInfo(Graphics g)
+ {
+ Clock clock = Clock.getInstance();
+
+ int winWidth = getWidth();
+ int winHeight = getHeight();
+
+ g.setColor(Color.BLACK);
+
+ //// Time String ////
+
+ String timeStr = clock.getTimeString();
+
+ Font timeFont = getTimeFont(g);
+ g.setFont(timeFont);
+
+ FontMetrics timeFontMetric = g.getFontMetrics();
+ Rectangle2D timeStrBounds = timeFontMetric.getStringBounds(timeStr, g);
+
+ int timeStrWidth = (int)timeStrBounds.getWidth();
+ int timeStrHeight = (int)timeStrBounds.getHeight();
+ int timeStrX = (winWidth-timeStrWidth)/2;
+ int timeStrY = (winHeight+timeStrHeight)/2;
+ int timeStrOffset = timeStrHeight/8/2;
+ g.drawString(
+ timeStr,
+ timeStrX,
+ timeStrY);
+
+ //// Date String ////
+
+ String dateStr = clock.getDateString();
+
+ Font dateFont = getDateFont(g);
+ g.setFont(dateFont);
+
+ FontMetrics dateFontMetric = g.getFontMetrics();
+ Rectangle2D dateStrBounds = dateFontMetric.getStringBounds(dateStr, g);
+
+ g.drawString(
+ dateStr,
+ (winWidth-(int)dateStrBounds.getWidth())/2,
+ timeStrY-timeStrHeight-timeStrOffset);
+
+ //// Second Bar ////
+
+ Font secFont = getSecondFont(g);
+ g.setFont(secFont);
+ int sec = clock.getSecond();
+ int secBarBlockSize = timeStrWidth / 60;
+ int secBarBlockY = timeStrY + timeStrOffset;
+ for (int n=0; n<sec; n++) {
+ int x = timeStrX + (secBarBlockSize*n);
+ g.fillRect(
+ x,
+ secBarBlockY,
+ secBarBlockSize-1,
+ DEFAULT_SECOND_BLOCK_HEIGHT);
+ }
+ if (sec != 0 && (sec % 10) == 0) {
+ int x = timeStrX + (secBarBlockSize*sec);
+ g.drawString(
+ Integer.toString(sec),
+ x + secBarBlockSize,
+ secBarBlockY + DEFAULT_SECOND_BLOCK_HEIGHT);
+ }
+ }
+
+ private void clear(Graphics g)
+ {
+ g.setColor(Color.GRAY);
+ g.clearRect(0, 0, getWidth(), getHeight());
+ }
+
+
+ private void drawPanelImage(Graphics g)
+ {
+ g.drawImage(getPaneImage(), 0, 0, null);
+ }
+
+ public void paint(Graphics g)
+ {
+ clear(g);
+ drawPanelImage(g);
+ drawClockInfo(g);
+ }
+}
+
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockPane.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockPane.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockPane.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/GetTimeAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/GetTimeAction.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/GetTimeAction.java (original)
+++ felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/GetTimeAction.java Tue Jul 8 09:59:54 2008
@@ -1,89 +1,89 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-/*
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class GetTimeAction implements UPnPAction {
-
- final private String NAME = "GetTime";
- final private String RESULT_STATUS = "CurrentTime";
- final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
- private TimeStateVariable time;
-
-
- public GetTimeAction(TimeStateVariable time){
- this.time = time;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getName()
- */
- public String getName() {
- return NAME;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
- */
- public String getReturnArgumentName() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
- */
- public String[] getInputArgumentNames() {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
- */
- public String[] getOutputArgumentNames() {
- return OUT_ARG_NAMES;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
- */
- public UPnPStateVariable getStateVariable(String argumentName) {
- return time;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
- */
- public Dictionary invoke(Dictionary args) throws Exception {
- String value = time.getCurrentTime();
- Hashtable result = new Hashtable();
- result.put(RESULT_STATUS,value);
- return result;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/*
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class GetTimeAction implements UPnPAction {
+
+ final private String NAME = "GetTime";
+ final private String RESULT_STATUS = "CurrentTime";
+ final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
+ private TimeStateVariable time;
+
+
+ public GetTimeAction(TimeStateVariable time){
+ this.time = time;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getName()
+ */
+ public String getName() {
+ return NAME;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+ */
+ public String getReturnArgumentName() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+ */
+ public String[] getInputArgumentNames() {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+ */
+ public String[] getOutputArgumentNames() {
+ return OUT_ARG_NAMES;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+ */
+ public UPnPStateVariable getStateVariable(String argumentName) {
+ return time;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+ */
+ public Dictionary invoke(Dictionary args) throws Exception {
+ String value = time.getCurrentTime();
+ Hashtable result = new Hashtable();
+ result.put(RESULT_STATUS,value);
+ return result;
+ }
+}
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/GetTimeAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/GetTimeAction.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/GetTimeAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ResultStateVariable.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ResultStateVariable.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ResultStateVariable.java (original)
+++ felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ResultStateVariable.java Tue Jul 8 09:59:54 2008
@@ -1,96 +1,96 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class ResultStateVariable implements UPnPStateVariable{
-
- final private String NAME = "Result";
- final private String DEFAULT_VALUE = "";
- private Clock clock;
-
-
- public ResultStateVariable(){
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getName()
- */
- public String getName() {
- return NAME;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
- */
- public Class getJavaDataType() {
- return String.class;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
- */
- public String getUPnPDataType() {
- return TYPE_STRING;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
- */
- public Object getDefaultValue() {
- return DEFAULT_VALUE;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
- */
- public String[] getAllowedValues() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
- */
- public Number getMinimum() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
- */
- public Number getMaximum() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
- */
- public Number getStep() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
- */
- public boolean sendsEvents() {
- return false;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+public class ResultStateVariable implements UPnPStateVariable{
+
+ final private String NAME = "Result";
+ final private String DEFAULT_VALUE = "";
+ private Clock clock;
+
+
+ public ResultStateVariable(){
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+ */
+ public String getName() {
+ return NAME;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+ */
+ public Class getJavaDataType() {
+ return String.class;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+ */
+ public String getUPnPDataType() {
+ return TYPE_STRING;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+ */
+ public Object getDefaultValue() {
+ return DEFAULT_VALUE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+ */
+ public String[] getAllowedValues() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+ */
+ public Number getMinimum() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+ */
+ public Number getMaximum() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+ */
+ public Number getStep() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+ */
+ public boolean sendsEvents() {
+ return false;
+ }
+
+}
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ResultStateVariable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ResultStateVariable.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ResultStateVariable.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/SetTimeAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/SetTimeAction.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/SetTimeAction.java (original)
+++ felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/SetTimeAction.java Tue Jul 8 09:59:54 2008
@@ -1,97 +1,97 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-
-import java.beans.PropertyChangeEvent;
-import java.util.Dictionary;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-/*
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class SetTimeAction implements UPnPAction {
-
- final private String NAME = "SetTime";
- final private String NEW_TIME_VALUE = "NewTime";
- final private String NEW_RESULT_VALUE = "Result";
- final private String[] IN_ARG_NAMES = new String[]{NEW_TIME_VALUE};
- final private String[] OUT_ARG_NAMES = new String[]{NEW_RESULT_VALUE};
- private UPnPStateVariable time,result;
-
-
- public SetTimeAction(UPnPStateVariable time,UPnPStateVariable result){
- this.time = time;
- this.result=result;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getName()
- */
- public String getName() {
- return NAME;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
- */
- public String getReturnArgumentName() {
- return "Result";
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
- */
- public String[] getInputArgumentNames() {
- return IN_ARG_NAMES;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
- */
- public String[] getOutputArgumentNames() {
- return OUT_ARG_NAMES;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
- */
- public UPnPStateVariable getStateVariable(String argumentName) {
- if (argumentName.equals("NewTime")) return time;
- else if (argumentName.equals("Result")) return result;
- else return null;
- }
-
- /* (non-Javadoc)
- *
- * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
- */
- public Dictionary invoke(Dictionary args) throws Exception {
- Long newValue = (Long) args.get(NEW_TIME_VALUE);
- Long oldValue = (Long) ((TimeStateVariable) time).getCurrentValue();
- ((TimeStateVariable) time).setCurrentTime(newValue.longValue());
- ClockDevice.notifier.propertyChange(new PropertyChangeEvent(time,"Time",oldValue,newValue));
- args.remove(NEW_TIME_VALUE);
- args.put(NEW_RESULT_VALUE,((TimeStateVariable) time).getCurrentTime());
- return args;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+
+import java.beans.PropertyChangeEvent;
+import java.util.Dictionary;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/*
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class SetTimeAction implements UPnPAction {
+
+ final private String NAME = "SetTime";
+ final private String NEW_TIME_VALUE = "NewTime";
+ final private String NEW_RESULT_VALUE = "Result";
+ final private String[] IN_ARG_NAMES = new String[]{NEW_TIME_VALUE};
+ final private String[] OUT_ARG_NAMES = new String[]{NEW_RESULT_VALUE};
+ private UPnPStateVariable time,result;
+
+
+ public SetTimeAction(UPnPStateVariable time,UPnPStateVariable result){
+ this.time = time;
+ this.result=result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getName()
+ */
+ public String getName() {
+ return NAME;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+ */
+ public String getReturnArgumentName() {
+ return "Result";
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+ */
+ public String[] getInputArgumentNames() {
+ return IN_ARG_NAMES;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+ */
+ public String[] getOutputArgumentNames() {
+ return OUT_ARG_NAMES;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+ */
+ public UPnPStateVariable getStateVariable(String argumentName) {
+ if (argumentName.equals("NewTime")) return time;
+ else if (argumentName.equals("Result")) return result;
+ else return null;
+ }
+
+ /* (non-Javadoc)
+ *
+ * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+ */
+ public Dictionary invoke(Dictionary args) throws Exception {
+ Long newValue = (Long) args.get(NEW_TIME_VALUE);
+ Long oldValue = (Long) ((TimeStateVariable) time).getCurrentValue();
+ ((TimeStateVariable) time).setCurrentTime(newValue.longValue());
+ ClockDevice.notifier.propertyChange(new PropertyChangeEvent(time,"Time",oldValue,newValue));
+ args.remove(NEW_TIME_VALUE);
+ args.put(NEW_RESULT_VALUE,((TimeStateVariable) time).getCurrentTime());
+ return args;
+ }
+}
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/SetTimeAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/SetTimeAction.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/SetTimeAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimeStateVariable.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimeStateVariable.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimeStateVariable.java (original)
+++ felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimeStateVariable.java Tue Jul 8 09:59:54 2008
@@ -1,110 +1,110 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-import java.util.Date;
-
-import org.osgi.service.upnp.UPnPLocalStateVariable;
-
-public class TimeStateVariable implements UPnPLocalStateVariable{
-
- final private String NAME = "Time";
- final private String DEFAULT_VALUE = "";
- private Clock clock;
-
-
- public TimeStateVariable(){
- clock = Clock.getInstance();
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getName()
- */
- public String getName() {
- return NAME;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
- */
- public Class getJavaDataType() {
- return Long.class;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
- */
- public String getUPnPDataType() {
- return TYPE_TIME;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
- */
- public Object getDefaultValue() {
- return DEFAULT_VALUE;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
- */
- public String[] getAllowedValues() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
- */
- public Number getMinimum() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
- */
- public Number getMaximum() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
- */
- public Number getStep() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
- */
- public boolean sendsEvents() {
- return true;
- }
-
- public String getCurrentTime(){
- return clock.getTimeString();
- }
-
- public void setCurrentTime(long milliseconds){
- clock.getCalendar().setTime(new Date(milliseconds));
- }
-
- public Object getCurrentValue() {
- return new Long(clock.getCalendar().getTime().getTime());
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+import java.util.Date;
+
+import org.osgi.service.upnp.UPnPLocalStateVariable;
+
+public class TimeStateVariable implements UPnPLocalStateVariable{
+
+ final private String NAME = "Time";
+ final private String DEFAULT_VALUE = "";
+ private Clock clock;
+
+
+ public TimeStateVariable(){
+ clock = Clock.getInstance();
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+ */
+ public String getName() {
+ return NAME;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+ */
+ public Class getJavaDataType() {
+ return Long.class;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+ */
+ public String getUPnPDataType() {
+ return TYPE_TIME;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+ */
+ public Object getDefaultValue() {
+ return DEFAULT_VALUE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+ */
+ public String[] getAllowedValues() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+ */
+ public Number getMinimum() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+ */
+ public Number getMaximum() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+ */
+ public Number getStep() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+ */
+ public boolean sendsEvents() {
+ return true;
+ }
+
+ public String getCurrentTime(){
+ return clock.getTimeString();
+ }
+
+ public void setCurrentTime(long milliseconds){
+ clock.getCalendar().setTime(new Date(milliseconds));
+ }
+
+ public Object getCurrentValue() {
+ return new Long(clock.getCalendar().getTime().getTime());
+ }
+}
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimeStateVariable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimeStateVariable.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimeStateVariable.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java (original)
+++ felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java Tue Jul 8 09:59:54 2008
@@ -1,106 +1,106 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.clock;
-
-import java.util.HashMap;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-/*
-* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
-*/
-
-public class TimerService implements UPnPService {
- final private String SERVICE_ID = "urn:schemas-upnp-org:serviceId:timer:1";
- final private String SERVICE_TYPE = "urn:schemas-upnp-org:service:timer:1";
- final private String VERSION ="1";
-
- private UPnPStateVariable time,result;
- private UPnPStateVariable[] states;
- private HashMap actions = new HashMap();
-
-
- public TimerService(){
- time = new TimeStateVariable();
- result = new ResultStateVariable();
- this.states = new UPnPStateVariable[]{time,result};
-
- UPnPAction setTime= new SetTimeAction(time,result);
- UPnPAction getTime = new GetTimeAction((TimeStateVariable)time);
- actions.put(setTime.getName(),setTime);
- actions.put(getTime.getName(),getTime);
-
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getId()
- */
- public String getId() {
- return SERVICE_ID;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getType()
- */
- public String getType() {
- return SERVICE_TYPE;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getVersion()
- */
- public String getVersion() {
- return VERSION;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
- */
- public UPnPAction getAction(String name) {
- return (UPnPAction)actions.get(name);
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getActions()
- */
- public UPnPAction[] getActions() {
- return (UPnPAction[])(actions.values()).toArray(new UPnPAction[]{});
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getStateVariables()
- */
- public UPnPStateVariable[] getStateVariables() {
- return states;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
- */
- public UPnPStateVariable getStateVariable(String name) {
- if (name.equals("Time"))
- return time;
- else if (name.equals("Result"))
- return result;
- else return null;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.clock;
+
+import java.util.HashMap;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/*
+* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+*/
+
+public class TimerService implements UPnPService {
+ final private String SERVICE_ID = "urn:schemas-upnp-org:serviceId:timer:1";
+ final private String SERVICE_TYPE = "urn:schemas-upnp-org:service:timer:1";
+ final private String VERSION ="1";
+
+ private UPnPStateVariable time,result;
+ private UPnPStateVariable[] states;
+ private HashMap actions = new HashMap();
+
+
+ public TimerService(){
+ time = new TimeStateVariable();
+ result = new ResultStateVariable();
+ this.states = new UPnPStateVariable[]{time,result};
+
+ UPnPAction setTime= new SetTimeAction(time,result);
+ UPnPAction getTime = new GetTimeAction((TimeStateVariable)time);
+ actions.put(setTime.getName(),setTime);
+ actions.put(getTime.getName(),getTime);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getId()
+ */
+ public String getId() {
+ return SERVICE_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getType()
+ */
+ public String getType() {
+ return SERVICE_TYPE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getVersion()
+ */
+ public String getVersion() {
+ return VERSION;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
+ */
+ public UPnPAction getAction(String name) {
+ return (UPnPAction)actions.get(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getActions()
+ */
+ public UPnPAction[] getActions() {
+ return (UPnPAction[])(actions.values()).toArray(new UPnPAction[]{});
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getStateVariables()
+ */
+ public UPnPStateVariable[] getStateVariables() {
+ return states;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
+ */
+ public UPnPStateVariable getStateVariable(String name) {
+ if (name.equals("Time"))
+ return time;
+ else if (name.equals("Result"))
+ return result;
+ else return null;
+ }
+}
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/TimerService.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Propchange: felix/trunk/upnp/samples/clock/src/main/resources/org/apache/felix/upnp/sample/clock/images/clock.gif
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Tue Jul 8 09:59:54 2008
@@ -1 +1 @@
-application/octet-stream
+image/gif
Propchange: felix/trunk/upnp/samples/clock/src/main/resources/org/apache/felix/upnp/sample/clock/images/logo.gif
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Tue Jul 8 09:59:54 2008
@@ -1 +1 @@
-application/octet-stream
+image/gif
Modified: felix/trunk/upnp/samples/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/pom.xml?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/pom.xml (original)
+++ felix/trunk/upnp/samples/pom.xml Tue Jul 8 09:59:54 2008
@@ -16,46 +16,46 @@
specific language governing permissions and limitations
under the License.
-->
-<project>
- <parent>
- <groupId>org.apache.felix</groupId>
- <artifactId>felix</artifactId>
- <version>1.0.2</version>
- <relativePath>../../pom/pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <packaging>pom</packaging>
- <name>Apache Felix UPnP Examples: Build</name>
- <artifactId>upnp.examples.build</artifactId>
- <version>0.9.0-SNAPSHOT</version>
-
- <profiles>
- <profile>
- <id>packaging-bundle</id>
- <activation>
- <property>
- <name>packaging</name>
- <value>bundle</value>
- </property>
- </activation>
- <modules>
- <module>binarylight</module>
- <module>clock</module>
- <module>tv</module>
- </modules>
- </profile>
- <profile>
- <id>default</id>
- <activation>
- <property>
- <name>!packaging</name>
- </property>
- </activation>
- <modules>
- <module>binarylight</module>
- <module>clock</module>
- <module>tv</module>
- </modules>
- </profile>
- </profiles>
-</project>
+<project>
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>1.0.2</version>
+ <relativePath>../../pom/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <name>Apache Felix UPnP Examples: Build</name>
+ <artifactId>upnp.examples.build</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+
+ <profiles>
+ <profile>
+ <id>packaging-bundle</id>
+ <activation>
+ <property>
+ <name>packaging</name>
+ <value>bundle</value>
+ </property>
+ </activation>
+ <modules>
+ <module>binarylight</module>
+ <module>clock</module>
+ <module>tv</module>
+ </modules>
+ </profile>
+ <profile>
+ <id>default</id>
+ <activation>
+ <property>
+ <name>!packaging</name>
+ </property>
+ </activation>
+ <modules>
+ <module>binarylight</module>
+ <module>clock</module>
+ <module>tv</module>
+ </modules>
+ </profile>
+ </profiles>
+</project>
Propchange: felix/trunk/upnp/samples/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: felix/trunk/upnp/samples/tv/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/tv/pom.xml?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/tv/pom.xml (original)
+++ felix/trunk/upnp/samples/tv/pom.xml Tue Jul 8 09:59:54 2008
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -17,60 +17,60 @@
specific language governing permissions and limitations
under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>felix</artifactId>
- <groupId>org.apache.felix</groupId>
- <version>1.0.2</version>
- <relativePath>../../../pom/pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.upnp.sample.tv</artifactId>
- <packaging>bundle</packaging>
- <name>Apache Felix UPnP Sample TV</name>
- <version>0.2.0-SNAPSHOT</version>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>felix</artifactId>
+ <groupId>org.apache.felix</groupId>
+ <version>1.0.2</version>
+ <relativePath>../../../pom/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.upnp.sample.tv</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Felix UPnP Sample TV</name>
+ <version>0.2.0-SNAPSHOT</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Name>${pom.name}</Bundle-Name>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Name>${pom.name}</Bundle-Name>
<Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
- <Bundle-Author>Matteo Demuru <demuru@apache.org>,Francesco Furfari <furfari@apache.org>,Stefano "Kismet" Lenzi <lenzi@apache.org></Bundle-Author>
- <Bundle-Description>CyberLink Tv clone to test UPnPBase driver</Bundle-Description>
- <Bundle-SymbolicName>org.apache.felix.upnp.sample.tv</Bundle-SymbolicName>
- <Bundle-Activator>org.apache.felix.upnp.sample.tv.Activator</Bundle-Activator>
- <Private-Package>org.apache.felix.upnp.sample.tv.*</Private-Package>
- <Import-Package>*</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>${pom.groupId}</groupId>
- <artifactId>org.osgi.compendium</artifactId>
+ <Bundle-Author>Matteo Demuru <demuru@apache.org>,Francesco Furfari <furfari@apache.org>,Stefano "Kismet" Lenzi <lenzi@apache.org></Bundle-Author>
+ <Bundle-Description>CyberLink Tv clone to test UPnPBase driver</Bundle-Description>
+ <Bundle-SymbolicName>org.apache.felix.upnp.sample.tv</Bundle-SymbolicName>
+ <Bundle-Activator>org.apache.felix.upnp.sample.tv.Activator</Bundle-Activator>
+ <Private-Package>org.apache.felix.upnp.sample.tv.*</Private-Package>
+ <Import-Package>*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
<version>1.0.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.upnp.extra</artifactId>
- <version>0.3.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
-
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.upnp.extra</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
+
Propchange: felix/trunk/upnp/samples/tv/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/tv/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/tv/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/Activator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/Activator.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/Activator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/GetPowerAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/GetPowerAction.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/GetPowerAction.java (original)
+++ felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/GetPowerAction.java Tue Jul 8 09:59:54 2008
@@ -1,85 +1,85 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class GetPowerAction implements UPnPAction {
-
- final private String NAME = "GetPower";
- final private String RESULT_STATUS = "Power";
- final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
- private PowerStateVariable power;
-
-
- public GetPowerAction(PowerStateVariable power){
- this.power = power;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getName()
- */
- public String getName() {
- return NAME;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
- */
- public String getReturnArgumentName() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
- */
- public String[] getInputArgumentNames() {
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
- */
- public String[] getOutputArgumentNames() {
- return OUT_ARG_NAMES;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
- */
- public UPnPStateVariable getStateVariable(String argumentName) {
- return power;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
- */
- public Dictionary invoke(Dictionary args) throws Exception {
- Boolean value = power.getCurrentPower();
- Hashtable result = new Hashtable();
- result.put(RESULT_STATUS,value);
- return result;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+public class GetPowerAction implements UPnPAction {
+
+ final private String NAME = "GetPower";
+ final private String RESULT_STATUS = "Power";
+ final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
+ private PowerStateVariable power;
+
+
+ public GetPowerAction(PowerStateVariable power){
+ this.power = power;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getName()
+ */
+ public String getName() {
+ return NAME;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+ */
+ public String getReturnArgumentName() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+ */
+ public String[] getInputArgumentNames() {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+ */
+ public String[] getOutputArgumentNames() {
+ return OUT_ARG_NAMES;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+ */
+ public UPnPStateVariable getStateVariable(String argumentName) {
+ return power;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+ */
+ public Dictionary invoke(Dictionary args) throws Exception {
+ Boolean value = power.getCurrentPower();
+ Hashtable result = new Hashtable();
+ result.put(RESULT_STATUS,value);
+ return result;
+ }
+}
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/GetPowerAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/GetPowerAction.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/GetPowerAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerService.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerService.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerService.java (original)
+++ felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerService.java Tue Jul 8 09:59:54 2008
@@ -1,103 +1,103 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-
-import java.util.HashMap;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class PowerService implements UPnPService {
- final private String SERVICE_ID = "urn:schemas-upnp-org:serviceId:power:1";
- final private String SERVICE_TYPE = "urn:schemas-upnp-org:service:power:1";
- final private String VERSION ="1";
-
- private PowerStateVariable power;
- private ResultStateVariable result;
- private UPnPStateVariable[] states;
- private HashMap actions = new HashMap();
-
-
- public PowerService(){
- power = new PowerStateVariable();
- result = new ResultStateVariable();
- this.states = new UPnPStateVariable[]{power,result};
-
- UPnPAction setPower= new SetPowerAction(power,result);
- UPnPAction getPower = new GetPowerAction(power);
- actions.put(setPower.getName(),setPower);
- actions.put(getPower.getName(),getPower);
-
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getId()
- */
- public String getId() {
- return SERVICE_ID;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getType()
- */
- public String getType() {
- return SERVICE_TYPE;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getVersion()
- */
- public String getVersion() {
- return VERSION;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
- */
- public UPnPAction getAction(String name) {
- return (UPnPAction)actions.get(name);
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getActions()
- */
- public UPnPAction[] getActions() {
- return (UPnPAction[])(actions.values()).toArray(new UPnPAction[]{});
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getStateVariables()
- */
- public UPnPStateVariable[] getStateVariables() {
- return states;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
- */
- public UPnPStateVariable getStateVariable(String name) {
- if (name.equals("Power"))
- return power;
- else if (name.equals("Result"))
- return result;
- else return null;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+
+import java.util.HashMap;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+public class PowerService implements UPnPService {
+ final private String SERVICE_ID = "urn:schemas-upnp-org:serviceId:power:1";
+ final private String SERVICE_TYPE = "urn:schemas-upnp-org:service:power:1";
+ final private String VERSION ="1";
+
+ private PowerStateVariable power;
+ private ResultStateVariable result;
+ private UPnPStateVariable[] states;
+ private HashMap actions = new HashMap();
+
+
+ public PowerService(){
+ power = new PowerStateVariable();
+ result = new ResultStateVariable();
+ this.states = new UPnPStateVariable[]{power,result};
+
+ UPnPAction setPower= new SetPowerAction(power,result);
+ UPnPAction getPower = new GetPowerAction(power);
+ actions.put(setPower.getName(),setPower);
+ actions.put(getPower.getName(),getPower);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getId()
+ */
+ public String getId() {
+ return SERVICE_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getType()
+ */
+ public String getType() {
+ return SERVICE_TYPE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getVersion()
+ */
+ public String getVersion() {
+ return VERSION;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
+ */
+ public UPnPAction getAction(String name) {
+ return (UPnPAction)actions.get(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getActions()
+ */
+ public UPnPAction[] getActions() {
+ return (UPnPAction[])(actions.values()).toArray(new UPnPAction[]{});
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getStateVariables()
+ */
+ public UPnPStateVariable[] getStateVariables() {
+ return states;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
+ */
+ public UPnPStateVariable getStateVariable(String name) {
+ if (name.equals("Power"))
+ return power;
+ else if (name.equals("Result"))
+ return result;
+ else return null;
+ }
+}
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerService.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerService.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerStateVariable.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerStateVariable.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerStateVariable.java (original)
+++ felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerStateVariable.java Tue Jul 8 09:59:54 2008
@@ -1,120 +1,120 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-import java.beans.PropertyChangeEvent;
-
-import org.osgi.service.upnp.UPnPLocalStateVariable;
-
-import org.apache.felix.upnp.extra.util.UPnPEventNotifier;
-
-public class PowerStateVariable implements UPnPLocalStateVariable {
-
- final private String NAME = "Power";
- final private Boolean DEFAULT_VALUE = Boolean.FALSE;
- private UPnPEventNotifier notifier;
- private Boolean power = Boolean.FALSE;
-
- public PowerStateVariable(){
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getName()
- */
- public String getName() {
- return NAME;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
- */
- public Class getJavaDataType() {
- return Boolean.class;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
- */
- public String getUPnPDataType() {
- return TYPE_BOOLEAN;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
- */
- public Object getDefaultValue() {
- return DEFAULT_VALUE;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
- */
- public String[] getAllowedValues() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
- */
- public Number getMinimum() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
- */
- public Number getMaximum() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
- */
- public Number getStep() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
- */
- public boolean sendsEvents() {
- return true;
- }
-
- public Boolean getCurrentPower(){
- return power;
- }
-
- public void setPower(Boolean value){
- if (!value.equals(power)) {
- Boolean oldValue = power;
- power = value;
- if (notifier != null)
- notifier.propertyChange(new PropertyChangeEvent(this,"Power",oldValue,value));
- }
- }
-
- public void setNotifier(UPnPEventNotifier notifier){
- this.notifier = notifier;
- }
-
- public Object getCurrentValue() {
- return power;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+import java.beans.PropertyChangeEvent;
+
+import org.osgi.service.upnp.UPnPLocalStateVariable;
+
+import org.apache.felix.upnp.extra.util.UPnPEventNotifier;
+
+public class PowerStateVariable implements UPnPLocalStateVariable {
+
+ final private String NAME = "Power";
+ final private Boolean DEFAULT_VALUE = Boolean.FALSE;
+ private UPnPEventNotifier notifier;
+ private Boolean power = Boolean.FALSE;
+
+ public PowerStateVariable(){
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+ */
+ public String getName() {
+ return NAME;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+ */
+ public Class getJavaDataType() {
+ return Boolean.class;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+ */
+ public String getUPnPDataType() {
+ return TYPE_BOOLEAN;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+ */
+ public Object getDefaultValue() {
+ return DEFAULT_VALUE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+ */
+ public String[] getAllowedValues() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+ */
+ public Number getMinimum() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+ */
+ public Number getMaximum() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+ */
+ public Number getStep() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+ */
+ public boolean sendsEvents() {
+ return true;
+ }
+
+ public Boolean getCurrentPower(){
+ return power;
+ }
+
+ public void setPower(Boolean value){
+ if (!value.equals(power)) {
+ Boolean oldValue = power;
+ power = value;
+ if (notifier != null)
+ notifier.propertyChange(new PropertyChangeEvent(this,"Power",oldValue,value));
+ }
+ }
+
+ public void setNotifier(UPnPEventNotifier notifier){
+ this.notifier = notifier;
+ }
+
+ public Object getCurrentValue() {
+ return power;
+ }
+}
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerStateVariable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerStateVariable.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/PowerStateVariable.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/ResultStateVariable.java
URL: http://svn.apache.org/viewvc/felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/ResultStateVariable.java?rev=674879&r1=674878&r2=674879&view=diff
==============================================================================
--- felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/ResultStateVariable.java (original)
+++ felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/ResultStateVariable.java Tue Jul 8 09:59:54 2008
@@ -1,95 +1,95 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.upnp.sample.tv;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class ResultStateVariable implements UPnPStateVariable{
-
- final private String NAME = "Result";
- final private Boolean DEFAULT_VALUE = Boolean.FALSE;
-
-
- public ResultStateVariable(){
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getName()
- */
- public String getName() {
- return NAME;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
- */
- public Class getJavaDataType() {
- return Boolean.class;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
- */
- public String getUPnPDataType() {
- return TYPE_BOOLEAN;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
- */
- public Object getDefaultValue() {
- return DEFAULT_VALUE;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
- */
- public String[] getAllowedValues() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
- */
- public Number getMinimum() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
- */
- public Number getMaximum() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
- */
- public Number getStep() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
- */
- public boolean sendsEvents() {
- return false;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.felix.upnp.sample.tv;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+public class ResultStateVariable implements UPnPStateVariable{
+
+ final private String NAME = "Result";
+ final private Boolean DEFAULT_VALUE = Boolean.FALSE;
+
+
+ public ResultStateVariable(){
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+ */
+ public String getName() {
+ return NAME;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+ */
+ public Class getJavaDataType() {
+ return Boolean.class;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+ */
+ public String getUPnPDataType() {
+ return TYPE_BOOLEAN;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+ */
+ public Object getDefaultValue() {
+ return DEFAULT_VALUE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+ */
+ public String[] getAllowedValues() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+ */
+ public Number getMinimum() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+ */
+ public Number getMaximum() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+ */
+ public Number getStep() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+ */
+ public boolean sendsEvents() {
+ return false;
+ }
+
+}
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/ResultStateVariable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/ResultStateVariable.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/ResultStateVariable.java
------------------------------------------------------------------------------
svn:mime-type = text/plain