*** empty log message ***

This commit is contained in:
Eric J. Bowersox
2003-05-20 03:25:31 +00:00
commit b80fa05ed1
682 changed files with 85738 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (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.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.dynamo.test;
import java.util.*;
import com.silverwrist.dynamo.velocity.VelocityRenderable;
public class SimpleVelocityObject implements VelocityRenderable
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String m_template;
private Hashtable m_data = new Hashtable();
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public SimpleVelocityObject()
{
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface VelocityRenderable
*--------------------------------------------------------------------------------
*/
public String getMimeType()
{
return "text/html";
} // end getMimeType
public String getTemplateName()
{
return m_template;
} // end getTemplateName
public Object getParameter(String key)
{
return m_data.get(key);
} // end getParameter
public Collection getParameterNames()
{
return m_data.keySet();
} // end getParameterNames
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
public void setTemplateName(String s)
{
m_template = s;
} // end setTemplateName
public void setParameter(String key, Object value)
{
m_data.put(key,value);
} // end setParameter
} // end class SimpleVelocityObject

View File

@@ -0,0 +1,214 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (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.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.dynamo.test;
import org.apache.log4j.Logger;
import org.w3c.dom.*;
import com.silverwrist.util.xml.*;
import com.silverwrist.dynamo.DynamoVersion;
import com.silverwrist.dynamo.Namespaces;
import com.silverwrist.dynamo.except.*;
import com.silverwrist.dynamo.iface.*;
import com.silverwrist.dynamo.module.ModuleOperations;
public class TestApplication implements Application
{
/*--------------------------------------------------------------------------------
* Internal class implementing initialization code
*--------------------------------------------------------------------------------
*/
private class AppInit implements ComponentInitialize
{
/*====================================================================
* Constructor
*====================================================================
*/
AppInit()
{ // do nothing
} // end constructor
/*====================================================================
* Implementations from interface ComponentInitialize
*====================================================================
*/
public void initialize(Element config_root, ServiceProvider services) throws ConfigException
{
XMLLoader loader = XMLLoader.get();
try
{ // verify the right node name
loader.verifyNodeName(config_root,"application");
// get the object's name
m_name = loader.getAttribute(config_root,"name");
logger.info("Application '" + m_name + "' initialized");
} // end try
catch (XMLLoadException e)
{ // error loading XML config data
throw new ConfigException(e);
} // end catch
// Load the test module.
ModuleOperations mod = (ModuleOperations)(services.queryService(ModuleOperations.class));
try
{ // load it!
mod.loadModule("dynamo-test-module.jar",true);
} // end try
catch (ModuleException e)
{ // translate ModuleException into ConfigException
throw new ConfigException(e);
} // end catch
} // end initialize
} // end class AppInit
/*--------------------------------------------------------------------------------
* Internal class implementing shutdown code
*--------------------------------------------------------------------------------
*/
private class AppTerm implements ComponentShutdown
{
/*====================================================================
* Constructor
*====================================================================
*/
AppTerm()
{ // do nothing
} // end constructor
/*====================================================================
* Implementations from interface ComponentShutdown
*====================================================================
*/
public void shutdown()
{
logger.info("Application '" + m_name + "' shutting down!");
} // end shutdown
} // end class AppTerm
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static Logger logger = Logger.getLogger(TestApplication.class);
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String m_name; // the name of this object
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public TestApplication()
{
logger.info("Constructing new TestApplication");
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface NamedObject
*--------------------------------------------------------------------------------
*/
public String getName()
{
return m_name;
} // end getName
/*--------------------------------------------------------------------------------
* Implementations from interface ServiceProvider
*--------------------------------------------------------------------------------
*/
/**
* Queries this object for a specified service.
*
* @param klass The class of the object that should be returned as a service.
* @return A service object. The service object is guaranteed to be of the class
* specified by <CODE>klass</CODE>; that is, if <CODE>queryService(klass)</CODE>
* yields some object <CODE>x</CODE>, then the expression <CODE>klass.isInstance(x)</CODE>
* is true.
* @exception com.silverwrist.dynamo.except.NoSuchServiceException If no service is available in
* the specified class.
*/
public Object queryService(Class klass)
{
if (klass==ComponentInitialize.class)
return (ComponentInitialize)(new AppInit());
if (klass==ComponentShutdown.class)
return (ComponentShutdown)(new AppTerm());
throw new NoSuchServiceException("TestApplication",klass);
} // end queryService
/**
* Queries this object for a specified service.
*
* @param klass The class of the object that should be returned as a service.
* @param serviceid ID for the service to be requested, to further discriminate between requests.
* @return A service object. The service object is guaranteed to be of the class
* specified by <CODE>klass</CODE>; that is, if <CODE>queryService(klass)</CODE>
* yields some object <CODE>x</CODE>, then the expression <CODE>klass.isInstance(x)</CODE>
* is true.
* @exception com.silverwrist.dynamo.except.NoSuchServiceException If no service is available in
* the specified class.
*/
public Object queryService(Class klass, String serviceid)
{
return queryService(klass);
} // end queryService
/*--------------------------------------------------------------------------------
* Implementations from interface Application
*--------------------------------------------------------------------------------
*/
public String getIdentity()
{
return "DynamoTestApp/" + DynamoVersion.VERSION;
} // end getIdentity
public Object getNullContentError(Request r)
{
return "ERROR! Content is NULL!";
} // end getNullContentError
} // end class TestApplication

View File

@@ -0,0 +1,101 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (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.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.dynamo.test;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.log4j.Logger;
import com.silverwrist.dynamo.Verb;
import com.silverwrist.dynamo.except.*;
import com.silverwrist.dynamo.iface.*;
import com.silverwrist.dynamo.servlet.ServletBase;
public class TestServlet1 extends ServletBase implements ComponentShutdown
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static Logger logger = Logger.getLogger(TestServlet1.class);
/*--------------------------------------------------------------------------------
* Abstract implementations from class ServletBase
*--------------------------------------------------------------------------------
*/
protected Object process(Request r, Application app) throws Exception
{
logger.info("Processing request for TestServlet1");
StringBuffer b = new StringBuffer("This is a test.\n");
b.append("This is only a test.\n");
b.append("If this had been an actual emergency, we would all be dead by now.\n");
b.append("=================================\n");
b.append("Context path: " + r.getContextPath() + "\n");
b.append("Request path: " + r.getRequestPath() + "\n");
b.append("Extra path: " + r.getExtraPath() + "\n");
b.append("Query string: " + r.getQueryString() + "\n");
b.append("Verb: " + r.getVerb().getName() + "\n");
b.append("Source address: " + r.getSourceAddress() + "\n");
b.append("Parameters:\n");
Iterator it = r.getParameters().keySet().iterator();
while (it.hasNext())
{ // iterate over parameters
String name = (String)(it.next());
b.append(" " + name + " = { ");
String[] vals = (String[])(r.getParameters().get(name));
for (int i=0; i<vals.length; i++)
{ // loop over values
if (i>0)
b.append(", ");
b.append(vals[i]);
} // end for
b.append(" }\n");
} // end while
return b;
} // end process
/*--------------------------------------------------------------------------------
* Overrides from class ServletBase
*--------------------------------------------------------------------------------
*/
protected void initServlet(ServiceProvider services) throws DynamoException
{
logger.info("Initializing TestServlet1");
} // end initServlet
/*--------------------------------------------------------------------------------
* Implementations from interface ComponentShutdown
*--------------------------------------------------------------------------------
*/
public void shutdown()
{
logger.info("Destroying TestServlet1");
} // end shutdown
} // end class TestServlet1

View File

@@ -0,0 +1,71 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (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.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.dynamo.test;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.log4j.Logger;
import com.silverwrist.dynamo.Verb;
import com.silverwrist.dynamo.except.*;
import com.silverwrist.dynamo.iface.*;
import com.silverwrist.dynamo.servlet.ServletBase;
public class TestServlet2 extends ServletBase implements ComponentShutdown
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static Logger logger = Logger.getLogger(TestServlet2.class);
/*--------------------------------------------------------------------------------
* Abstract implementations from class ServletBase
*--------------------------------------------------------------------------------
*/
protected Object process(Request r, Application app) throws Exception
{
return new TestServlet2Output();
} // end process
/*--------------------------------------------------------------------------------
* Overrides from class ServletBase
*--------------------------------------------------------------------------------
*/
protected void initServlet(ServiceProvider services) throws DynamoException
{
logger.info("Initializing TestServlet2");
} // end initServlet
/*--------------------------------------------------------------------------------
* Implementations from interface ComponentShutdown
*--------------------------------------------------------------------------------
*/
public void shutdown()
{
logger.info("Destroying TestServlet2");
} // end shutdown
} // end class TestServlet2

View File

@@ -0,0 +1,90 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (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.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.dynamo.test;
import java.util.*;
import com.silverwrist.dynamo.velocity.VelocityRenderable;
class TestServlet2Output implements VelocityRenderable
{
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private HashMap m_data;
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
TestServlet2Output()
{
m_data = new HashMap();
m_data.put("name","Professor Falken");
m_data.put("favorite","chess");
ArrayList list = new ArrayList();
HashMap m = new HashMap();
m.put("title","Chess");
list.add(m);
m = new HashMap();
m.put("title","Checkers");
list.add(m);
m = new HashMap();
m.put("title","Global Thermonuclear War");
list.add(m);
m_data.put("gameList",list);
} // end constructor
/*--------------------------------------------------------------------------------
* Implementations from interface VelocityRenderable
*--------------------------------------------------------------------------------
*/
public String getMimeType()
{
return "text/html";
} // end getMimeType
public String getTemplateName()
{
return "test2.vm";
} // end getTemplateName
public Object getParameter(String key)
{
return m_data.get(key);
} // end getParameter
public Collection getParameterNames()
{
return m_data.keySet();
} // end getParameterNames
} // end class TestServlet2Output