Commit d278bfde authored by Remi Melisson's avatar Remi Melisson
Browse files

Adding UPnP helloworld example.

Not yet tested on Windows and MacOS, so disabled in examples/pom.xml
parent 073d975c
<?xml version="1.0"?>
<!--
* OW2 FraSCAti Examples: HelloWorld UPnP
*
* Copyright (c) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Rémi Mélisson
*
* Contributor(s):
-->
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>helloworld-upnp-client</artifactId>
<packaging>jar</packaging>
<name>OW2 FraSCAti Examples: HelloWorld UPnP Client</name>
<parent>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>helloworld-upnp-parent</artifactId>
<version>1.3-SNAPSHOT</version>
</parent>
<properties>
<composite.file>helloworld-upnp-client</composite.file>
<service.name>r</service.name>
<method.name>run</method.name>
</properties>
</project>
\ No newline at end of file
/***
* OW2 FraSCAti Examples: HelloWorld UPnP client
* Copyright (C) 2010 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Rémi Mélisson
*
* Contributor(s):
*
*/
package org.ow2.frascati.examples.helloworld.upnp;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Service;
/** A print service client. */
@Service(Runnable.class)
public class Client
implements Runnable {
@Reference(name = "printService")
public PrintService s;
/** Default constructor. */
public Client() {
System.out.println("CLIENT created.");
}
/** Run the client. */
public void run() {
s.print("Hello World!");
}
}
/***
* OW2 FraSCAti Examples: HelloWorld RMI
* Copyright (C) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Rémi Mélisson
*
* Contributor(s):
*
*/
package org.ow2.frascati.examples.helloworld.upnp;
import org.osoa.sca.annotations.Service;
@Service
public interface PrintService {
void print(String msg);
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- OW2 FraSCAti Examples: HelloWorld UPnP Client -->
<!-- Copyright (C) 2008-2009 INRIA, USTL -->
<!-- -->
<!-- This library is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU Lesser General Public -->
<!-- License as published by the Free Software Foundation; either -->
<!-- version 2 of the License, or (at your option) any later version. -->
<!-- -->
<!-- This library is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -->
<!-- Lesser General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU Lesser General Public -->
<!-- License along with this library; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- -->
<!-- Contact: frascati@ow2.org -->
<!-- -->
<!-- Author: Rémi Mélisson -->
<!-- -->
<!-- Contributors: -->
<composite
xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:upnp="http://frascati.ow2.org/xmlns/upnp/1.0"
targetNamespace="http://frascati.ow2.org/helloworld-upnp-client"
name="helloworld-controlpoint">
<service name="r" promote="client/r">
<interface.java interface="java.lang.Runnable" />
</service>
<component name="client">
<service name="r">
<interface.java interface="java.lang.Runnable" />
</service>
<reference name="printService">
<upnp:binding.upnp />
<interface.java interface="org.ow2.frascati.examples.helloworld.upnp.PrintService" />
</reference>
<implementation.java class="org.ow2.frascati.examples.helloworld.upnp.Client" />
</component>
</composite>
<?xml version="1.0"?>
<!--
* OW2 FraSCAti Examples: Helloworld UPnP
*
* Copyright (c) 2009-2010 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Rémi Mélisson
*
* Contributor(s):
-->
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>helloworld-upnp-parent</artifactId>
<packaging>pom</packaging>
<name>OW2 FraSCAti Examples: HelloWorld UPnP</name>
<parent>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>parent</artifactId>
<version>1.3-SNAPSHOT</version>
</parent>
<dependencies>
<!-- OW2 FraSCAti Java UPnP Binding. -->
<dependency>
<groupId>org.ow2.frascati.upnp</groupId>
<artifactId>frascati-binding-upnp</artifactId>
<version>${frascati.version}</version>
</dependency>
</dependencies>
<modules>
<module>client</module>
<module>server</module>
</modules>
</project>
<?xml version="1.0"?>
<!--
* OW2 FraSCAti Examples: HelloWorld UPnP
*
* Copyright (c) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Rémi Mélisson
*
* Contributor(s):
-->
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>helloworld-upnp-server</artifactId>
<packaging>jar</packaging>
<name>OW2 FraSCAti Examples: HelloWorld UPnP Server</name>
<parent>
<groupId>org.ow2.frascati.examples</groupId>
<artifactId>helloworld-upnp-parent</artifactId>
<version>1.3-SNAPSHOT</version>
</parent>
<properties>
<composite.file>helloworld-upnp-server</composite.file>
</properties>
<dependencies>
<!-- OW2 FraSCAti Java UPnP Binding. -->
<dependency>
<groupId>org.ow2.frascati.upnp</groupId>
<artifactId>frascati-binding-upnp</artifactId>
<version>${frascati.version}</version>
</dependency>
</dependencies>
</project>
/***
* OW2 FraSCAti Examples: HelloWorld RMI
* Copyright (C) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Rémi Mélisson
*
* Contributor(s):
*
*/
package org.ow2.frascati.examples.helloworld.upnp;
import org.osoa.sca.annotations.Service;
public interface PrintService {
void print(String msg);
}
/***
* OW2 FraSCAti Examples: HelloWorld RMI
* Copyright (C) 2009 INRIA, USTL
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Rémi Mélisson
*
* Contributor(s):
*
*/
package org.ow2.frascati.examples.helloworld.upnp;
import org.osoa.sca.annotations.Scope;
/** The print service implementation. */
@Scope("COMPOSITE")
public class Server implements PrintService {
//@Property
protected String header = "->";
private int count = 1;
/** Default constructor. */
public Server() {
System.out.println("SERVER created.");
}
/** PrintService implementation. */
public void print(final String msg) {
System.out.println("SERVER: begin printing...");
for (int i = 0; i < count; ++i) {
System.out.println(header + msg);
}
System.out.println("SERVER: print done.");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- OW2 FraSCAti Examples: HelloWorld UPnP -->
<!-- Copyright (C) 2008-2009 INRIA, USTL -->
<!-- -->
<!-- This library is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU Lesser General Public -->
<!-- License as published by the Free Software Foundation; either -->
<!-- version 2 of the License, or (at your option) any later version. -->
<!-- -->
<!-- This library is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -->
<!-- Lesser General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU Lesser General Public -->
<!-- License along with this library; if not, write to the Free Software -->
<!-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- -->
<!-- Contact: frascati@ow2.org -->
<!-- -->
<!-- Author: Rémi Mélisson -->
<!-- -->
<!-- Contributors: -->
<composite
xmlns="http://www.osoa.org/xmlns/sca/1.0"
name="helloworld-device" >
<!-- targetNamespace="http://frascati.ow2.org/helloworld-upnp/" -->
<service name="s" promote="server/s">
<interface.java interface="org.ow2.frascati.examples.helloworld.upnp.PrintService"/>
</service>
<component name="server" xmlns:upnp="http://frascati.ow2.org/xmlns/upnp/1.0" >
<implementation.java class="org.ow2.frascati.examples.helloworld.upnp.Server"/>
<service name="s">
<interface.java interface="org.ow2.frascati.examples.helloworld.upnp.PrintService"/>
<upnp:binding.upnp />
</service>
</component>
</composite>
\ No newline at end of file
......@@ -177,6 +177,7 @@
<module>reconfig</module>
<module>availability-intent</module>
<module>examples-native</module>
<!-- <module>helloworld-upnp</module> -->
</modules>
</project>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment