Move this non-core project to Ace-extras.
git-svn-id: https://svn.apache.org/repos/asf/ace/trunk@1727267 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.ace.location.upnp/.classpath b/org.apache.ace.location.upnp/.classpath
deleted file mode 100644
index 232a035..0000000
--- a/org.apache.ace.location.upnp/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry kind="con" path="aQute.bnd.classpath.container"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.apache.ace.location.upnp/.project b/org.apache.ace.location.upnp/.project
deleted file mode 100644
index e2c8d4d..0000000
--- a/org.apache.ace.location.upnp/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.apache.ace.location.upnp</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>bndtools.core.bndbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>bndtools.core.bndnature</nature>
- </natures>
-</projectDescription>
diff --git a/org.apache.ace.location.upnp/bnd.bnd b/org.apache.ace.location.upnp/bnd.bnd
deleted file mode 100644
index 8718648..0000000
--- a/org.apache.ace.location.upnp/bnd.bnd
+++ /dev/null
@@ -1,16 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-
--buildpath: \
- ${^-buildpath},\
- osgi.core;version=6.0.0,\
- osgi.cmpn,\
- org.apache.felix.http.servlet-api,\
- org.apache.felix.dependencymanager
-Export-Package: org.apache.ace.location
-Bundle-Version: 1.0.2
-Bundle-Name: Apache ACE Location UPnP
-Bundle-Description: Registers a UPnP based Location service
-Private-Package: org.apache.ace.location.upnp,\
- org.apache.ace.location.upnp.actions,\
- org.apache.ace.location.upnp.util
-Bundle-Activator: org.apache.ace.location.upnp.Activator
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/LocationService.java b/org.apache.ace.location.upnp/src/org/apache/ace/location/LocationService.java
deleted file mode 100644
index 23d56af..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/LocationService.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.ace.location;
-
-import java.net.URL;
-
-import aQute.bnd.annotation.ProviderType;
-
-@ProviderType
-public interface LocationService
-{
- public URL getLocation();
- public String getServerType();
- public int getServerLoad();
-}
\ No newline at end of file
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/packageinfo b/org.apache.ace.location.upnp/src/org/apache/ace/location/packageinfo
deleted file mode 100644
index a4f1546..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.0
\ No newline at end of file
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/Activator.java b/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/Activator.java
deleted file mode 100644
index 66ad1a6..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/Activator.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.ace.location.upnp;
-
-import org.apache.ace.location.LocationService;
-import org.apache.ace.location.upnp.util.HostUtil;
-import org.apache.felix.dm.DependencyActivatorBase;
-import org.apache.felix.dm.DependencyManager;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.http.HttpService;
-import org.osgi.service.upnp.UPnPDevice;
-
-public class Activator extends DependencyActivatorBase {
- @Override
- public void init(BundleContext context, DependencyManager manager) throws Exception {
-
- //we need these to construct the actual presentation url for the service
- String httpPort = context.getProperty("org.osgi.service.http.port");
- int port = (httpPort != null ? Integer.valueOf(httpPort) : 8080);
- String host = HostUtil.getHost();
-
- ProvisioningDevice psDevice = new ProvisioningDevice(host, port);
-
- //this service is configured with the correct settings
- manager.add(createComponent()
- .setImplementation(new LocationServiceImpl(host, port))
- .setInterface(LocationService.class.getName(), null)
- .add(createConfigurationDependency().setPid(LocationServiceImpl.PID))
- );
-
- //this service depends on the highest ranked location service
- manager.add(createComponent()
- .setImplementation(psDevice)
- .setInterface(UPnPDevice.class.getName(), psDevice.getDescriptions(null))
- .setComposition("getComposition")
- .add(createServiceDependency().setService(HttpService.class).setRequired(true))
- .add(createServiceDependency().setService(LocationService.class).setRequired(true))
- );
-
- };
-
- @Override
- public void destroy(BundleContext context, DependencyManager manager) throws Exception {
- }
-}
\ No newline at end of file
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/LocationServiceImpl.java b/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/LocationServiceImpl.java
deleted file mode 100644
index 8e70253..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/LocationServiceImpl.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.ace.location.upnp;
-
-import java.net.URL;
-import java.util.Dictionary;
-
-import org.apache.ace.location.LocationService;
-import org.osgi.service.cm.ConfigurationException;
-import org.osgi.service.cm.ManagedService;
-
-/**
- * The actual implementation for the Location Service.
- */
-public class LocationServiceImpl implements LocationService, ManagedService {
- public final static String PID = "org.apache.ace.location.upnp.LocationService";
- private final static String ENDPOINT_URL = "endpoint.url";
- private final static String ENDPOINT_TYPE = "endpoint.type";
- private final String m_host;
- private final int m_port;
- private URL m_location;
- private String m_serverType;
-
- public LocationServiceImpl(String host, int port) {
- m_host = host;
- m_port = port;
- }
-
- private String get(Dictionary dict, String key) throws ConfigurationException {
- Object val = dict.get(key);
-
- if (val == null) {
- throw new ConfigurationException(key, "no such key defined");
- }
-
- if (val instanceof String) {
- return (String)val;
- }
- throw new ConfigurationException(key, "invalid format (not a String)");
- }
-
- public synchronized void updated(Dictionary dict) throws ConfigurationException {
- if (dict == null) {
- return;
- }
-
- String serverType = get(dict, ENDPOINT_TYPE);
- String url = get(dict, ENDPOINT_URL);
-
- URL location = null;
-
- try {
- //we expect something like:
- //http://<host>:<port>/xyz
-
- url = url.replaceFirst("<host>", m_host);
- url = url.replaceFirst("<port>", "" + m_port);
- location = new URL(url);
-
- }
- catch (Exception e) {
- throw new ConfigurationException(null, e.getMessage());
- }
-
- //all's well: apply
- m_serverType = serverType;
- m_location = location;
-
- }
-
- public URL getLocation() {
- return m_location;
- }
-
- public String getServerType() {
- return m_serverType;
- }
-
- public int getServerLoad() {
- return (int) (40 + Math.random()*10);
- }
-}
\ No newline at end of file
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/ProvisioningDevice.java b/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/ProvisioningDevice.java
deleted file mode 100644
index 95ff923..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/ProvisioningDevice.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.ace.location.upnp;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.net.MalformedURLException;
-import java.util.Dictionary;
-import java.util.Properties;
-import java.util.UUID;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.osgi.service.http.HttpService;
-import org.osgi.service.upnp.UPnPDevice;
-import org.osgi.service.upnp.UPnPIcon;
-import org.osgi.service.upnp.UPnPService;
-
-// TODO refactor this to use the servlet whiteboard pattern
-public class ProvisioningDevice extends HttpServlet implements UPnPDevice {
- private final String DEVICE_ID = "uuid:" + UUID.randomUUID();
- static final String BASE_URL = "/upnp/provisioningdevice";
- private Properties m_properties;
- private volatile HttpService m_http;
- private final String m_host;
- private final int m_port;
-
- private final UPnPLocationServiceWrapper m_wrapper;
-
- public ProvisioningDevice(String host, int port) throws Exception {
- m_host = host;
- m_port = port;
- m_wrapper = new UPnPLocationServiceWrapper();
-
- setupDeviceProperties();
- }
-
- public Object[] getComposition() {
- return new Object[]{this, m_wrapper};
- }
-
- protected void start() throws Exception {
- m_http.registerServlet(BASE_URL, this, null, null);
- }
-
- protected void stop() {
- m_http.unregister(BASE_URL);
- }
-
- private void setupDeviceProperties() throws MalformedURLException {
-
- m_properties = new Properties();
- m_properties.put(UPnPDevice.UPNP_EXPORT,"");
-
- //this is odd, we have to have this
- // property here, otherwise the device will not be exported
- //although the docs say otherwise
- m_properties.put(
- org.osgi.service.device.Constants.DEVICE_CATEGORY,
- new String[]{UPnPDevice.DEVICE_CATEGORY}
- );
-
- m_properties.put(UPnPDevice.FRIENDLY_NAME,"UPnP Provisioning Device");
- m_properties.put(UPnPDevice.MANUFACTURER,"Apache ACE");
- m_properties.put(UPnPDevice.MANUFACTURER_URL,"http://ace.apache.org/");
- m_properties.put(UPnPDevice.MODEL_DESCRIPTION,"A device that is automagically locatable by targets.");
- m_properties.put(UPnPDevice.MODEL_NAME,"Apache ACE Device");
- m_properties.put(UPnPDevice.MODEL_NUMBER,"1.0");
- m_properties.put(UPnPDevice.MODEL_URL,"http://ace.apache.org/upnp-models/");
-
- m_properties.put(UPnPDevice.PRESENTATION_URL, "http://" + m_host + ":" + m_port + BASE_URL);
- m_properties.put(UPnPDevice.SERIAL_NUMBER,"123456789");
- m_properties.put(UPnPDevice.TYPE, UPnPConstants.PROVISIONING_DEVICE_TYPE);
- m_properties.put(UPnPDevice.UDN, DEVICE_ID);
- m_properties.put(UPnPDevice.UPC,"123456789");
-
-
- m_properties.put(UPnPService.ID, m_wrapper.getId());
- m_properties.put(UPnPService.TYPE, m_wrapper.getType());
- }
-
- public Dictionary getDescriptions(String name) {
- return m_properties;
- }
-
- public UPnPIcon[] getIcons(String name) {
- //sorry, no icons yet
- return new UPnPIcon[0];
- }
-
- public UPnPService getService(String id) {
- if (m_wrapper.getId().equals(id)) {
- return m_wrapper;
- }
- return null;
- }
-
- public UPnPService[] getServices() {
- return new UPnPService[]{m_wrapper};
- }
-
- @Override
- public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
- response.setContentType("text/html");
- PrintWriter out = response.getWriter();
- out.println("<html>");
- out.println("<head><title>Apache ACE Device</title></head>");
- out.println("<body>");
- out.println(" <center>");
- out.println(" <h1><font face='Arial' color='#808080'>Apache ACE Device</font></h1>");
-
- out.println(" <p><strong>Location: <i>" + m_wrapper.getLocation() + "</i></strong</p>");
- out.println(" <p><strong>Server Type: [" + m_wrapper.getServerType() + "]</strong</p>");
- out.println(" <p><strong>Server Load: [" + m_wrapper.getServerLoad() + "%]</strong</p>");
-
- out.println(" <p><a href=" + BASE_URL + "/>Refresh</a></p>");
- out.println(" </center>");
- out.println(" </body>");
- out.println("</html>");
- out.flush();
- }
-
- @Override
- public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
- doGet(request, response);
- }
-}
\ No newline at end of file
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/UPnPConstants.java b/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/UPnPConstants.java
deleted file mode 100644
index a5a4b1f..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/UPnPConstants.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.ace.location.upnp;
-
-public interface UPnPConstants
-{
- public final static String PROVISIONING_DEVICE_TYPE = "urn:schemas-upnp-org:device:ProvisioningDevice:1";
- public final static String LOCATION_SERVICE_TYPE = "urn:schemas-upnp-org:service:LocationService:1";
-}
\ No newline at end of file
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/UPnPLocationServiceWrapper.java b/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/UPnPLocationServiceWrapper.java
deleted file mode 100644
index 330c7c0..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/UPnPLocationServiceWrapper.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.ace.location.upnp;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.ace.location.LocationService;
-import org.apache.ace.location.upnp.actions.GetLocationAction;
-import org.apache.ace.location.upnp.actions.GetServerLoadAction;
-import org.apache.ace.location.upnp.actions.GetServerTypeAction;
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class UPnPLocationServiceWrapper implements UPnPService, LocationService {
- private static final String SERVICE_ID = "urn:upnp-org:serviceId:LocationService:1";
- private volatile LocationService m_ls;
- private volatile Map<String, UPnPAction> m_actions;
-
- public UPnPLocationServiceWrapper() {
- m_actions = new HashMap<String, UPnPAction>();
- UPnPAction location = new GetLocationAction(this);
- m_actions.put(location.getName(), location);
- UPnPAction type = new GetServerTypeAction(this);
- m_actions.put(type.getName(), type);
- UPnPAction load = new GetServerLoadAction(this);
- m_actions.put(load.getName(), load);
- }
-
- public URL getLocation() {
- return m_ls.getLocation();
- }
-
- public String getServerType() {
- return m_ls.getServerType();
- }
-
- public int getServerLoad() {
- return (int)(40 + Math.random()*10);
- }
-
- public UPnPAction getAction(String actionName) {
- return m_actions.get(actionName);
- }
-
- public UPnPAction[] getActions() {
- return m_actions.values().toArray(new UPnPAction[0]);
- }
-
- public String getId() {
- return SERVICE_ID;
- }
-
- public UPnPStateVariable getStateVariable(String id) {
- UPnPAction action = m_actions.get(id);
- if (action != null) {
- return action.getStateVariable(null);
- }
- return null;
- }
-
- public UPnPStateVariable[] getStateVariables() {
- int i = 0;
- UPnPStateVariable[] states = new UPnPStateVariable[m_actions.size()];
- for (UPnPAction action : m_actions.values()) {
- states[i++] = action.getStateVariable(null);
- }
- return states;
- }
-
- public String getType() {
- return UPnPConstants.LOCATION_SERVICE_TYPE;
- }
-
- public String getVersion() {
- return "1";
- }
-}
\ No newline at end of file
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/actions/GetLocationAction.java b/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/actions/GetLocationAction.java
deleted file mode 100644
index fa81c5d..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/actions/GetLocationAction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.ace.location.upnp.actions;
-
-import java.net.URL;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.ace.location.LocationService;
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class GetLocationAction implements UPnPAction {
-
- final private String NAME = "GetLocation";
- final private String RET_TARGET_VALUE = "RetLocationValue";
- final private String[] OUT_ARG_NAMES = new String[]{RET_TARGET_VALUE};
- private UPnPStateVariable state;
-
- private final LocationService m_locationService;
-
- public GetLocationAction(LocationService ls) {
- m_locationService = ls;
- state = new StateVarImpl();
- }
-
- public String getName() {
- return NAME;
- }
-
- public String getReturnArgumentName() {
- return RET_TARGET_VALUE;
- }
-
- public String[] getInputArgumentNames() {
- return null;
- }
-
- public String[] getOutputArgumentNames() {
- return OUT_ARG_NAMES;
- }
-
- public UPnPStateVariable getStateVariable(String argumentName) {
- return state;
- }
-
- public Dictionary invoke(Dictionary args) throws Exception {
- URL location = m_locationService.getLocation();
-
- Hashtable<String, Object> result = new Hashtable<String, Object>();
- result.put(RET_TARGET_VALUE, location.toExternalForm());
- return result;
- }
-
- private class StateVarImpl extends StateVar {
- public String getName() {
- return "Location";
- }
-
- public Object getCurrentValue() {
- URL location = m_locationService.getLocation();
- if (location != null) {
- return location.toString();
- }
- return null;
- }
-
- public Class getJavaDataType() {
- return String.class;
- }
-
- public String getUPnPDataType() {
- return TYPE_STRING;
- }
- }
-}
\ No newline at end of file
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/actions/GetServerLoadAction.java b/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/actions/GetServerLoadAction.java
deleted file mode 100644
index 227809e..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/actions/GetServerLoadAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.ace.location.upnp.actions;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.ace.location.LocationService;
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class GetServerLoadAction implements UPnPAction {
-
- final private String NAME = "GetServerLoad";
- final private String RET_TARGET_VALUE = "RetServerLoadValue";
- final private String[] OUT_ARG_NAMES = new String[]{RET_TARGET_VALUE};
- private UPnPStateVariable state;
-
- private final LocationService m_locationService;
-
-
- public GetServerLoadAction(LocationService ls) {
- m_locationService = ls;
- state = new StateVarImpl();
- }
-
- public String getName() {
- return NAME;
- }
-
- public String getReturnArgumentName() {
- return RET_TARGET_VALUE;
- }
-
- public String[] getInputArgumentNames() {
-
- return null;
- }
-
- public String[] getOutputArgumentNames() {
- return OUT_ARG_NAMES;
- }
-
- public UPnPStateVariable getStateVariable(String argumentName) {
- return state;
- }
-
- public Dictionary invoke(Dictionary args) throws Exception {
- int load = m_locationService.getServerLoad();
-
- Hashtable<String, Object> result = new Hashtable<String, Object>();
- result.put(RET_TARGET_VALUE, load);
- return result;
- }
-
- private class StateVarImpl extends StateVar {
- public String getName() {
- return "ServerLoad";
- }
-
- public Object getCurrentValue() {
- return m_locationService.getServerLoad();
- }
-
- public Class getJavaDataType() {
- return Integer.TYPE;
- }
-
- public String getUPnPDataType() {
- return TYPE_INT;
- }
-
- @Override
- public Number getMinimum() {
- return 0;
- }
-
- @Override
- public Number getMaximum() {
- return 100;
- }
-
- @Override
- public Number getStep() {
- return 1;
- }
- }
-}
\ No newline at end of file
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/actions/GetServerTypeAction.java b/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/actions/GetServerTypeAction.java
deleted file mode 100644
index 95d9fc4..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/actions/GetServerTypeAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.ace.location.upnp.actions;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.ace.location.LocationService;
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class GetServerTypeAction implements UPnPAction {
-
- final private String NAME = "GetServerType";
- final private String RET_TARGET_VALUE = "RetServerTypeValue";
- final private String[] OUT_ARG_NAMES = new String[]{RET_TARGET_VALUE};
- private UPnPStateVariable state;
-
- private final LocationService m_locationService;
-
-
- public GetServerTypeAction(LocationService ls) {
- m_locationService = ls;
- state = new StateVarImpl();
-
- }
-
- public String getName() {
- return NAME;
- }
-
- public String getReturnArgumentName() {
- return RET_TARGET_VALUE;
- }
-
- public String[] getInputArgumentNames() {
-
- return null;
- }
-
- public String[] getOutputArgumentNames() {
- return OUT_ARG_NAMES;
- }
-
- public UPnPStateVariable getStateVariable(String argumentName) {
- return state;
- }
-
- public Dictionary invoke(Dictionary args) throws Exception {
- String type = m_locationService.getServerType();
-
- Hashtable<String, Object> result = new Hashtable<String, Object>();
- result.put(RET_TARGET_VALUE, type);
- return result;
- }
-
- private class StateVarImpl extends StateVar {
- public String getName() {
- return "ServerType";
- }
-
- public Object getCurrentValue() {
- return m_locationService.getServerType();
- }
-
- public Class getJavaDataType() {
- return String.class;
- }
-
- public String getUPnPDataType() {
- return TYPE_STRING;
- }
- }
-}
\ No newline at end of file
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/actions/StateVar.java b/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/actions/StateVar.java
deleted file mode 100644
index 11b1c1a..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/actions/StateVar.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.apache.ace.location.upnp.actions;
-
-import org.osgi.service.upnp.UPnPLocalStateVariable;
-
-/*
- * 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.
- */
-public abstract class StateVar implements UPnPLocalStateVariable {
- public String[] getAllowedValues() {
- return null;
- }
-
- public Object getDefaultValue() {
- return null;
- }
-
- public Number getMinimum() {
- return null;
- }
-
- public Number getMaximum() {
- return null;
- }
-
- public Number getStep() {
- return null;
- }
-
- public boolean sendsEvents() {
- return false;
- }
-}
\ No newline at end of file
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/util/HostUtil.java b/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/util/HostUtil.java
deleted file mode 100644
index 16c60a9..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/util/HostUtil.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.ace.location.upnp.util;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-public class HostUtil
-{
- private HostUtil() {}
-
- public static final String getHost() {
- String host;
-
- InetAddress inet;
- try {
- inet = InetAddress.getLocalHost();
- host = inet.getHostAddress();
- }
- catch (UnknownHostException e) {
- System.out.println("Warning: enable to create host name");
- host = "localhost";
- }
-
- return host;
- }
-}
\ No newline at end of file
diff --git a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/util/Inspector.java b/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/util/Inspector.java
deleted file mode 100644
index 7988b14..0000000
--- a/org.apache.ace.location.upnp/src/org/apache/ace/location/upnp/util/Inspector.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.ace.location.upnp.util;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.List;
-import java.util.Properties;
-
-import org.osgi.service.upnp.UPnPAction;
-import org.osgi.service.upnp.UPnPService;
-import org.osgi.service.upnp.UPnPStateVariable;
-
-public class Inspector
-{
- @SuppressWarnings("unused")
- private static UPnPService createService(Class iface, Object target) throws Exception {
- Method[] methods = iface.getMethods();
-
- List<UPnPAction> list = new ArrayList<UPnPAction>();
- for (Method method : methods) {
- list.add(createAction(method, target));
- }
- return null;
- }
-
- private static UPnPAction createAction(Method m, Object target) {
- return new UPnPActionImpl(m, target);
- }
-
- private static class UPnPActionImpl implements UPnPAction {
- private final Method m_method;
- private final Object m_target;
-
- public UPnPActionImpl(Method m, Object t) {
- m_method = m;
- m_target = t;
- }
-
- public String getName() {
- return m_method.getName();
- }
-
- public String[] getInputArgumentNames() {
- Class[] inputArgTypes = m_method.getParameterTypes();
- String[] inputArgs = new String[inputArgTypes.length];
-
- if (inputArgs.length == 1) {
- inputArgs[0] = inputArgTypes[0].getSimpleName();
- }
- else {
- for (int i = 0; i < inputArgTypes.length; i++) {
- inputArgs[i] = inputArgTypes[i].getSimpleName() + i;
- }
- }
- return inputArgs;
- }
-
- public String[] getOutputArgumentNames() {
- return new String[]{getReturnArgumentName()};
- }
-
- public String getReturnArgumentName() {
- Class returnType = m_method.getReturnType();
- return returnType.getSimpleName();
- }
-
- public UPnPStateVariable getStateVariable(String arg0) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Dictionary invoke(Dictionary dict) throws Exception {
- String[] argNames = getInputArgumentNames();
- Object[] args = new Object[argNames.length];
-
- int i=0;
- for (String name : argNames) {
- args[i++] = dict.get(name);
- }
-
- Object retVal = m_method.invoke(m_target, args);
- if (retVal==null) {
- return null;
- }
-
- Properties p = new Properties();
- p.put(getReturnArgumentName(), retVal);
- return p;
- }
- }
-}
\ No newline at end of file