hammant 2002/10/27 03:41:03
Modified: demo build.xml
Added: demo/src/conf avalon-lifecycledemo-assembly.xml
avalon-lifecycledemo-config.xml
avalon-lifecycledemo-environment.xml
demo/src/java/org/apache/avalon/apps/demos/lifecycledemo
LifecycleDemo1.java LifecycleDemo1Impl.java
LifecycleDemo2Impl.java
Log:
Lifecycle demo added.
Revision Changes Path
1.67 +43 -4 jakarta-avalon-apps/demo/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-apps/demo/build.xml,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- build.xml 2 Oct 2002 20:18:19 -0000 1.66
+++ build.xml 27 Oct 2002 11:41:03 -0000 1.67
@@ -175,6 +175,18 @@
<mxinfo/>
<manifest manifestFile="altrmihelloworld-demo.mf" />
</phoenix-blocks>
+
+ <phoenix-blocks
+ destdir="${build.xdoclet}"
+ classpathref="project.class.path">
+ <fileset dir="${java.dir}">
+ <include name="org/apache/avalon/apps/demos/lifecycledemo/*" />
+ </fileset>
+ <blockinfo/>
+ <mxinfo/>
+ <manifest manifestFile="lifecycle-demo.mf" />
+ </phoenix-blocks>
+
</target>
@@ -232,6 +244,16 @@
</fileset>
</jar>
+ <jar jarfile="${build.lib}/demo-lifecycle.jar"
+ basedir="${build.classes}" manifest="${build.xdoclet}/lifecycle-demo.mf">
+
+ <include name="org/apache/avalon/apps/demos/lifecycledemo/*"/>
+ <fileset dir="${build.xdoclet}">
+ <include name="org/apache/avalon/apps/demos/lifecycledemo/*.xinfo"/>
+ <include name="org/apache/avalon/apps/demos/lifecycledemo/*.mxinfo"/>
+ </fileset>
+ </jar>
+
<mkdir dir="build/temp"/>
<unzip src="../common/lib/excalibur-altrmi-common-0.7.jar" dest="build/temp" />
<unzip src="../common/lib/excalibur-altrmi-client-interfaces-0.7.jar"
dest="build/temp" />
@@ -259,7 +281,9 @@
<target name="main" depends="sars" description="Default target to generate build
products minus docs"/>
<target name="all" depends="main,docs" description="Generate build products
including docs"/>
- <target name="sars" depends="jars, soapdemo-sar, rmidemo-sar, altrmidemo-sar">
+ <target name="sars" depends="jars, demo-sar, soapdemo-sar, rmidemo-sar,
altrmidemo-sar, lifecycledemo-sar" description="Create SARs"/>
+
+ <target name="demo-sar" depends="jars" description="Create the demo SAR">
<sar sarfile="${build.lib}/avalon-demo.sar"
config="${conf.dir}/avalon-demo-config.xml"
@@ -286,7 +310,7 @@
</target>
- <target name="soapdemo-sar" depends="jars" if="glue.soapification.present">
+ <target name="soapdemo-sar" depends="jars" if="glue.soapification.present"
description="Create the SOAP demo SAR">
<sar sarfile="${build.lib}/avalon-soapdemo.sar"
config="${conf.dir}/avalon-gluedemo-config.xml"
@@ -315,7 +339,7 @@
</target>
- <target name="rmidemo-sar" depends="jars">
+ <target name="rmidemo-sar" depends="jars" description="Create the RMI demo SAR">
<sar sarfile="${build.lib}/avalon-rmidemo.sar"
config="${conf.dir}/avalon-rmidemo-config.xml"
@@ -334,7 +358,7 @@
</target>
- <target name="altrmidemo-sar" depends="jars">
+ <target name="altrmidemo-sar" depends="jars" description="Create the AltRMI demo
SAR">
<sar sarfile="${build.lib}/avalon-altrmidemo.sar"
config="${conf.dir}/avalon-altrmidemo-config.xml"
@@ -361,6 +385,21 @@
<include name="HelloWorldAltrmiProxy.jar"/>
</fileset>
+ </sar>
+
+ </target>
+
+ <target name="lifecycledemo-sar" depends="jars" description="Create the lifecycle
SAR">
+
+ <sar sarfile="${build.lib}/avalon-lifecycledemo.sar"
+ config="${conf.dir}/avalon-lifecycledemo-config.xml"
+ environment="${conf.dir}/avalon-lifecycledemo-environment.xml"
+ assembly="${conf.dir}/avalon-lifecycledemo-assembly.xml" >
+
+ <lib dir="${build.lib}/">
+ <include name="demo-lifecycle.jar"/>
+ </lib>
+
</sar>
</target>
1.1
jakarta-avalon-apps/demo/src/conf/avalon-lifecycledemo-assembly.xml
Index: avalon-lifecycledemo-assembly.xml
===================================================================
<?xml version="1.0"?>
<!DOCTYPE assembly PUBLIC "-//PHOENIX/Assembly DTD Version 1.0//EN"
"http://jakarta.apache.org/avalon/dtds/phoenix/assembly_1_0.dtd">
<assembly>
<block class="org.apache.avalon.apps.demos.lifecycledemo.LifecycleDemo1Impl"
name="lifecycle-demo1" />
<block class="org.apache.avalon.apps.demos.lifecycledemo.LifecycleDemo2Impl"
name="lifecycle-demo2" >
<provide name="lifecycle-demo1"
role="org.apache.avalon.apps.demos.lifecycledemo.LifecycleDemo1"/>
</block>
</assembly>
1.1
jakarta-avalon-apps/demo/src/conf/avalon-lifecycledemo-config.xml
Index: avalon-lifecycledemo-config.xml
===================================================================
<?xml version="1.0"?>
<config>
<lifecycle-demo1/>
<lifecycle-demo2/>
</config>
1.1
jakarta-avalon-apps/demo/src/conf/avalon-lifecycledemo-environment.xml
Index: avalon-lifecycledemo-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>
<grant code-base="sar:SAR-INF/lib/*">
<permission class="java.security.AllPermission" />
</grant>
</policy>
</environment>
1.1
jakarta-avalon-apps/demo/src/java/org/apache/avalon/apps/demos/lifecycledemo/LifecycleDemo1.java
Index: LifecycleDemo1.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.avalon.apps.demos.lifecycledemo;
/**
* @author Paul Hammant <[EMAIL PROTECTED]>
* @version 1.0
*/
public interface LifecycleDemo1 {
int myServiceMethod();
}
1.1
jakarta-avalon-apps/demo/src/java/org/apache/avalon/apps/demos/lifecycledemo/LifecycleDemo1Impl.java
Index: LifecycleDemo1Impl.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.avalon.apps.demos.lifecycledemo;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
/**
* A demo of the lifecycle methods. Mount the SAR fle contaning there blocks in
Phoenix, go
* to the JMX console ..
*
http://localhost:8082/mbean?objectname=Phoenix%3Aapplication%3Davalon-lifecycledemo%2Ctopic%3DApplication
* .. and try stopt/starting the blocks.
* @phoenix:block
* @phoenix:service name="org.apache.avalon.apps.demos.lifecycledemo.LifecycleDemo1"
* @author Paul Hammant <[EMAIL PROTECTED]>
* @version 1.0
*/
public class LifecycleDemo1Impl implements LogEnabled, Startable, Initializable,
Contextualizable,
Serviceable, Configurable, Disposable, LifecycleDemo1 {
/**
* The method from our service interface -> LifecycleDemo1
* @return
*/
public int myServiceMethod()
{
System.out.println("LifecycleDemo1Impl.myServiceMethod() called.");
System.out.flush();
return 123;
}
public LifecycleDemo1Impl()
{
System.out.println("LifecycleDemo1Impl.constructor() called. "
+ "(You should never do too much in here)");
System.out.flush();
}
// Lifecycle methods themselves.
/**
* Enable Logging
* @param logger The logger to use
*/
public void enableLogging(Logger logger)
{
System.out.println("LifecycleDemo1Impl.enableLogging() called.");
System.out.flush();
}
/**
* Start
* @throws Exception If a problem
*/
public void start() throws Exception
{
System.out.println("LifecycleDemo1Impl.start() called.");
System.out.flush();
}
/**
* Stop
* @throws Exception If a problem
*/
public void stop() throws Exception
{
System.out.println("LifecycleDemo1Impl.stop() called.");
System.out.flush();
}
/**
* Initialize
* @throws Exception If a problem
*/
public void initialize() throws Exception
{
System.out.println("LifecycleDemo1Impl.initialize() called.");
System.out.flush();
}
/**
* Contextualize
* @throws ContextException If a problem
*/
public void contextualize(Context context) throws ContextException
{
System.out.println("LifecycleDemo1Impl.contextualize() called (things like
base directory passed in here).");
System.out.flush();
}
/**
* Service : No dependencies.
* @param serviceManager
* @throws ServiceException
*/
public void service(ServiceManager serviceManager) throws ServiceException
{
System.out.println("LifecycleDemo1Impl.service() called (lookup on other
services possible now).");
System.out.flush();
}
/**
* Configure
* @throws ConfigurationException If a problem
*/
public void configure(Configuration configuration) throws ConfigurationException
{
System.out.println("LifecycleDemo1Impl.configure() called (configuration
from config.xml passed here).");
System.out.flush();
}
/**
* Dispose
*/
public void dispose()
{
System.out.println("LifecycleDemo1Impl.dispose() Called");
System.out.flush();
}
}
1.1
jakarta-avalon-apps/demo/src/java/org/apache/avalon/apps/demos/lifecycledemo/LifecycleDemo2Impl.java
Index: LifecycleDemo2Impl.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.avalon.apps.demos.lifecycledemo;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.activity.Startable;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
/**
* A demo of the lifecycle methods. Mount the SAR fle contaning there blocks in
Phoenix, go
* to the JMX console ..
*
http://localhost:8082/mbean?objectname=Phoenix%3Aapplication%3Davalon-lifecycledemo%2Ctopic%3DApplication
* .. and try stopt/starting the blocks.
* @phoenix:block
* @author Paul Hammant <[EMAIL PROTECTED]>
* @version 1.0
*/
public class LifecycleDemo2Impl implements LogEnabled, Startable, Initializable,
Contextualizable,
Serviceable, Configurable, Disposable {
private LifecycleDemo1 m_lifecycleDemo1;
public LifecycleDemo2Impl()
{
System.out.println("LifecycleDemo2Impl.constructor() called. "
+ "(You should never do too much in here)");
System.out.flush();
}
// Lifecycle methods themselves.
/**
* Enable Logging
* @param logger The logger to use
*/
public void enableLogging(Logger logger)
{
System.out.println("LifecycleDemo2Impl.enableLogging() called.");
System.out.flush();
}
/**
* Start
* @throws Exception If a problem
*/
public void start() throws Exception
{
System.out.println("LifecycleDemo2Impl.start() called.");
System.out.flush();
}
/**
* Stop
* @throws Exception If a problem
*/
public void stop() throws Exception
{
System.out.println("LifecycleDemo2Impl.stop() called.");
System.out.flush();
}
/**
* Initialize
* @throws Exception If a problem
*/
public void initialize() throws Exception
{
System.out.println("LifecycleDemo2Impl.initialize() called.");
System.out.flush();
System.out.println("LifecycleDemo2Impl.initialize(),
LifecycleDemo1.myServiceMethod() "
+ "method called result = " + m_lifecycleDemo1.myServiceMethod());
System.out.flush();
}
/**
* Contextualize
* @throws ContextException If a problem
*/
public void contextualize(Context context) throws ContextException
{
System.out.println("LifecycleDemo2Impl.contextualize() called (things like
base directory passed in here).");
System.out.flush();
}
/**
*
* @phoenix:dependency
name="org.apache.avalon.apps.demos.lifecycledemo.LifecycleDemo1"
*
* @param serviceManager
* @throws ServiceException
*/
public void service(ServiceManager serviceManager) throws ServiceException
{
System.out.println("LifecycleDemo2Impl.service() called "
+ "(lookup on other services possible now).");
System.out.println("LifecycleDemo2Impl.service(), LifecycleDemo1 service
looked up");
m_lifecycleDemo1 = (LifecycleDemo1)
serviceManager.lookup(LifecycleDemo1.class.getName());
}
/**
* Configure
* @throws ConfigurationException If a problem
*/
public void configure(Configuration configuration) throws ConfigurationException
{
System.out.println("LifecycleDemo2Impl.configure() called (configuration
from config.xml passed here).");
System.out.flush();
}
/**
* Dispose
*/
public void dispose()
{
System.out.println("LifecycleDemo2Impl.dispose() Called");
System.out.flush();
}
}
--
To unsubscribe, e-mail: <mailto:avalon-cvs-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@;jakarta.apache.org>