donaldp 2003/04/04 15:15:39
Added: examples/pdk README.TXT build.xml
examples/pdk/src/conf pd-assembly.xml pd-config.xml
pd-environment.xml
examples/pdk/src/java/phoenixdemo/api PDKDemoServer.java
examples/pdk/src/java/phoenixdemo/block
DefaultPDKDemoServer.java
DefaultPDKDemoServer.xinfo SocketThread.java
examples/pdk/src/java/phoenixdemo/client Client.java
examples/pdk/src/java/phoenixdemo/server
PDKDemoServerImpl.java
examples/pdk/src/manifest client.mf server.mf
Log:
Migrate pdk to examples dir
Revision Changes Path
1.1 avalon-phoenix/examples/pdk/README.TXT
Index: README.TXT
===================================================================
Requirements
============
You'll need Ant 1.4.1, and to have set the environmental variable ANT_HOME to be the
location of it's installation, before you can build the demo in this kit.
Building the demo
=================
Launch Ant in this directory. The build process will take come seconds and make
four
archives in build/lib :
phoenix-demo-server.jar
The server that can run standalone. It is an executable jar.
phoenix-demo.jar
The server contained withing a Pheonix compatable block. This would be useful if
you intended to include this component as part of a multi server solution.
phoenix-demo.sar
The above block contained in a server application archive file. This will run
if dropped into Phoenix's apps directory.
phoenix-demo-client.jar
For all server variations, this is the client that will demonstrate client/server
functionality. It is an executable jar.
How to progress with your own server
====================================
1) The general idea is to replace our "phoenixdemo" Java classes with your own and
modify the build script to your own requirements.
2) Note the separation (in terms of packages) of the block, server and client.
3) Know that you should use Cornerstone's components for connection
management and thread pooling (plus many other things). See HelloWorldServer in
Cornerstone for the examples.
4) See the src/conf files defining how blocks are laced together. Cornerstone has
some more complex cases that have dependancies.
Things to read up on
====================
1) Blocks using services from other blocks.
2) Gereral API features of Excalibur.
3) Logkit & how to use it.
4) Lifecycle concepts of Phoenix blocks.
- The Avalon team.
1.1 avalon-phoenix/examples/pdk/build.xml
Index: build.xml
===================================================================
<?xml version="1.0"?>
<project default="main" basedir=".">
<!--
Give user a chance to override without editing this file
(and without typing -D each time they compile it)
-->
<property file=".ant.properties"/>
<property file="${user.home}/.ant.properties"/>
<property name="name" value="phoenix-demo"/>
<property name="Name" value="Phoenix-Demo"/>
<property name="version" value="0.9"/>
<property name="year" value="1999-2001"/>
<property name="build.debug" value="on"/>
<property name="build.optimize" value="off"/>
<property name="build.deprecation" value="off"/>
<path id="project.class.path">
<pathelement path="${java.class.path}" />
<fileset dir="../../dist/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="../../dist/tools/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- Compiles project -->
<target name="compile">
<mkdir dir="build/classes"/>
<javac srcdir="src/java"
destdir="build/classes"
debug="${build.debug}"
optimize="${build.optimize}"
deprecation="${build.deprecation}">
<classpath refid="project.class.path" />
</javac>
</target>
<!-- Jars up project -->
<target name="jars" depends="compile">
<mkdir dir="build/lib"/>
<!-- block for Phoenix-Demo -->
<jar jarfile="build/lib/${name}-block.jar">
<fileset dir="build/classes">
<include name="**"/>
<exclude name="phoenixdemo/client/**"/>
</fileset>
<fileset dir="src/java">
<include name="**/*.xinfo"/>
</fileset>
</jar>
<!-- Standalone Phoenix-Demo server -->
<jar jarfile="build/lib/${name}-server.jar"
manifest="src/manifest/server.mf">
<fileset dir="build/classes">
<include name="**"/>
<exclude name="phoenixdemo/client/**"/>
<exclude name="phoenixdemo/block/**"/>
</fileset>
</jar>
<!-- Phoenix-Demo client -->
<jar jarfile="build/lib/${name}-client.jar"
manifest="src/manifest/client.mf">
<fileset dir="build/classes">
<include name="**"/>
<exclude name="phoenixdemo/server/**"/>
<exclude name="phoenixdemo/block/**"/>
</fileset>
</jar>
</target>
<target name="main" depends="sars" description="Default target to generate build
products"/>
<target name="sars" depends="jars">
<jar jarfile="build/lib/${name}.sar">
<zipfileset dir="build/lib" prefix="SAR-INF/lib">
<include name="*block.jar"/>
</zipfileset>
<zipfileset dir="src/conf" fullpath="SAR-INF/assembly.xml">
<include name="pd-assembly.xml"/>
</zipfileset>
<zipfileset dir="src/conf" fullpath="SAR-INF/environment.xml">
<include name="pd-environment.xml"/>
</zipfileset>
<zipfileset dir="src/conf" fullpath="SAR-INF/config.xml">
<include name="pd-config.xml"/>
</zipfileset>
</jar>
</target>
<target name="clean" description="Cleans up artifacts from build process">
<delete dir="build" />
</target>
</project>
1.1 avalon-phoenix/examples/pdk/src/conf/pd-assembly.xml
Index: pd-assembly.xml
===================================================================
<?xml version="1.0"?>
<assembly>
<block class="phoenixdemo.block.DefaultPDKDemoServer" name="phoenixdemo-server" >
</block>
</assembly>
1.1 avalon-phoenix/examples/pdk/src/conf/pd-config.xml
Index: pd-config.xml
===================================================================
<?xml version="1.0"?>
<config>
<phoenixdemo-server>
<port>1234</port>
</phoenixdemo-server>
</config>
1.1 avalon-phoenix/examples/pdk/src/conf/pd-environment.xml
Index: pd-environment.xml
===================================================================
<?xml version="1.0"?>
<!--
README!
Basic config file that sets up context for server application.
-->
<environment>
<logs>
<category name="" target="default" priority="DEBUG" />
<category name="objectstorage" target="objectstorage-target" priority="DEBUG"
/>
<log-target name="default" location="/logs/avalon-demo.log" />
<log-target name="objectstorage-target" location="/logs/objectstorage.log" />
</logs>
<policy>
<!--
<keystore name="foo-keystore"
location="file:${app.home}${/}conf${/}keystore"
type="JKS" />
<grant signed-by="Fred" code-base="file:${app.home}/blocks/*"
key-store="foo-keystore">
<permission class="java.io.FilePermission" target="/tmp/*"
action="read,write" />
</grant>
-->
<grant code-base="file:${app.home}${/}blocks${/}*">
<permission class="java.security.AllPermission" />
</grant>
<grant code-base="file:${app.home}${/}lib${/}*">
<permission class="java.security.AllPermission" />
</grant>
</policy>
</environment>
1.1
avalon-phoenix/examples/pdk/src/java/phoenixdemo/api/PDKDemoServer.java
Index: PDKDemoServer.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1997-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Avalon", "Phoenix" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this
software without prior written permission. For written permission, please
contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package phoenixdemo.api;
/**
* Interface PDKDemoServer
*
* @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @version * $Revision: 1.1 $
*/
public interface PDKDemoServer
{
void message( String string );
}
1.1
avalon-phoenix/examples/pdk/src/java/phoenixdemo/block/DefaultPDKDemoServer.java
Index: DefaultPDKDemoServer.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1997-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Avalon", "Phoenix" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this
software without prior written permission. For written permission, please
contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package phoenixdemo.block;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import phoenixdemo.api.PDKDemoServer;
import phoenixdemo.server.PDKDemoServerImpl;
/**
* @author Paul Hammant <[EMAIL PROTECTED]>
* @version 1.0
*/
public class DefaultPDKDemoServer
extends AbstractLogEnabled
implements PDKDemoServer, Configurable, Startable, Initializable
{
private int m_port;
private PDKDemoServerImpl m_pdkServer;
private SocketThread m_socketThread;
public void configure( final Configuration configuration )
throws ConfigurationException
{
m_port = configuration.getChild( "port" ).getValueAsInteger( 7777 );
}
public void initialize()
throws Exception
{
m_pdkServer = new PDKDemoServerImpl();
}
public void message( String string )
{
System.out.println( "String passed = " + string );
}
public void start()
throws Exception
{
m_socketThread = new SocketThread( m_pdkServer, m_port );
m_socketThread.start();
System.out.println( "Server started on port " + m_port );
}
public void stop()
throws Exception
{
m_socketThread.interrupt();
m_socketThread = null;
System.out.println( "Server stopped on port " + m_port );
}
}
1.1
avalon-phoenix/examples/pdk/src/java/phoenixdemo/block/DefaultPDKDemoServer.xinfo
Index: DefaultPDKDemoServer.xinfo
===================================================================
<?xml version="1.0"?>
<blockinfo>
<!-- section to describe block -->
<block>
<version>1.0</version>
</block>
<!-- services that are offered by this block -->
<services>
<service name="phoenixdemo.api.PDKDemoServer" version="1.0" />
</services>
<dependencies>
</dependencies>
</blockinfo>
1.1
avalon-phoenix/examples/pdk/src/java/phoenixdemo/block/SocketThread.java
Index: SocketThread.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1997-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Avalon", "Phoenix" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this
software without prior written permission. For written permission, please
contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package phoenixdemo.block;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import phoenixdemo.server.PDKDemoServerImpl;
/**
* Class SocketThread
*
*
* @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @version $Revision: 1.1 $
*/
public class SocketThread
extends Thread
{
private PDKDemoServerImpl m_pdkDemoServerImpl;
private ServerSocket m_serverSocket;
protected SocketThread( final PDKDemoServerImpl pdkDemoServerImpl,
final int port )
{
m_pdkDemoServerImpl = pdkDemoServerImpl;
try
{
m_serverSocket = new ServerSocket( port );
}
catch( final IOException ioe )
{
final String message = "Unable to open listening port. " +
"It is probably already being listened to.";
throw new RuntimeException( message );
}
}
/**
* Method run
*
*
*/
public void run()
{
while( true )
{
try
{
ConnectionThread ct = new ConnectionThread( m_serverSocket.accept()
);
ct.start();
}
catch( IOException ioe )
{
System.out.println( "Some problem with getting a socket for the
connetion." );
}
}
}
/**
* Class ConnectionThread
*
* @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @version $Revision: 1.1 $
*/
class ConnectionThread extends Thread
{
private Socket m_socket;
private ConnectionThread( final Socket socket )
{
m_socket = socket;
}
public void run()
{
m_pdkDemoServerImpl.processSocket( m_socket );
}
}
}
1.1
avalon-phoenix/examples/pdk/src/java/phoenixdemo/client/Client.java
Index: Client.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1997-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Avalon", "Phoenix" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this
software without prior written permission. For written permission, please
contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package phoenixdemo.client;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.Socket;
/**
* @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @version $Revision: 1.1 $
*/
public class Client
{
public static void main( final String[] args )
throws IOException
{
if( args.length < 3 )
{
System.out.println( "Usage java -jar pdkdemo-client.jar <hostname>
<port> <message>" );
System.exit( 10 );
}
final String host = args[ 0 ];
final int port = Integer.parseInt( args[ 1 ] );
final String message = args[ 2 ];
final Socket socket = new Socket( host, port );
final ObjectOutputStream oos = new ObjectOutputStream(
socket.getOutputStream() );
oos.writeObject( message );
oos.close();
socket.close();
}
}
1.1
avalon-phoenix/examples/pdk/src/java/phoenixdemo/server/PDKDemoServerImpl.java
Index: PDKDemoServerImpl.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1997-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Avalon", "Phoenix" and "Apache Software Foundation"
must not be used to endorse or promote products derived from this
software without prior written permission. For written permission, please
contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package phoenixdemo.server;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.ServerSocket;
import java.net.Socket;
import phoenixdemo.api.PDKDemoServer;
/**
* @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @version $Revision: 1.1 $
*/
public class PDKDemoServerImpl
implements PDKDemoServer
{
public void processSocket( final Socket socket )
{
try
{
final ObjectInputStream ois =
new ObjectInputStream( socket.getInputStream() );
String string = null;
try
{
string = (String)ois.readObject();
}
catch( final ClassNotFoundException cnfe )
{
}
message( string );
ois.close();
socket.close();
}
catch( final IOException ioe )
{
System.out.println( "Unexpected IO Exception" );
}
}
public void message( String string )
{
System.out.println( "String passed = " + string );
}
public static void main( final String[] args )
throws IOException
{
final PDKDemoServerImpl svr = new PDKDemoServerImpl();
final ServerSocket serverSocket = new ServerSocket( 7654 );
System.out.println( "PDK Demo listening on port " + 7654 );
System.out.println( "Ctrl-C to exit" );
while( true )
{
svr.processSocket( serverSocket.accept() );
}
}
}
1.1 avalon-phoenix/examples/pdk/src/manifest/client.mf
Index: client.mf
===================================================================
Manifest-Version: 1.0
Main-Class: phoenixdemo.client.Client
1.1 avalon-phoenix/examples/pdk/src/manifest/server.mf
Index: server.mf
===================================================================
Manifest-Version: 1.0
Main-Class: phoenixdemo.server.PDKDemoServerImpl
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]