You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-dev@ws.apache.org by me...@apache.org on 2005/01/04 18:11:53 UTC

svn commit: r124127 - in incubator/apollo/globus: . common common/source common/source/etc common/source/etc/templates common/source/etc/templates/unix common/source/etc/templates/windows common/source/pkgdata common/source/share common/source/share/tomcat common/source/src common/source/src/org common/source/src/org/globus common/source/src/org/globus/bootstrap common/source/src/org/globus/tools common/source/src/org/globus/tools/gar common/source/src/org/globus/tools/wsdl core core/samples core/samples/authzService core/samples/authzService/pkgdata core/samples/authzService/src core/samples/authzService/src/org core/samples/authzService/src/org/globus core/samples/authzService/src/org/globus/wsrf core/samples/authzService/src/org/globus/wsrf/samples core/samples/authzService/src/org/globus/wsrf/samples/authzService core/samples/counter core/samples/counter/etc core/samples/counter/pkgdata core/samples/counter/src core/samples/counter/src/org core/samples/counter/src/org/globus core/samples/counter/src/org/globus/wsrf core/samples/counter/src/org/globus/wsrf/samples core/samples/counter/src/org/globus/wsrf/samples/counter core/samples/counter/src/org/globus/wsrf/samples/counter/client core/samples/counter/src/org/globus/wsrf/samples/counter/secure core/samples/management core/samples/management/pkgdata core/samples/management/src core/samples/management/src/org core/samples/management/src/org/globus core/samples/management/src/org/globus/wsrf core/samples/management/src/org/globus/wsrf/samples core/samples/management/src/org/globus/wsrf/samples/management core/setup core/source core/source/docs core/source/etc core/source/pkgdata core/source/share core/source/src core/source/src/org core/source/src/org/globus core/source/src/org/globus/axis core/source/src/org/globus/axis/configuration core/source/src/org/globus/axis/description core/source/src/org/globus/axis/handlers core/source/src/org/globus/axis/providers core/source/src/org/globus/axis/transport core/source/src/org/globus/axis/transport/local core/source/src/org/globus/wsrf core/source/src/org/globus/wsrf/client core/source/src/org/globus/wsrf/config core/source/src/org/globus/wsrf/container core/source/src/org/globus/wsrf/encoding core/source/src/org/globus/wsrf/handlers core/source/src/org/globus/wsrf/impl core/source/src/org/globus/wsrf/impl/client core/source/src/org/globus/wsrf/impl/lifetime core/source/src/org/globus/wsrf/impl/notification core/source/src/org/globus/wsrf/impl/properties core/source/src/org/globus/wsrf/impl/timer core/source/src/org/globus/wsrf/impl/work core/source/src/org/globus/wsrf/jndi core/source/src/org/globus/wsrf/query core/source/src/org/globus/wsrf/topicexpression core/source/src/org/globus/wsrf/utils core/source/src/org/globus/wsrf/utils/cache core/source/src/org/oasis core/source/src/org/oasis/wsn core/source/src/org/oasis/wsrf core/source/src/org/oasis/wsrf/properties core/test core/test/base core/test/base/lib core/test/base/pkgdata core/test/base/share core/test/base/src core/test/base/src/org core/test/base/src/org/globus core/test/base/src/org/globus/wsrf core/test/base/src/org/globus/wsrf/test core/test/interop core/test/interop/pkgdata core/test/interop/schema core/test/interop/schema/tests core/test/interop/schema/tests/interop core/test/interop/src core/test/interop/src/org core/test/interop/src/org/globus core/test/interop/src/org/globus/interop core/test/interop/src/org/globus/interop/notification core/test/interop/src/org/globus/interop/notification/client core/test/interop/src/org/globus/interop/subscription core/test/interop/src/org/globus/interop/widget core/test/interop/src/org/globus/interop/widget/client core/test/interop/src/org/globus/interop/widget/test core/test/perf core/test/perf/etc core/test/perf/src core/test/perf/src/org core/test/perf/src/org/globus core/test/perf/src/org/globus/wsrf core/test/perf/src/org/globus/wsrf/impl core/test/unit core/test/unit/etc core/test/unit/pkgdata core/test/unit/src core/test/unit/src/org core/test/unit/src/org/globus core/test/unit/src/org/globus/wsrf core/test/unit/src/org/globus/wsrf/container core/test/unit/src/org/globus/wsrf/encoding core/test/unit/src/org/globus/wsrf/handlers core/test/unit/src/org/globus/wsrf/impl core/test/unit/src/org/globus/wsrf/impl/lifetime core/test/unit/src/org/globus/wsrf/impl/notification core/test/unit/src/org/globus/wsrf/impl/properties core/test/unit/src/org/globus/wsrf/impl/security core/test/unit/src/org/globus/wsrf/impl/security/authentication core/test/unit/src/org/globus/wsrf/impl/security/authentication/wssec core/test/unit/src/org/globus/wsrf/impl/security/authorization core/test/unit/src/org/globus/wsrf/impl/security/descriptor core/test/unit/src/org/globus/wsrf/impl/timer core/test/unit/src/org/globus/wsrf/impl/work core/test/unit/src/org/globus/wsrf/jndi core/test/unit/src/org/globus/wsrf/utils core/test/unit/src/org/globus/wsrf/utils/cache tools tools/setup tools/source tools/source/etc tools/source/pkgdata tools/source/share tools/source/src tools/source/src/org tools/source/src/org/globus tools/source/src/org/globus/wsrf tools/source/src/org/globus/wsrf/tools tools/source/src/org/globus/wsrf/tools/jndi tools/source/src/org/globus/wsrf/tools/wsdd tools/source/src/org/globus/wsrf/tools/wsdl tools/test tools/test/pkgdata tools/test/src tools/test/src/org tools/test/src/org/globus tools/test/src/org/globus/wsrf tools/test/src/org/globus/wsrf/tools tools/test/src/org/globus/wsrf/tools/wsdd tools/test/wsdl

Author: meder
Date: Tue Jan  4 09:11:50 2005
New Revision: 124127

URL: http://svn.apache.org/viewcvs?view=rev&rev=124127
Log:
initial import of globus contribution


Added:
   incubator/apollo/globus/
   incubator/apollo/globus/common/
   incubator/apollo/globus/common/source/
   incubator/apollo/globus/common/source/build.xml
   incubator/apollo/globus/common/source/etc/
   incubator/apollo/globus/common/source/etc/globus-devel-env.bat   (contents, props changed)
   incubator/apollo/globus/common/source/etc/globus-devel-env.csh
   incubator/apollo/globus/common/source/etc/globus-devel-env.sh   (contents, props changed)
   incubator/apollo/globus/common/source/etc/globus-devel-setcp.bat   (contents, props changed)
   incubator/apollo/globus/common/source/etc/post-deploy.xml
   incubator/apollo/globus/common/source/etc/templates/
   incubator/apollo/globus/common/source/etc/templates/unix/
   incubator/apollo/globus/common/source/etc/templates/unix/launcher-template   (contents, props changed)
   incubator/apollo/globus/common/source/etc/templates/unix/setClassPath
   incubator/apollo/globus/common/source/etc/templates/unix/setenv.sh   (contents, props changed)
   incubator/apollo/globus/common/source/etc/templates/windows/
   incubator/apollo/globus/common/source/etc/templates/windows/launcher-template
   incubator/apollo/globus/common/source/etc/templates/windows/lcp.bat   (contents, props changed)
   incubator/apollo/globus/common/source/etc/templates/windows/setClassPath.bat
   incubator/apollo/globus/common/source/pkgdata/
   incubator/apollo/globus/common/source/pkgdata/filelist
   incubator/apollo/globus/common/source/pkgdata/pkg_data_src.gpt
   incubator/apollo/globus/common/source/share/
   incubator/apollo/globus/common/source/share/build-launcher.xml
   incubator/apollo/globus/common/source/share/build-packages.xml
   incubator/apollo/globus/common/source/share/tomcat/
   incubator/apollo/globus/common/source/share/tomcat/tomcat.xml   (contents, props changed)
   incubator/apollo/globus/common/source/share/tomcat/web.xml   (contents, props changed)
   incubator/apollo/globus/common/source/src/
   incubator/apollo/globus/common/source/src/org/
   incubator/apollo/globus/common/source/src/org/globus/
   incubator/apollo/globus/common/source/src/org/globus/bootstrap/
   incubator/apollo/globus/common/source/src/org/globus/bootstrap/Bootstrap.java
   incubator/apollo/globus/common/source/src/org/globus/bootstrap/BootstrapException.java
   incubator/apollo/globus/common/source/src/org/globus/tools/
   incubator/apollo/globus/common/source/src/org/globus/tools/DeployConstants.java
   incubator/apollo/globus/common/source/src/org/globus/tools/gar/
   incubator/apollo/globus/common/source/src/org/globus/tools/gar/GenerateUndeploy.java
   incubator/apollo/globus/common/source/src/org/globus/tools/wsdl/
   incubator/apollo/globus/core/
   incubator/apollo/globus/core/samples/
   incubator/apollo/globus/core/samples/authzService/
   incubator/apollo/globus/core/samples/authzService/build.xml   (contents, props changed)
   incubator/apollo/globus/core/samples/authzService/deploy-jndi-config.xml   (contents, props changed)
   incubator/apollo/globus/core/samples/authzService/deploy-server.wsdd   (contents, props changed)
   incubator/apollo/globus/core/samples/authzService/pkgdata/
   incubator/apollo/globus/core/samples/authzService/pkgdata/filelist   (contents, props changed)
   incubator/apollo/globus/core/samples/authzService/pkgdata/pkg_data_src.gpt   (contents, props changed)
   incubator/apollo/globus/core/samples/authzService/src/
   incubator/apollo/globus/core/samples/authzService/src/org/
   incubator/apollo/globus/core/samples/authzService/src/org/globus/
   incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/
   incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/
   incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/
   incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/SampleAuthzHome.java
   incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/SampleAuthzResource.java
   incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/SampleAuthzService.java
   incubator/apollo/globus/core/samples/build.xml   (contents, props changed)
   incubator/apollo/globus/core/samples/counter/
   incubator/apollo/globus/core/samples/counter/build.xml
   incubator/apollo/globus/core/samples/counter/deploy-jndi-config.xml
   incubator/apollo/globus/core/samples/counter/deploy-server.wsdd   (contents, props changed)
   incubator/apollo/globus/core/samples/counter/etc/
   incubator/apollo/globus/core/samples/counter/etc/post-deploy.xml
   incubator/apollo/globus/core/samples/counter/etc/security-config.xml   (contents, props changed)
   incubator/apollo/globus/core/samples/counter/pkgdata/
   incubator/apollo/globus/core/samples/counter/pkgdata/filelist
   incubator/apollo/globus/core/samples/counter/pkgdata/pkg_data_src.gpt
   incubator/apollo/globus/core/samples/counter/src/
   incubator/apollo/globus/core/samples/counter/src/org/
   incubator/apollo/globus/core/samples/counter/src/org/globus/
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/Counter.java
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/CounterHome.java
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/CounterService.java
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/PersistentCounter.java
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/Add.java
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/CounterClient.java
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/Create.java
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/client-security-config.xml   (contents, props changed)
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/secure/
   incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/secure/SecureCounter.java
   incubator/apollo/globus/core/samples/management/
   incubator/apollo/globus/core/samples/management/build.xml   (contents, props changed)
   incubator/apollo/globus/core/samples/management/deploy-jndi-config.xml   (contents, props changed)
   incubator/apollo/globus/core/samples/management/deploy-server.wsdd   (contents, props changed)
   incubator/apollo/globus/core/samples/management/pkgdata/
   incubator/apollo/globus/core/samples/management/pkgdata/filelist
   incubator/apollo/globus/core/samples/management/pkgdata/pkg_data_src.gpt
   incubator/apollo/globus/core/samples/management/src/
   incubator/apollo/globus/core/samples/management/src/org/
   incubator/apollo/globus/core/samples/management/src/org/globus/
   incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/
   incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/
   incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/
   incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisPropertySet.java
   incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisRegistryHome.java
   incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisService.java
   incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisServiceProperty.java
   incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/ManagementService.java
   incubator/apollo/globus/core/setup/
   incubator/apollo/globus/core/source/
   incubator/apollo/globus/core/source/build.xml
   incubator/apollo/globus/core/source/deploy-client.wsdd   (contents, props changed)
   incubator/apollo/globus/core/source/deploy-jndi-config.xml
   incubator/apollo/globus/core/source/deploy-server.wsdd   (contents, props changed)
   incubator/apollo/globus/core/source/docs/
   incubator/apollo/globus/core/source/docs/developer_notes.php   (contents, props changed)
   incubator/apollo/globus/core/source/docs/notes.html   (contents, props changed)
   incubator/apollo/globus/core/source/etc/
   incubator/apollo/globus/core/source/etc/client-jndi-config.xml   (contents, props changed)
   incubator/apollo/globus/core/source/etc/client-server-config.wsdd   (contents, props changed)
   incubator/apollo/globus/core/source/etc/container-log4j.properties   (contents, props changed)
   incubator/apollo/globus/core/source/etc/global_security_descriptor.xml
   incubator/apollo/globus/core/source/etc/log4j.properties   (contents, props changed)
   incubator/apollo/globus/core/source/etc/post-deploy.xml
   incubator/apollo/globus/core/source/pkgdata/
   incubator/apollo/globus/core/source/pkgdata/filelist
   incubator/apollo/globus/core/source/pkgdata/pkg_data_src.gpt
   incubator/apollo/globus/core/source/share/
   incubator/apollo/globus/core/source/share/NStoPkg.properties   (contents, props changed)
   incubator/apollo/globus/core/source/src/
   incubator/apollo/globus/core/source/src/org/
   incubator/apollo/globus/core/source/src/org/globus/
   incubator/apollo/globus/core/source/src/org/globus/axis/
   incubator/apollo/globus/core/source/src/org/globus/axis/configuration/
   incubator/apollo/globus/core/source/src/org/globus/axis/configuration/EngineConfigurationFactoryServlet.java
   incubator/apollo/globus/core/source/src/org/globus/axis/description/
   incubator/apollo/globus/core/source/src/org/globus/axis/description/Resources.java
   incubator/apollo/globus/core/source/src/org/globus/axis/description/ServiceDescUtil.java
   incubator/apollo/globus/core/source/src/org/globus/axis/handlers/
   incubator/apollo/globus/core/source/src/org/globus/axis/handlers/HTTP11Handler.java
   incubator/apollo/globus/core/source/src/org/globus/axis/handlers/ServiceDescHandler.java
   incubator/apollo/globus/core/source/src/org/globus/axis/providers/
   incubator/apollo/globus/core/source/src/org/globus/axis/providers/PrivilegedInvokeMethodAction.java
   incubator/apollo/globus/core/source/src/org/globus/axis/providers/RPCProvider.java
   incubator/apollo/globus/core/source/src/org/globus/axis/transport/
   incubator/apollo/globus/core/source/src/org/globus/axis/transport/local/
   incubator/apollo/globus/core/source/src/org/globus/axis/transport/local/LocalRequester.java
   incubator/apollo/globus/core/source/src/org/globus/axis/transport/local/LocalTransportUtils.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/Constants.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/InvalidResourceKeyException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/NoResourceHomeException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/NoSuchResourceException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/NotificationConsumerCallbackManager.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/NotificationConsumerManager.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/NotifyCallback.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/PersistenceCallback.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/PersistentResource.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/RemoveCallback.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/RemoveNotSupportedException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/Resource.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceContext.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceContextException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceHome.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceIdentifier.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceKey.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceLifetime.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceProperties.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceProperty.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourcePropertyMetaData.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourcePropertySet.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/Subscription.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/Topic.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicList.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListAccessor.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListMetaData.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListener.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListenerList.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/WSNConstants.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/WSRFConstants.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/BaseClient.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/DeleteProperty.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Destroy.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/GetCurrentMessage.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/GetProperties.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/GetProperty.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/InsertProperty.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Pause.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Query.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Resume.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/ServiceURL.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/SetTerminationTime.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Subscribe.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/client/UpdateProperty.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/config/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/config/ConfigException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/config/ContainerConfig.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/AxisServlet.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ContainerException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/GSIServiceContainer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/GSIServiceThread.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/Lock.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/LockManager.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/SecureContainerException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/Semaphore.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceContainer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceContainerCollection.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceDispatcher.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceHost.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceInitHandler.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceManager.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceRequest.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceRequestQueue.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceThread.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceThreadPool.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ShutdownClient.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ShutdownService.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyDeserializer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyDeserializerFactory.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListDeserializer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListDeserializerFactory.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListSerializer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListSerializerFactory.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnySerializer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnySerializerFactory.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/DeserializationException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/DialectDependentDeserializer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/DialectDependentSerializer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/ObjectDeserializationContext.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/ObjectDeserializer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/ObjectSerializer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionDeserializer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionDeserializerFactory.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionSerializer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionSerializerFactory.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/SerializationException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionDeserializer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionDeserializerFactory.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionSerializer.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionSerializerFactory.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/AddressingHandler.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/FaultHandler.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/MessageLoggingHandler.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/URLMapper.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/WSDLHandler.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/BaseResourceProperty.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/DirtyFlagHolder.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/NotificationConsumerCallbackManagerImpl.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/PersistentReflectionResource.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/PersistentResourceProperty.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/QueryEngineImpl.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ReflectionResource.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ReflectionResourceProperty.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourceContextImpl.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourceHomeImpl.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourcePropertyTopic.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourceSweeper.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ServiceResourceHome.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourceKey.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourceProperty.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourcePropertyMetaData.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourcePropertySet.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleSubscriptionTopicListener.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopic.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopicExpressionEvaluator.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopicList.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopicListMetaData.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SingletonResourceHome.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/TopicExpressionEngineImpl.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/XPathExpressionEvaluator.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/client/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/lifetime/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/lifetime/DestroyProvider.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/lifetime/SetTerminationTimeProvider.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/ClientNotificationConsumerManager.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/GetCurrentMessageProvider.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/NotificationConsumerHome.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/NotificationConsumerProvider.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/PauseSubscriptionProvider.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/PersistentSubscription.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/ResumeSubscriptionProvider.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/ServerNotificationConsumerManager.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SimpleSubscription.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscribeHelper.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscribeProvider.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscriptionCreationException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscriptionHome.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/GetMultipleResourcePropertiesProvider.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/GetResourcePropertyProvider.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/QueryResourcePropertiesProvider.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/SetResourcePropertiesProvider.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/TimerImpl.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/TimerListenerWrapper.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/TimerManagerImpl.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/WorkEventImpl.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/WorkItemImpl.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/WorkManagerImpl.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/BasicBeanFactory.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/BeanFactory.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/Initializable.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/JNDIUtils.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/NamingContext.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/ServiceResourceRef.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/query/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/query/ExpressionEvaluator.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/query/InvalidQueryExpressionException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/query/QueryEngine.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/query/QueryEvaluationException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/query/QueryException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/query/UnsupportedQueryDialectException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/InvalidTopicExpressionException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionEngine.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionEvaluator.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionResolutionException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/UnsupportedTopicExpressionDialectException.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/AddressingUtils.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/AnyHelper.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/ContextUtils.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/FaultHelper.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/FilePersistenceHelper.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/PerformanceLog.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/Resources.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/SubscriptionPersistenceUtils.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/XmlPersistenceHelper.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/XmlUtils.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/Cache.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/LRUCache.java
   incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/LinkedNodeList.java
   incubator/apollo/globus/core/source/src/org/oasis/
   incubator/apollo/globus/core/source/src/org/oasis/AnyListType.java
   incubator/apollo/globus/core/source/src/org/oasis/DialectDependentType.java
   incubator/apollo/globus/core/source/src/org/oasis/wsn/
   incubator/apollo/globus/core/source/src/org/oasis/wsn/TopicExpressionType.java
   incubator/apollo/globus/core/source/src/org/oasis/wsrf/
   incubator/apollo/globus/core/source/src/org/oasis/wsrf/properties/
   incubator/apollo/globus/core/source/src/org/oasis/wsrf/properties/QueryExpressionType.java
   incubator/apollo/globus/core/source/src/org/oasis/wsrf/properties/SetResourceProperties_Element.java
   incubator/apollo/globus/core/test/
   incubator/apollo/globus/core/test/base/
   incubator/apollo/globus/core/test/base/build.xml   (contents, props changed)
   incubator/apollo/globus/core/test/base/lib/
   incubator/apollo/globus/core/test/base/lib/junit.LICENSE   (contents, props changed)
   incubator/apollo/globus/core/test/base/lib/junit.jar   (contents, props changed)
   incubator/apollo/globus/core/test/base/pkgdata/
   incubator/apollo/globus/core/test/base/pkgdata/filelist
   incubator/apollo/globus/core/test/base/pkgdata/pkg_data_src.gpt
   incubator/apollo/globus/core/test/base/share/
   incubator/apollo/globus/core/test/base/share/runtests.xml   (contents, props changed)
   incubator/apollo/globus/core/test/base/src/
   incubator/apollo/globus/core/test/base/src/org/
   incubator/apollo/globus/core/test/base/src/org/globus/
   incubator/apollo/globus/core/test/base/src/org/globus/wsrf/
   incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/
   incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/GSITestContainer.java
   incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/GridTestCase.java
   incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/GridTestSuite.java
   incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/TestContainer.java
   incubator/apollo/globus/core/test/build.xml   (contents, props changed)
   incubator/apollo/globus/core/test/interop/
   incubator/apollo/globus/core/test/interop/build.xml   (contents, props changed)
   incubator/apollo/globus/core/test/interop/deploy-jndi-config.xml
   incubator/apollo/globus/core/test/interop/deploy-server.wsdd   (contents, props changed)
   incubator/apollo/globus/core/test/interop/pkgdata/
   incubator/apollo/globus/core/test/interop/pkgdata/filelist
   incubator/apollo/globus/core/test/interop/pkgdata/pkg_data_src.gpt
   incubator/apollo/globus/core/test/interop/schema/
   incubator/apollo/globus/core/test/interop/schema/tests/
   incubator/apollo/globus/core/test/interop/schema/tests/interop/
   incubator/apollo/globus/core/test/interop/src/
   incubator/apollo/globus/core/test/interop/src/org/
   incubator/apollo/globus/core/test/interop/src/org/globus/
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/NotificationCallback.java
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/NotificationConsumerFactoryService.java
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/client/
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/client/Notify.java
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/subscription/
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/Widget.java
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/WidgetHome.java
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/WidgetNotificationService.java
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/WidgetService.java
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/client/
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/client/Create.java
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/client/GenerateNotification.java
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/test/
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/test/InteropTest.java
   incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/test/PackageTests.java
   incubator/apollo/globus/core/test/perf/
   incubator/apollo/globus/core/test/perf/build.xml   (contents, props changed)
   incubator/apollo/globus/core/test/perf/deploy-jndi-config.xml
   incubator/apollo/globus/core/test/perf/deploy-server.wsdd   (contents, props changed)
   incubator/apollo/globus/core/test/perf/etc/
   incubator/apollo/globus/core/test/perf/etc/post-deploy.xml   (contents, props changed)
   incubator/apollo/globus/core/test/perf/etc/security-config.xml   (contents, props changed)
   incubator/apollo/globus/core/test/perf/src/
   incubator/apollo/globus/core/test/perf/src/org/
   incubator/apollo/globus/core/test/perf/src/org/globus/
   incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/
   incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/
   incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/BasicPerformanceTests.java
   incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/ClientTest.java
   incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PackageTests.java
   incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PerformanceTestHome.java
   incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PerformanceTestResource.java
   incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PerformanceTestService.java
   incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/SecurityTests.java
   incubator/apollo/globus/core/test/unit/
   incubator/apollo/globus/core/test/unit/build.xml   (contents, props changed)
   incubator/apollo/globus/core/test/unit/deploy-jndi-config.xml
   incubator/apollo/globus/core/test/unit/deploy-server.wsdd   (contents, props changed)
   incubator/apollo/globus/core/test/unit/etc/
   incubator/apollo/globus/core/test/unit/etc/identity-security-config.xml   (contents, props changed)
   incubator/apollo/globus/core/test/unit/etc/local-config-authz-test.conf   (contents, props changed)
   incubator/apollo/globus/core/test/unit/etc/security-config.xml   (contents, props changed)
   incubator/apollo/globus/core/test/unit/pkgdata/
   incubator/apollo/globus/core/test/unit/pkgdata/filelist
   incubator/apollo/globus/core/test/unit/pkgdata/pkg_data_src.gpt
   incubator/apollo/globus/core/test/unit/src/
   incubator/apollo/globus/core/test/unit/src/org/
   incubator/apollo/globus/core/test/unit/src/org/globus/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/InvalidateResourceMapping.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/GSIServiceContainerTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/LockManagerTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/PackageTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/SecurityTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/ServiceContainerTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/ServiceHostTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/AnyListMarshalingTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/AnyMarshalingTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/ObjectSerializerTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/PackageTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/BasicTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/DIITests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/PackageTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/InvalidateProvider.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/PackageTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/ReflectionResourcePropertyTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/SimpleResourceKeyTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/SimpleResourcePropertyTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/TestHome.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/TestResource.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/TestService.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/DestroyTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/LifetimeTestCase.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/PackageTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/SetTerminationTimeTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/GetCurrentMessageTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationConsumerTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationProducerRPTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestCase.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestHome.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestResource.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestService.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotifyThread.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PackageTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistenceTestSubscribeProvider.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistenceTestSubscriptionHome.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistentSubscribeHelper.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistentSubscriptionTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/ResourcePropertyNotificationTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/SecurityTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/SubscribeTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/SubscriptionManagerTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/TestNotifyCallback.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/TestSecureNotifications.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/GetMultipleResourcePropertiesTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/GetResourcePropertyTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/PackageTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/PropertiesTestCase.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/QueryResourcePropertiesTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/SetResourcePropertiesTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecureServiceAccessTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTestResource.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTestResourceHome.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTestService.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/TestConstants.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/SecurityTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestGssXMLEncryption.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestGssXMLSignature.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestReplayAttackFilter.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestWSSecurity.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/VerifyReplayFilter.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/VerifyWSSecurity.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/wssec/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/SecurityTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestAuthorizationCallout.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestAuthorizationChain.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestGridMapAuthorization.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestLocalConfig.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestSelfAuthorization.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestServiceAuthzChain.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/client-security-config.xml   (contents, props changed)
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/container-security-config.xml   (contents, props changed)
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/SecurityTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/TestContainerSecurityConfig.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/TestSecurityConfig.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/TestSecurityDescriptor.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/client-security-desc.xml   (contents, props changed)
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/test-security-false.xml   (contents, props changed)
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/test-security-true.xml   (contents, props changed)
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/host-client-security-config.xml
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/test-service-config.xml
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/timer/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/timer/PackageTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/timer/TimerTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/work/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/work/PackageTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/work/WorkTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/JNDITest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/PackageTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/TestFactory.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/FaultHelperTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/PackageTests.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/XmlPersistenceHelperTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/cache/
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/cache/LinkedNodeListTest.java
   incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/cache/PackageTests.java
   incubator/apollo/globus/svn-commit.tmp
   incubator/apollo/globus/tools/
   incubator/apollo/globus/tools/setup/
   incubator/apollo/globus/tools/source/
   incubator/apollo/globus/tools/source/build.xml
   incubator/apollo/globus/tools/source/etc/
   incubator/apollo/globus/tools/source/etc/post-deploy.xml   (contents, props changed)
   incubator/apollo/globus/tools/source/pkgdata/
   incubator/apollo/globus/tools/source/pkgdata/filelist
   incubator/apollo/globus/tools/source/pkgdata/pkg_data_src.gpt
   incubator/apollo/globus/tools/source/share/
   incubator/apollo/globus/tools/source/share/build-stubs.xml
   incubator/apollo/globus/tools/source/src/
   incubator/apollo/globus/tools/source/src/org/
   incubator/apollo/globus/tools/source/src/org/globus/
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/CommandLineTool.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ConfigContext.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ContextRuleSet.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/Environment.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/JNDIConfigRuleSet.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/JNDIConfigTool.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ParameterRuleSet.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/Resource.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ResourceLink.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ResourceParameters.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdd/
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdd/WSDDEditor.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/GenerateBinding.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/RelativePathUtil.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/TypesProcessor.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/WSDL2Java.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/WSDLPreprocessor.java
   incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/WSDLPreprocessorConstants.java
   incubator/apollo/globus/tools/test/
   incubator/apollo/globus/tools/test/build.xml
   incubator/apollo/globus/tools/test/pkgdata/
   incubator/apollo/globus/tools/test/pkgdata/filelist
   incubator/apollo/globus/tools/test/pkgdata/pkg_data_src.gpt
   incubator/apollo/globus/tools/test/src/
   incubator/apollo/globus/tools/test/src/org/
   incubator/apollo/globus/tools/test/src/org/globus/
   incubator/apollo/globus/tools/test/src/org/globus/wsrf/
   incubator/apollo/globus/tools/test/src/org/globus/wsrf/tools/
   incubator/apollo/globus/tools/test/src/org/globus/wsrf/tools/wsdd/
   incubator/apollo/globus/tools/test/src/org/globus/wsrf/tools/wsdd/PackageTests.java
   incubator/apollo/globus/tools/test/src/org/globus/wsrf/tools/wsdd/TestWSDDEditor.java
   incubator/apollo/globus/tools/test/wsdl/
   incubator/apollo/globus/tools/test/wsdl/bar.wsdl
   incubator/apollo/globus/tools/test/wsdl/foo.wsdl
   incubator/apollo/globus/tools/test/wsdl/test.wsdl

Added: incubator/apollo/globus/common/source/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,129 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_common" basedir=".">
+    <description>
+        Code and libraries shared by other Java WS Core packages
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+
+    <property name="name" value="Globus Toolkit Java WS Common"/>
+    <property name="version" value="3.9.4"/>
+    <property name="globus.copyright" value="Copyright &#169; 1999-2003 University of Chicago and The University of Southern California.  All rights reserved."/>
+    <property name="env.GLOBUS_LOCATION" value="../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="base.name" value="wsrf_common"/>
+    <property name="package.name" value="globus_${base.name}"/>
+    <property name="gar.name" value="${package.name}.gar"/>
+    <property name="jar.name" value="${base.name}.jar"/>
+    <property name="garjars.id" value="garjars"/>
+    <property name="garshare.id" value="garshare"/>
+    <property name="garetc.id" value="garetc"/>
+    <property name="src.dir" value="src"/>
+    <property name="build.dir" location="build"/>
+    <property name="build.dest" location="build/classes"/>
+    <property name="build.lib.dir" location="build/lib"/>
+    <property name="build.javadocs" value="${build.dir}/javadocs"/>
+    <property name="build.packages" location="share/build-packages.xml"/>
+    <property name="build.setup" 
+        location="etc/${package.name}-post-deploy.xml"/>
+    <property name="java.debug" value="on"/>
+    <property name="java.deprecation" value="true"/>
+
+    <fileset dir="share" id="garshare"/>
+    <fileset dir="${build.lib.dir}" id="garjars"/> 
+    <fileset dir="etc" id="garetc"/> 
+
+    <property name="gardocs.id" value="gardocs"/>
+    <fileset dir="docs" id="gardocs"/> 
+
+    <target name="init">
+        <mkdir dir="${build.dir}"/>
+        <mkdir dir="${build.dest}"/>
+        <mkdir dir="${build.lib.dir}"/>
+    </target>
+
+    <target name="compile" depends="init">
+        <javac srcdir="${src.dir}" destdir="${build.dest}" 
+               debug="${java.debug}" deprecation="${java.deprecation}">
+            <include name="**/*.java"/>
+            <classpath>
+                <fileset dir=".">
+                    <include name="lib/*.jar"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+        </javac>
+    </target>
+
+    <target name="jar" depends="compile">
+        <jar destfile="${build.lib.dir}/${jar.name}" basedir="${build.dest}"
+             excludes="org/globus/bootstrap/*"/>
+        <jar destfile="${build.lib.dir}/bootstrap.jar" basedir="${build.dest}"
+             includes="org/globus/bootstrap/*"/>
+    </target>
+
+    <target name="dist" depends="jar">
+        <copy todir="${build.lib.dir}">
+          <fileset dir="lib" />
+        </copy>
+        <ant antfile="${build.packages}" target="makeGar">
+        	<reference refid="${garshare.id}"/>
+        	<reference refid="${garjars.id}"/>
+        	<reference refid="${garetc.id}"/> 
+                <reference refid="${gardocs.id}"/>
+        </ant>
+    </target>
+
+    <target name="clean">
+        <delete dir="tmp"/>
+        <delete dir="${build.dir}"/>
+        <delete file="${gar.name}"/>
+    </target>
+
+    <target name="deploy" depends="dist">
+        <ant antfile="${build.packages}" target="deployGar"/>
+    </target>  
+
+    <target name="undeploy">
+        <ant antfile="${build.packages}" target="undeployGar">
+            <property name="gar.id" value="${package.name}"/>
+        </ant>
+    </target>
+
+    <target name="setup">
+        <ant antfile="${build.setup}" target="setup"/>
+    </target>
+
+    <target name="all" depends="dist"/>
+
+   <target name="javadocs" depends="compile">
+    <mkdir dir="${build.javadocs}"/>
+    <javadoc destdir="${build.javadocs}"
+             author="true"
+             version="true"
+             use="true"
+             windowtitle="${name} ${version} API"
+             doctitle="${name} ${version}"
+             bottom="${globus.copyright}">
+      <classpath>
+        <fileset dir="${deploy.dir}/lib">
+          <include name="*.jar"/>
+        </fileset>
+      </classpath>
+      <link href="http://java.sun.com/j2se/1.3/docs/api/" />
+      <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
+      <link href="http://ws.apache.org/axis/java/apiDocs/"/>
+      <packageset dir="${src.dir}" defaultexcludes="yes"/>
+    </javadoc>
+  </target>
+
+</project>

Added: incubator/apollo/globus/common/source/etc/globus-devel-env.bat
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/etc/globus-devel-env.bat?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/etc/globus-devel-env.bat	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,16 @@
+@echo off
+
+if "X%GLOBUS_LOCATION%" == "X" goto nopath
+goto path
+
+:nopath
+
+    echo ERROR: environment variable GLOBUS_LOCATION not defined
+    goto end
+
+:path
+
+for %%i in ("%GLOBUS_LOCATION%\lib\*.jar") do call %GLOBUS_LOCATION%\etc\globus-devel-setcp.bat %%i
+set CLASSPATH=.;%GLOBUS_LOCATION%;%GLOBUS_LOCATION%\build\classes;%CLASSPATH%
+
+:end

Added: incubator/apollo/globus/common/source/etc/globus-devel-env.csh
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/etc/globus-devel-env.csh?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/etc/globus-devel-env.csh	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,22 @@
+
+if ( ! $?GLOBUS_LOCATION ) then
+    echo "ERROR: environment variable GLOBUS_LOCATION not defined"
+    exit 1
+endif
+
+if ( ! -e "${GLOBUS_LOCATION}" ) then
+    echo "ERROR: invalid GLOBUS_LOCATION set: $GLOBUS_LOCATION"
+    exit 2
+endif
+
+set DIRLIBS=(${GLOBUS_LOCATION}/lib/*.jar)
+set CP=".:${GLOBUS_LOCATION}:${GLOBUS_LOCATION}/build/classes"
+foreach i (${DIRLIBS})
+     set CP = ${CP}:"$i"
+end
+
+if ( ! $?CLASSPATH ) then
+    setenv CLASSPATH ${CP}
+else
+    setenv CLASSPATH ${CP}:${CLASSPATH}
+endif

Added: incubator/apollo/globus/common/source/etc/globus-devel-env.sh
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/etc/globus-devel-env.sh?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/etc/globus-devel-env.sh	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,23 @@
+
+if [ -z "${GLOBUS_LOCATION}" ]; then
+    echo "ERROR: environment variable GLOBUS_LOCATION not defined"  1>&2
+    return 1
+fi
+
+if [ ! -d "${GLOBUS_LOCATION}" ]; then
+    echo "ERROR: invalid GLOBUS_LOCATION set: $GLOBUS_LOCATION" 1>&2
+    return 1
+fi
+
+CP=.:${GLOBUS_LOCATION}:${GLOBUS_LOCATION}/build/classes
+for i in ${GLOBUS_LOCATION}/lib/*.jar
+do
+   CP=$CP:"$i"
+done
+
+if [ -z "$CLASSPATH" ] ; then
+  CLASSPATH=$CP
+else
+  CLASSPATH=$CP:$CLASSPATH
+fi
+export CLASSPATH

Added: incubator/apollo/globus/common/source/etc/globus-devel-setcp.bat
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/etc/globus-devel-setcp.bat?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/etc/globus-devel-setcp.bat	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,9 @@
+@echo off
+set _CLASSPATHCOMPONENT=%1
+:argCheck
+if %2a==a goto gotAllArgs
+shift
+set _CLASSPATHCOMPONENT=%_CLASSPATHCOMPONENT% %1
+goto argCheck
+:gotAllArgs
+set CLASSPATH=%_CLASSPATHCOMPONENT%;%CLASSPATH%

Added: incubator/apollo/globus/common/source/etc/post-deploy.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/etc/post-deploy.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/etc/post-deploy.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,149 @@
+<?xml version="1.0"?>
+
+<!-- ===================================================================
+
+Notes:
+   This is a build file for use with the Jakarta Ant build tool.
+
+Prerequisites:
+
+   jakarta-ant from http://jakarta.apache.org
+
+
+Build Instructions:
+
+   This file is automatically called at the end of the deployment
+   of the corresponding component's gar (see build-packages.xml).
+
+Copyright:
+Copyright (c) 1999 University of Chicago and The University of
+Southern California. All Rights Reserved.
+
+==================================================================== -->
+<project default="all" basedir=".">
+
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="."/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="abs.deploy.dir" location="${deploy.dir}"/>
+    <property name="build.launcher" 
+        location="${abs.deploy.dir}/share/globus_wsrf_common/build-launcher.xml"/>
+
+    <target name="setup">        
+        <copy file="${abs.deploy.dir}/lib/xalan.jar" 
+              todir="${abs.deploy.dir}/endorsed"
+              failonerror="false"/>
+        <chmod file="${abs.deploy.dir}/endorsed/xalan.jar" perm="644"/>
+        <chmod dir="${abs.deploy.dir}/endorsed" perm="755"/>
+
+        <move todir="${abs.deploy.dir}/etc"
+              failonerror="false">
+              <fileset dir="${abs.deploy.dir}/etc/${gar.id}">
+                 <include name="globus-devel-*"/>
+              </fileset>
+        </move>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="grid-proxy-init"/>
+            <property name="class.name" value="org.globus.tools.ProxyInit"/>
+            <property name="windowsOnly" value="true"/>
+        </ant>
+        
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="grid-proxy-info"/>
+            <property name="class.name" value="org.globus.tools.ProxyInfo"/>
+            <property name="windowsOnly" value="true"/>
+        </ant>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="grid-proxy-destroy"/>
+            <property name="class.name" value="org.globus.tools.ProxyDestroy"/>
+            <property name="windowsOnly" value="true"/>
+        </ant>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="grid-cert-info"/>
+            <property name="class.name" value="org.globus.tools.CertInfo"/>
+            <property name="windowsOnly" value="true"/>
+        </ant>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="grid-cert-request"/>
+            <property name="class.name" 
+                value="org.globus.tools.GridCertRequest"/>
+            <property name="windowsOnly" value="true"/>
+        </ant>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="grid-info-search"/>
+            <property name="class.name" 
+                value="org.globus.tools.GridInfoSearch"/>
+            <property name="windowsOnly" value="true"/>
+        </ant>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="globusrun"/>
+            <property name="class.name" value="org.globus.tools.GlobusRun"/>
+            <property name="windowsOnly" value="true"/>
+        </ant>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="globus-url-copy"/>
+            <property name="class.name" 
+                value="org.globus.tools.GlobusUrlCopy"/>
+            <property name="windowsOnly" value="true"/>
+        </ant>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="globus-gass-server"/>
+            <property name="class.name" value="org.globus.tools.GassServer"/>
+            <property name="windowsOnly" value="true"/>
+        </ant>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" 
+                value="globus-gass-server-shutdown"/>
+            <property name="class.name" 
+                value="org.globus.tools.GassServerShutdown"/>
+            <property name="windowsOnly" value="true"/>
+        </ant>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="grid-change-pass-phrase"/>
+            <property name="class.name" 
+                value="org.globus.tools.ChangePassPhrase"/>
+            <property name="windowsOnly" value="true"/>
+        </ant>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="globus2jks"/>
+            <property name="class.name" 
+                value="org.globus.tools.KeyStoreConvert"/>
+        </ant>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="visual-grid-proxy-init"/>
+            <property name="class.name" 
+                value="org.globus.tools.proxy.GridProxyInit"/>
+            <property name="windowsOnly" value="true"/>
+        </ant>
+    </target>
+
+</project>

Added: incubator/apollo/globus/common/source/etc/templates/unix/launcher-template
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/etc/templates/unix/launcher-template?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/etc/templates/unix/launcher-template	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,65 @@
+#! /bin/sh
+
+EXEC="org.globus.bootstrap.Bootstrap @class@"
+DEF_OPTIONS="@default.jvm.options@"
+DEF_CMD_OPTIONS="@default.cmd.line@"
+
+updateOptions() {
+     
+  if [ "X$2" != "X" ] ; then
+    GLOBUS_OPTIONS="$GLOBUS_OPTIONS -D$1=$2"
+  fi
+
+}
+
+####### MAIN BODY ##########
+
+if [ ! -d "$GLOBUS_LOCATION" ] ; then
+  echo "Error: GLOBUS_LOCATION invalid or not set: $GLOBUS_LOCATION" 1>&2
+  exit 1
+fi
+
+LOCALCLASSPATH=$GLOBUS_LOCATION/lib/bootstrap.jar:$GLOBUS_LOCATION/lib/cog-url.jar:$GLOBUS_LOCATION/lib/axis-url.jar
+
+### SETUP OTHER VARIABLES ####
+
+updateOptions "GLOBUS_LOCATION" "$GLOBUS_LOCATION"
+updateOptions "java.endorsed.dirs" "$GLOBUS_LOCATION/endorsed"
+updateOptions "X509_USER_PROXY" "$X509_USER_PROXY"
+updateOptions "GLOBUS_HOSTNAME" "$GLOBUS_HOSTNAME"
+updateOptions "GLOBUS_TCP_PORT_RANGE" "$GLOBUS_TCP_PORT_RANGE"
+
+if [ "X$IBM_JAVA_OPTIONS" = "X" ] ; then
+  IBM_JAVA_OPTIONS=-Xquickstart
+  export IBM_JAVA_OPTIONS
+fi
+
+if [ $# -gt 0 ]; then
+  if [ "X${DEF_CMD_OPTIONS}" != "X" ]; then
+    set - ${GLOBUS_OPTIONS} -classpath ${LOCALCLASSPATH} ${EXEC}  ${DEF_CMD_OPTIONS} "$@"
+  else
+    set - ${GLOBUS_OPTIONS} -classpath ${LOCALCLASSPATH} ${EXEC} "$@"
+  fi
+else
+  if [ "X${DEF_CMD_OPTIONS}" != "X" ]; then
+    set - ${GLOBUS_OPTIONS} -classpath ${LOCALCLASSPATH} ${EXEC}  ${DEF_CMD_OPTIONS}
+  else
+    set - ${GLOBUS_OPTIONS} -classpath ${LOCALCLASSPATH} ${EXEC}
+  fi
+fi
+
+for i in `echo ${DEF_OPTIONS} |cut -d'-' -f1-` ; do
+  DEFINE=`echo $i|cut -d'=' -f1`
+  VALUE="`eval echo $i|cut -d'=' -f2`"
+  set - $DEFINE="$VALUE" "$@"
+done
+
+### EXECUTE ############
+
+if [ "X$JAVA_HOME" = "X" ] ; then
+  _RUNJAVA=java
+ else 
+  _RUNJAVA="$JAVA_HOME"/bin/java
+fi
+
+exec $_RUNJAVA "$@"

Added: incubator/apollo/globus/common/source/etc/templates/unix/setClassPath
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/etc/templates/unix/setClassPath?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/etc/templates/unix/setClassPath	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+LOCALCLASSPATH=""
+DIRLIBS=${GLOBUS_LOCATION}/lib/*.jar
+for i in ${DIRLIBS}
+do
+    # if the directory is empty, then it will return the input string
+    # this is stupid, so case for it
+    if [ "$i" != "${DIRLIBS}" ] ; then
+      if [ -z "$LOCALCLASSPATH" ] ; then
+	LOCALCLASSPATH=$i
+      else
+	LOCALCLASSPATH="$i":$LOCALCLASSPATH
+      fi
+    fi
+done
+LOCALCLASSPATH=${GLOBUS_LOCATION}:$LOCALCLASSPATH
+export LOCALCLASSPATH

Added: incubator/apollo/globus/common/source/etc/templates/unix/setenv.sh
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/etc/templates/unix/setenv.sh?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/etc/templates/unix/setenv.sh	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+. @script@
+
+CLASSPATH=${LOCALCLASSPATH}
+
+export CLASSPATH
+

Added: incubator/apollo/globus/common/source/etc/templates/windows/launcher-template
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/etc/templates/windows/launcher-template?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/etc/templates/windows/launcher-template	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,45 @@
+@echo off
+
+if "%GLOBUS_LOCATION%" == "" goto nopath
+goto path
+
+:nopath
+
+    echo Error: GLOBUS_LOCATION not set
+    goto end
+
+:path
+
+set CMD_LINE_ARGS=@default.cmd.line@
+
+:setupArgs
+if %1a==a goto doneStart
+set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
+shift
+goto setupArgs
+
+:doneStart
+set LOCALCLASSPATH="%GLOBUS_LOCATION%\lib\bootstrap.jar";"%GLOBUS_LOCATION%\lib\cog-url.jar";"%GLOBUS_LOCATION%\lib\axis-url.jar"
+set LOCAL_OPTS=-DGLOBUS_LOCATION="%GLOBUS_LOCATION%" -Djava.endorsed.dirs="%GLOBUS_LOCATION%\endorsed"
+
+if "%X509_USER_PROXY%" == "" goto portRange
+set LOCAL_OPTS=-DX509_USER_PROXY=%X509_USER_PROXY% %LOCAL_OPTS%
+
+:portRange
+if "%GLOBUS_TCP_PORT_RANGE%" == "" goto hostname
+set LOCAL_OPTS=-DGLOBUS_TCP_PORT_RANGE=%GLOBUS_TCP_PORT_RANGE% %LOCAL_OPTS%
+
+:hostname
+if "%GLOBUS_HOSTNAME%" == "" goto ibmvm
+set LOCAL_OPTS=-DGLOBUS_HOSTNAME=%GLOBUS_HOSTNAME% %LOCAL_OPTS%
+
+:ibmvm
+if not "%IBM_JAVA_OPTIONS%" == "" goto run
+set IBM_JAVA_OPTIONS=-Xquickstart
+
+:run
+set _RUNJAVA=java
+if not "%JAVA_HOME%" == "" set _RUNJAVA="%JAVA_HOME%\bin\java"
+%_RUNJAVA% @default.jvm.options@ %LOCAL_OPTS% %GLOBUS_OPTIONS% -classpath %LOCALCLASSPATH% org.globus.bootstrap.Bootstrap @class@ %CMD_LINE_ARGS%
+
+:end

Added: incubator/apollo/globus/common/source/etc/templates/windows/lcp.bat
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/etc/templates/windows/lcp.bat?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/etc/templates/windows/lcp.bat	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,9 @@
+@echo off
+set _CLASSPATHCOMPONENT=%1
+:argCheck
+if %2a==a goto gotAllArgs
+shift
+set _CLASSPATHCOMPONENT=%_CLASSPATHCOMPONENT% %1
+goto argCheck
+:gotAllArgs
+set LOCALCLASSPATH=%_CLASSPATHCOMPONENT%;%LOCALCLASSPATH%

Added: incubator/apollo/globus/common/source/etc/templates/windows/setClassPath.bat
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/etc/templates/windows/setClassPath.bat?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/etc/templates/windows/setClassPath.bat	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,5 @@
+@echo off
+
+set LOCALCLASSPATH=
+for %%i in ("%GLOBUS_LOCATION%\lib\*.jar") do call "%GLOBUS_LOCATION%\etc\templates\windows\lcp.bat" %%i
+set LOCALCLASSPATH=%GLOBUS_LOCATION%;%LOCALCLASSPATH%

Added: incubator/apollo/globus/common/source/pkgdata/filelist
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/pkgdata/filelist?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/pkgdata/filelist	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,90 @@
+bin/globus2jks
+etc/globus-devel-env.sh
+etc/globus-devel-setcp.bat
+etc/globus-devel-env.bat
+etc/globus-devel-env.csh
+etc/globus_packages/globus_wsrf_common/undeploy.xml
+etc/globus_wsrf_common/templates/unix/launcher-template
+etc/globus_wsrf_common/templates/unix/setenv.sh
+etc/globus_wsrf_common/templates/unix/setClassPath
+etc/globus_wsrf_common/templates/windows/launcher-template
+etc/globus_wsrf_common/templates/windows/lcp.bat
+etc/globus_wsrf_common/templates/windows/setClassPath.bat
+lib/bootstrap.jar
+lib/jug-1.0.1.jar
+lib/opensaml.jar
+lib/wsrf_provider_jce.jar
+lib/wss4j.jar
+lib/servlet.jar
+lib/wsdl4j.jar
+lib/jaxrpc.jar
+lib/puretls.jar
+lib/commonj.jar
+lib/xmlsec.jar
+lib/resolver.jar
+lib/commons-cli-2.0.jar
+lib/commons-collections-3.0.jar
+lib/wsrf_common.jar
+lib/naming-factory.jar
+lib/commons-discovery.jar
+lib/xercesImpl.jar
+lib/xalan.jar
+lib/cryptix.jar
+lib/axis.jar
+lib/axis-url.jar
+lib/jgss.jar
+lib/log4j-1.2.8.jar
+lib/commons-logging.jar
+lib/jce-jdk13-125.jar
+lib/addressing-1.0.jar
+lib/commons-digester.jar
+lib/naming-resources.jar
+lib/cog-jglobus.jar
+lib/cog-url.jar
+lib/cog-tomcat.jar
+lib/cog-axis.jar
+lib/concurrent.jar
+lib/xml-apis.jar
+lib/cryptix-asn1.jar
+lib/naming-java.jar
+lib/naming-common.jar
+lib/cryptix32.jar
+lib/commons-beanutils.jar
+lib/saaj.jar
+endorsed/xalan.jar
+docs/globus_wsrf_common/dependencies.html
+share/globus_wsrf_common/build-packages.xml
+share/globus_wsrf_common/build-launcher.xml
+share/globus_wsrf_common/tomcat/tomcat.xml
+share/globus_wsrf_common/tomcat/web.xml
+share/licenses/addressing-1.0.LICENSE
+share/licenses/axis.LICENSE
+share/licenses/bouncycastle.LICENSE
+share/licenses/cog-jglobus.contrib.LICENSE
+share/licenses/commonj.LICENSE
+share/licenses/commons-beanutils.LICENSE
+share/licenses/commons-cli-2.0.LICENSE
+share/licenses/commons-collections-3.0.LICENSE
+share/licenses/commons-digester.LICENSE
+share/licenses/commons-discovery.LICENSE
+share/licenses/commons-logging.LICENSE
+share/licenses/concurrent.LICENSE
+share/licenses/cryptix.LICENSE
+share/licenses/jaxrpc.LICENSE
+share/licenses/jug-1.0.1.LICENSE
+share/licenses/LICENSE-DOM.html
+share/licenses/LICENSE-SAX.html
+share/licenses/log4j-1.2.8.LICENSE
+share/licenses/naming.LICENSE
+share/licenses/opensaml.LICENSE
+share/licenses/puretls.LICENSE
+share/licenses/resolver.LICENSE
+share/licenses/RSA.LICENSE
+share/licenses/saaj.LICENSE
+share/licenses/servlet.LICENSE
+share/licenses/wsdl4j.LICENSE
+share/licenses/wss4j.LICENSE
+share/licenses/xalan.LICENSE
+share/licenses/xerces.LICENSE
+share/licenses/xml-apis.LICENSE
+share/licenses/xmlsec.LICENSE

Added: incubator/apollo/globus/common/source/pkgdata/pkg_data_src.gpt
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/pkgdata/pkg_data_src.gpt?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/pkgdata/pkg_data_src.gpt	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE gpt_package_metadata SYSTEM "package.dtd">
+
+<gpt_package_metadata Format_Version="0.01" Name="globus_java_ws_core_common">
+
+    <Aging_Version Age="0" Major="0" Minor="1"/>
+    <Description>
+        Code and libraries shared by other Java WS Core packages
+    </Description>
+    <Functional_Group>Core</Functional_Group>
+    <Version_Stability Release="alpha" />
+
+    <src_pkg >
+
+        <Build_Environment >
+            <cflags ></cflags>
+            <external_includes ></external_includes>
+            <pkg_libs ></pkg_libs>
+            <external_libs ></external_libs>
+        </Build_Environment>
+
+        <With_Flavors build="no" />
+
+        <Version_Label>0.1</Version_Label>
+
+        <Source_Dependencies Type="compile" >
+        </Source_Dependencies>
+
+        <Build_Instructions>
+            <Build_Step>ant deploy -Ddeploy.dir=INSTALLDIR_GPTMACRO</Build_Step>
+        </Build_Instructions>
+
+    </src_pkg >
+
+</gpt_package_metadata>

Added: incubator/apollo/globus/common/source/share/build-launcher.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/share/build-launcher.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/share/build-launcher.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,131 @@
+<?xml version="1.0"?>
+
+<!-- ===================================================================
+
+   Build File for Building Globus WSRF command-line tools.
+
+Notes:
+   This is a build file for use with the Jakarta Ant build tool.
+
+Prerequisites:
+
+   jakarta-ant from http://jakarta.apache.org
+
+
+Build Instructions:
+   To build, run
+
+     java org.apache.tools.ant.Main <target>
+
+   on the directory where this file is located with the target you want.
+
+Most useful targets:
+
+
+Copyright:
+Copyright (c) 1999 University of Chicago and The University of
+Southern California. All Rights Reserved.
+
+==================================================================== -->
+
+<project basedir="." default="help">
+
+    <!-- Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) -->
+
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    <property file="wsrf.properties"/>
+
+    <property name="env.GLOBUS_LOCATION" value="."/>
+    <property name="deploy.dir" location="."/>
+    <property name="abs.deploy.dir" location="${deploy.dir}"/>
+
+    <property name="templates"
+              location="${abs.deploy.dir}/etc/globus_wsrf_common/templates"/>
+    <property name="default.jvm.options" value=""/>
+    <property name="default.cmd.line" value=""/>
+
+    <property name="windowsOnly" value="false"/>
+
+    <target name="help"/>
+
+    <!--  Generate launcher scripts for a Java tool.
+    Parameters:  deploy.dir
+    launcher-name, class.name
+    [overwrite.launcher, 
+    default.jvm.options, default.cmd.line]
+    -->
+    <target name="generateLauncher">
+        <filterset id="script.filter.set">
+            <filter token="globus.location" value="${abs.deploy.dir}"/>
+            <filter token="class" value="${class.name}"/>
+            <filter token="default.jvm.options" 
+                value="${default.jvm.options}"/>
+            <filter token="default.cmd.line" value="${default.cmd.line}"/>
+        </filterset>
+        <property name="tools.dest" location="${abs.deploy.dir}/bin"/>
+        <mkdir dir="${tools.dest}"/>
+        <chmod dir="${tools.dest}" perm="755"/>
+        <antcall target="generateUnix" inheritRefs="true"/>
+        <antcall target="generateWindows" inheritRefs="true"/>
+    </target>
+
+    <target name="testUnix">
+        <condition property="generate.unix">
+          <or>
+            <istrue value="${all.scripts}"/>
+            <and>
+                <os family="unix"/>
+                <isfalse value="${windowsOnly}"/>
+            </and>
+          </or>
+        </condition>
+    </target>
+
+    <target name="testWindows">
+        <condition property="generate.windows">
+            <or>
+                <os family="windows"/>
+                <istrue value="${all.scripts}"/>
+            </or>
+        </condition>
+    </target>
+
+    <target name="generateUnix" if="generate.unix" depends="testUnix">
+        <echo message="Creating Unix launcher script ${launcher-name}"/>
+        <filterset refid="script.filter.set"/>
+        <!-- Unix script-->
+        <property name="scripts.dest.unix"
+            location="${abs.deploy.dir}/${scripts.dest}/unix"/>
+        <filter token="script"
+            value="${scripts.dest.unix}/${cp.script}"/>
+        <copy file="${templates}/unix/launcher-template"
+            tofile="${tools.dest}/${launcher-name}"
+            filtering="true"
+            overwrite="${overwrite.launcher}">
+            <filterset refid="script.filter.set"/>
+        </copy>
+        <fixcrlf srcdir="${tools.dest}/" eol="lf"
+            includes="${launcher-name}"/>
+        <chmod file="${tools.dest}/${launcher-name}" perm="755"/>
+    </target>
+
+    <target name="generateWindows" if="generate.windows" depends="testWindows">
+        <echo message="Creating Windows launcher script ${launcher-name}"/>
+        <!-- Windows script-->
+        <property name="scripts.dest.win"
+            location="${abs.deploy.dir}/${scripts.dest}/windows"/>
+        <filter token="script"
+            value="${scripts.dest.win}\${cp.script}"/>
+        <copy file="${templates}/windows/launcher-template"
+            tofile="${tools.dest}/${launcher-name}.bat"
+            filtering="true" 
+            overwrite="${overwrite.launcher}">
+            <filterset refid="script.filter.set"/>
+        </copy>
+        <fixcrlf srcdir="${tools.dest}/" eol="crlf"
+            includes="${launcher-name}.bat"/>
+    </target>
+    
+</project>

Added: incubator/apollo/globus/common/source/share/build-packages.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/share/build-packages.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/share/build-packages.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,456 @@
+<?xml version="1.0"?>
+
+<!-- ===================================================================
+
+   Build file for Web Services Resource Framework (WSRF) Packaging
+
+Notes:
+   This is a build file for use with the Jakarta Ant build tool.
+
+Prerequisites:
+
+   jakarta-ant from http://jakarta.apache.org
+
+
+Build Instructions:
+   To build, run
+
+     java org.apache.tools.ant.Main <target>
+
+   on the directory where this file is located with the target you want.
+
+Most useful targets:
+
+ - makeGar  -> creates a Grid archive that can be deployed in a Grid service 
+container
+ - deployGar  -> deploys Gar in Standalone Grid service container
+ - undeployGar  -> undeploys Gar from Standalone Grid service container
+
+Copyright:
+Copyright (c) 1999 University of Chicago and The University of 
+Southern California. All Rights Reserved.
+
+==================================================================== -->
+
+<project default="makeGar" basedir=".">
+
+    <!-- Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) -->
+
+    <property environment="env"/>
+
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+
+    <property file="docs.dest" value="./"/>
+    <property file="wsrf.properties"/>
+    <property name="gar.dest" value="${basedir}/tmp/gar"/>
+
+    <property name="gar.name" value="${gar.id}.gar"/>  
+    <property name="garserverdeployment.file" 
+        value="deploy-server.wsdd"/>  
+    <property name="garclientdeployment.file"
+        value="deploy-client.wsdd"/>  
+    <property name="garjndiconfigdeployment.file" 
+        value="deploy-jndi-config.xml"/>  
+
+    <property name="env.GLOBUS_LOCATION" value="."/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="abs.deploy.dir" location="${deploy.dir}"/>
+
+    <property name="config.dir" value="etc"/>
+
+    <path id="classpath">
+        <fileset dir=".">
+            <include name="lib/*.jar"/>
+        </fileset>
+        <fileset dir="${abs.deploy.dir}/lib">
+            <include name="*.jar"/>
+        </fileset>
+        <pathelement path="${java.class.path}"/>
+    </path>
+
+
+    <!-- ================================================================ -->
+    <!-- Target used to build a GAR                                       -->
+    <!-- ================================================================ -->
+    <target name="makeGar">
+        <antcall target="copyJars">
+        	<reference refid="${garjars.id}"/>
+        </antcall>
+        <antcall target="copySchema">
+        	<reference refid="${garschema.id}"/>
+        </antcall>
+        <antcall target="copyEtc">
+        	<reference refid="${garetc.id}"/>
+        </antcall>
+        <antcall target="copyShare">
+        	<reference refid="${garshare.id}"/>
+        </antcall>
+        <antcall target="copyDocs">
+        	<reference refid="${gardocs.id}"/>
+        </antcall>
+        <antcall target="copyBin">
+        	<reference refid="${garbin.id}"/>
+        </antcall>
+        <copy file="${garserverdeployment.file}"
+            tofile="${gar.dest}/server-deploy.wsdd"
+            failonerror="false"/>
+        <copy file="${garclientdeployment.file}"
+            tofile="${gar.dest}/client-deploy.wsdd"
+            failonerror="false"/>
+        <copy file="${garjndiconfigdeployment.file}"
+            tofile="${gar.dest}/jndi-config-deploy.xml"
+            failonerror="false"/>
+        <jar destfile="${gar.name}" basedir="${gar.dest}"/>
+        <delete dir="${gar.dest}"/>
+    </target>
+
+    <target name="testShare">
+        <condition property="share.available">
+            <isset property="garshare.id"/>
+        </condition>
+    </target>
+    <target name="copyShare" depends="testShare" if="share.available">
+        <copy todir="${gar.dest}/share">
+            <fileset refid="${garshare.id}"/>
+        </copy>
+    </target>
+
+    <target name="testEtc">
+        <condition property="etc.available">
+            <isset property="garetc.id"/>
+        </condition>
+    </target>
+    <target name="copyEtc" depends="testEtc" if="etc.available">
+        <copy todir="${gar.dest}/etc">
+            <fileset refid="${garetc.id}"/>
+        </copy>
+    </target>
+
+    <target name="testDocs">
+        <condition property="docs.available">
+            <isset property="gardocs.id"/>
+        </condition>
+    </target>
+    <target name="copyDocs" depends="testDocs" if="docs.available">
+        <copy todir="${gar.dest}/docs">
+            <fileset refid="${gardocs.id}"/>
+        </copy>
+    </target>
+
+    <target name="testBin">
+        <condition property="bin.available">
+            <isset property="garbin.id"/>
+        </condition>
+    </target>
+    <target name="copyBin" depends="testBin" if="bin.available">
+        <copy todir="${gar.dest}/bin">
+            <fileset refid="${garbin.id}"/>
+        </copy>
+    </target>
+
+    <target name="testPostDeployAvailable" depends="setGarID">
+        <property name="postDeploy.file" 
+            value="${gar.dest}/etc/post-deploy.xml"/>
+        <available property="postDeploy.available" type="file"
+            file="${postDeploy.file}"/>
+    </target>
+    
+    <target name="postDeploy" depends="testPostDeployAvailable"
+            if="postDeploy.available">
+        <ant antfile="${postDeploy.file}" target="setup"/>
+        <delete file="${postDeploy.file}" failonerror="false"/>
+    </target>
+
+    <target name="testJars">
+        <condition property="jars.available">
+            <isset property="garjars.id"/>
+        </condition>
+    </target>
+    <target name="copyJars" depends="testJars" if="jars.available">
+        <copy todir="${gar.dest}/lib">
+            <fileset refid="${garjars.id}"/>
+        </copy>
+    </target>
+
+    <target name="testSchema">
+        <condition property="schema.available">
+            <isset property="garschema.id"/>
+        </condition>
+    </target>
+    <target name="copySchema" depends="testSchema" if="schema.available">
+        <copy todir="${gar.dest}/schema">
+            <fileset refid="${garschema.id}"/>
+        </copy>
+    </target>
+
+    <!-- 
+     User callable task
+     Input: 'gar.name' - gar file location
+            'profile'  - name of the cfg profile
+            'noSchema' - if true, schema files in the gar will not be deployed
+    -->
+    <target name="deployGar" description="Deploys a GAR file. Must specify -Dgar.name=&lt;gar file&gt;">
+        <condition property="profile.name" value="${profile}-">
+           <isset property="profile"/>
+        </condition>
+        <condition property="profile.name" value="">
+          <not>
+           <isset property="profile"/>
+          </not>
+        </condition>
+        <condition property="profile.desc" value="${profile}">
+           <isset property="profile"/>
+        </condition>
+        <condition property="profile.desc" value="&lt;default&gt;">
+          <not>
+           <isset property="profile"/>
+          </not>
+        </condition>
+        <echo message="Deploying gar with profile: ${profile.desc}"/>
+        <antcall target="deployGarFiles"/>
+        <antcall target="deployServer"/>
+        <antcall target="deployClient"/>
+        <antcall target="deployJNDIConfig"/>
+        <antcall target="generateUndeploy"/>
+        <antcall target="postDeploy"/>
+        <delete dir="${gar.dest}"/>
+    </target>
+
+    <target name="setGarID">
+        <basename property="gar.id" file="${gar.name}" suffix=".gar"/>
+    </target>
+
+    <target name="testServerDeployAvailable">
+        <available property="serverDeploy.available" type="file"
+            file="${gar.dest}/server-deploy.wsdd"/>
+    </target>
+    <target name="deployServer" 
+            depends="testServerDeployAvailable, setGarID"
+            if="serverDeploy.available">
+        <echo message="deploying server config..."/>
+        <mkdir dir="${abs.deploy.dir}/${config.dir}/${gar.id}"/>
+        <chmod dir="${abs.deploy.dir}/${config.dir}/${gar.id}" perm="755"/>
+        <copy file="${gar.dest}/server-deploy.wsdd"
+              tofile="${abs.deploy.dir}/${config.dir}/${gar.id}/${profile.name}server-config.wsdd">
+           <filterset>
+             <filter token="gar.id" value="${gar.id}"/>
+             <filter token="config.dir" value="etc/${gar.id}"/>
+           </filterset>
+        </copy>
+        <chmod file="${abs.deploy.dir}/${config.dir}/${gar.id}/${profile.name}server-config.wsdd" perm="600"/>
+    </target>
+
+    <target name="testJNDIConfigDeployAvailable">
+        <available property="jndiConfigDeploy.available" type="file"
+            file="${gar.dest}/jndi-config-deploy.xml"/>
+    </target>
+    <target name="deployJNDIConfig" 
+            depends="testJNDIConfigDeployAvailable, setGarID"
+            if="jndiConfigDeploy.available">
+        <echo message="deploying JNDI config..."/>
+        <mkdir dir="${abs.deploy.dir}/${config.dir}/${gar.id}"/>
+        <chmod dir="${abs.deploy.dir}/${config.dir}/${gar.id}" perm="755"/>
+        <copy file="${gar.dest}/jndi-config-deploy.xml"
+              tofile="${abs.deploy.dir}/${config.dir}/${gar.id}/${profile.name}jndi-config.xml">
+           <filterset>
+             <filter token="gar.id" value="${gar.id}"/>
+             <filter token="config.dir" value="etc/${gar.id}"/>
+           </filterset>
+        </copy>
+        <chmod file="${abs.deploy.dir}/${config.dir}/${gar.id}/${profile.name}jndi-config.xml" perm="600"/>
+    </target>
+
+    <!-- 
+     User callable task
+     Input: 'gar.id' - gar id to remove - all cfg profiles are removed.
+    -->
+    <target name="undeployGar" description="Undeploy a GAR file. Must specify -Dgar.id=&lt;gar id&gt;">
+        <fail message="Must specify gar id to undeploy" unless="gar.id"/>
+        <ant dir="${abs.deploy.dir}/etc/globus_packages/${gar.id}"
+            inheritAll="false" antfile="undeploy.xml">
+            <property name="deploy.dir" location="${abs.deploy.dir}"/>
+        </ant>
+        <delete file="${abs.deploy.dir}/etc/globus_packages/${gar.id}/undeploy.xml"/>
+        <delete dir="${abs.deploy.dir}/etc/globus_packages/${gar.id}"/>
+    </target>
+
+    <target name="testClientDeployAvailable">
+        <available property="clientDeploy.available" type="file" 
+            file="${gar.dest}/client-deploy.wsdd"/>
+    </target>
+    <target name="deployClient" depends="testClientDeployAvailable" 
+            if="clientDeploy.available">
+        <echo message="deploying client config..."/>
+        <java classname="org.apache.axis.utils.Admin" 
+              classpathref="classpath" 
+              dir="${abs.deploy.dir}"
+              fork="true" 
+              failonerror="true">
+            <arg value="client"/>
+            <arg value="${gar.dest}/client-deploy.wsdd"/>
+        </java>
+        <fixcrlf srcdir="${abs.deploy.dir}" eol="lf" 
+                 includes="client-config.wsdd"/>
+    </target>
+
+    <target name="deployGarFiles" depends="setGarID">
+        <mkdir dir="${gar.dest}"/>
+        <chmod file="${gar.dest}" perm="700"/>
+        <mkdir dir="${gar.dest}/schema"/>
+        <mkdir dir="${gar.dest}/etc"/>
+        <mkdir dir="${gar.dest}/bin"/>
+        <mkdir dir="${gar.dest}/docs"/>
+        <mkdir dir="${gar.dest}/share"/>
+        <mkdir dir="${gar.dest}/lib"/>
+
+        <unjar src="${gar.name}" dest="${gar.dest}"/>
+
+        <copy todir="${abs.deploy.dir}/docs/${gar.id}" includeEmptyDirs="false">
+            <fileset dir="${gar.dest}/docs"/>
+        </copy>
+
+        <antcall target="setDefaultPermissions" inheritAll="false">
+            <param name="target.dir" value="${abs.deploy.dir}/docs/${gar.id}"/>
+            <param name="source.dir" value="${gar.dest}/docs"/>
+        </antcall>
+
+        <copy todir="${abs.deploy.dir}/share/${gar.id}" includeEmptyDirs="false">
+            <fileset dir="${gar.dest}/share"/>
+        </copy>
+
+        <antcall target="setDefaultPermissions" inheritAll="false">
+            <param name="target.dir" value="${abs.deploy.dir}/share/${gar.id}"/>
+            <param name="source.dir" value="${gar.dest}/share"/>
+        </antcall>
+
+        <antcall target="deploySchema"/>
+        <copy todir="${abs.deploy.dir}/etc/${gar.id}" includeEmptyDirs="false">
+            <fileset dir="${gar.dest}/etc">
+              <exclude name="post-deploy.xml"/>
+            </fileset>
+        </copy>
+
+        <antcall target="setDefaultPermissions" inheritAll="false">
+            <param name="target.dir" value="${abs.deploy.dir}/etc/${gar.id}"/>
+            <param name="source.dir" value="${gar.dest}/etc"/>
+        </antcall>
+
+        <copy todir="${abs.deploy.dir}/bin">
+            <fileset dir="${gar.dest}/bin"/>
+        </copy>
+
+        <antcall target="setExecutablePermissions" inheritAll="false">
+            <param name="target.dir" value="${abs.deploy.dir}/bin"/>
+            <param name="source.dir" value="${gar.dest}/bin"/>
+        </antcall>
+
+        <copy todir="${abs.deploy.dir}/lib">
+            <fileset dir="${gar.dest}/lib">
+                <include name="**/*.jar"/>
+            </fileset>
+        </copy>
+
+        <antcall target="setDefaultPermissions" inheritAll="false">
+            <param name="target.dir" value="${abs.deploy.dir}/lib"/>
+            <param name="source.dir" value="${gar.dest}/lib"/>
+        </antcall>
+
+        <copy todir="${abs.deploy.dir}/share/licenses">
+            <fileset dir="${gar.dest}/lib">
+                <include name="**/*LICENSE*"/>
+            </fileset>
+        </copy>
+
+        <antcall target="setDefaultPermissions" inheritAll="false">
+            <param name="target.dir" value="${abs.deploy.dir}/share/licenses"/>
+            <param name="source.dir" value="${gar.dest}/lib"/>
+        </antcall>
+    </target>
+
+    <target name="deploySchema" unless="noSchema">
+        <copy todir="${abs.deploy.dir}/share/schema">
+            <fileset dir="${gar.dest}/schema"/>
+        </copy>
+        
+        <antcall target="setDefaultPermissions" inheritAll="false">
+            <param name="target.dir" value="${abs.deploy.dir}/share/schema"/>
+            <param name="source.dir" value="${gar.dest}/schema"/>
+        </antcall>
+    </target>
+
+    <target name="addDocs">
+        <!-- work around for bug in ant 1.5 with jar update -->
+        <touch file="${gar.name}" millis="0"/>
+        <copy todir="${gar.dest}/docs/">
+            <fileset dir="${docs.dir}"/>
+        </copy>
+        <jar destfile="${gar.name}" update="true" basedir="${gar.dest}"/>
+        <delete dir="${gar.dest}"/>
+    </target>
+    <target name="addEtc">
+        <!-- work around for bug in ant 1.5 with jar update -->
+        <touch file="${gar.name}" millis="0"/>
+        <copy todir="${gar.dest}/etc/">
+            <fileset dir="${etc.dir}"/>
+        </copy>
+        <jar destfile="${gar.name}" update="true" basedir="${gar.dest}"/>
+        <delete dir="${gar.dest}"/>
+    </target>
+    <target name="addBin">
+        <!-- work around for bug in ant 1.5 with jar update -->
+        <touch file="${gar.name}" millis="0"/>
+        <copy todir="${gar.dest}/bin/">
+            <fileset dir="${bin.dir}"/>
+        </copy>
+        <jar destfile="${gar.name}" update="true" basedir="${gar.dest}"/>
+        <delete dir="${gar.dest}"/>
+    </target>
+
+    <target name="getDocs">
+        <unjar src="${gar.name}" dest="${docs.dest}">
+            <patternset>
+                <include name="docs/*"/>
+            </patternset>
+        </unjar>
+    </target>
+
+    <target name="generateUndeploy">
+        <java classname="org.globus.tools.gar.GenerateUndeploy"
+            classpathref="classpath"
+            fork="true"
+            failonerror="true">
+            <arg value="${gar.name}"/>
+            <arg value="${abs.deploy.dir}"/>      
+        </java>
+    </target>
+
+    <target name="targetDirExists">
+        <available file="${target.dir}" property="target.dir.exists"/>
+    </target>
+
+    <target name="setDefaultPermissions" depends="targetDirExists" if="target.dir.exists">
+        <chmod perm="644" type="file">
+            <fileset dir="${target.dir}">
+                <present targetdir="${source.dir}"/>
+            </fileset>
+        </chmod>
+
+        <chmod perm="755" type="dir">
+            <fileset file="${target.dir}"/>
+            <fileset dir="${target.dir}">
+                <present targetdir="${source.dir}"/>
+            </fileset>
+        </chmod>
+    </target>
+
+    <target name="setExecutablePermissions" depends="targetDirExists" if="target.dir.exists">
+        <chmod perm="755">
+            <fileset file="${target.dir}"/>
+            <fileset dir="${target.dir}">
+                <present targetdir="${source.dir}"/>
+            </fileset>
+        </chmod>
+    </target>
+</project>

Added: incubator/apollo/globus/common/source/share/tomcat/tomcat.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/share/tomcat/tomcat.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/share/tomcat/tomcat.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,203 @@
+<?xml version="1.0"?>
+
+<!-- ===================================================================
+
+   Build File for Deploying Java WS Core into Tomcat
+
+Notes:
+   This is a build file for use with the Jakarta Ant build tool.
+
+Prerequisites:
+
+   jakarta-ant from http://jakarta.apache.org
+
+Build Instructions:
+   To build, run
+
+     java org.apache.tools.ant.Main <target>
+
+   on the directory where this file is located with the target you want.
+
+Copyright:
+Copyright (c) 1999 University of Chicago and The University of 
+Southern California. All Rights Reserved.
+
+==================================================================== -->
+
+<project default="deployTomcat" basedir=".">
+
+  <property name="env.GLOBUS_LOCATION" value="../../../"/>
+  <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+  <property name="abs.deploy.dir" location="${deploy.dir}"/>
+
+  <property name="webapp.name" value="wsrf"/>
+
+  <!-- =================================================================== -->
+  <!-- Tomcat deployment                                                   -->
+  <!-- =================================================================== -->
+
+  <target name="_baseTomcatDeploy">
+   <fail message="Must specify -Dtomcat.dir=&lt;tomcat root&gt;" 
+         unless="tomcat.dir"/>
+   <available file="${tomcat.dir}" type="dir" property="tomcat.dir.exists"/>
+   <fail message="${tomcat.dir} directory does not exists" 
+         unless="tomcat.dir.exists"/>
+
+   <mkdir dir="${webapp.dir}" />
+   <copy toDir="${webapp.dir}" >
+     <fileset dir="${abs.deploy.dir}" casesensitive="yes">
+       <include name="share/schema/**"/>
+     </fileset>
+   </copy>
+
+   <mkdir dir="${webapp.webinf.dir}" />
+   <copy toDir="${webapp.webinf.dir}" >
+     <fileset dir="${abs.deploy.dir}" casesensitive="yes">
+       <include name="etc/**/*.xml"/>
+       <include name="etc/**/*.wsdd"/>
+       <exclude name="etc/globus_packages/**"/>
+       <include name="server-config.wsdd"/>
+     </fileset>
+   </copy>
+
+   <mkdir dir="${webapp.webinf.dir}/classes" />
+   <copy toDir="${webapp.webinf.dir}/classes" >
+     <fileset dir="${abs.deploy.dir}" casesensitive="yes">
+       <include name="client-config.wsdd"/>
+       <include name="client-server-config.wsdd"/>
+     </fileset>
+   </copy>
+   <copy file="${abs.deploy.dir}/log4j.properties" 
+         toDir="${webapp.webinf.dir}/classes"/>
+
+   <mkdir dir="${webapp.webinf.lib.dir}" />
+   <copy file="${basedir}/web.xml" toDir="${webapp.webinf.dir}"/>
+
+   <copy file="${abs.deploy.dir}/lib/xalan.jar" 
+         toDir="${tomcat.dir}/common/endorsed" 
+         failonerror="false"/>
+
+  </target>
+
+  <target name="deployTomcat" 
+          description="Deploy GT4 into Tomcat. Must specify -Dtomcat.dir=&lt;tomcat root&gt;">
+   <property name="webapp.dir" value="${tomcat.dir}/webapps/${webapp.name}"/>
+   <property name="webapp.webinf.dir" value="${webapp.dir}/WEB-INF"/>
+   <property name="webapp.webinf.lib.dir" value="${webapp.webinf.dir}/lib"/>
+
+   <antcall target="_baseTomcatDeploy"/>
+
+   <copy toDir="${webapp.webinf.lib.dir}" >
+     <fileset dir="${abs.deploy.dir}/lib" casesensitive="yes">
+       <include name="*"/>
+       <exclude name="servlet.jar"/>
+       <exclude name="xml-apis.jar"/>
+     </fileset>
+   </copy>
+
+  </target>
+
+  <target name="redeployTomcat"
+          description="Redeploy GT4 into Tomcat. Must specify -Dtomcat.dir=&lt;tomcat root&gt;">
+    <fail message="Must specify -Dtomcat.dir=&lt;tomcat root&gt;" 
+          unless="tomcat.dir"/>
+    <delete dir="${tomcat.dir}/webapps/${webapp.name}"/>
+    <antcall target="deployTomcat" />
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Tomcat deployment with transport security                           -->
+  <!-- =================================================================== -->
+
+  <target name="deploySecureTomcat" 
+          description="Deploy GT4 into Tomcat with transport security. Must specify -Dtomcat.dir=&lt;tomcat root&gt;">
+   <property name="webapp.dir" value="${tomcat.dir}/webapps/${webapp.name}"/>
+   <property name="webapp.webinf.dir" value="${webapp.dir}/WEB-INF"/>
+   <property name="webapp.webinf.lib.dir" value="${webapp.webinf.dir}/lib"/>
+
+   <antcall target="_baseTomcatDeploy"/>
+
+   <copy toDir="${webapp.webinf.lib.dir}" >
+     <fileset dir="${abs.deploy.dir}/lib" casesensitive="yes">
+       <include name="*"/>
+       <exclude name="servlet.jar"/>
+       <exclude name="xml-apis.jar"/>
+       <exclude name="cog-tomcat.jar"/>
+       <exclude name="cog-jglobus.jar"/>
+       <exclude name="cryptix.jar"/>
+       <exclude name="cryptix-asn1.jar"/>
+       <exclude name="cryptix32.jar"/>
+       <exclude name="jce-jdk13-125.jar"/>
+       <exclude name="jgss.jar"/>
+       <exclude name="log4j-1.2.8.jar"/>
+       <exclude name="puretls.jar"/>
+     </fileset>
+   </copy>
+
+   <copy toDir="${tomcat.dir}/common/lib" >
+     <fileset dir="${abs.deploy.dir}/lib" casesensitive="yes">
+       <include name="cog-jglobus.jar"/>
+       <include name="xml-apis.jar"/>
+       <include name="cryptix.jar"/>
+       <include name="cryptix-asn1.jar"/>
+       <include name="cryptix32.jar"/>
+       <include name="jce-jdk13-125.jar"/>
+       <include name="jgss.jar"/>
+       <include name="log4j-1.2.8.jar"/>
+       <include name="puretls.jar"/>
+     </fileset>
+   </copy>
+
+   <copy file="${abs.deploy.dir}/lib/cog-tomcat.jar" 
+         toDir="${tomcat.dir}/server/lib" 
+         failonerror="false"/>
+
+   <replace file="${webapp.webinf.dir}/etc/globus_wsrf_core/server-config.wsdd">
+     <replacetoken><![CDATA[<!-- @TOMCAT_SEC_HANDLER@ -->]]></replacetoken>
+     <replacevalue><![CDATA[<handler type="java:org.globus.wsrf.impl.security.authentication.transport.TomcatTransportSecurityHandler"/>]]></replacevalue>
+   </replace>
+  </target>
+
+  <target name="redeploySecureTomcat"
+          description="Redeploy GT4 into Tomcat (transport security enabled). Must specify -Dtomcat.dir=&lt;tomcat root&gt;">
+   <fail message="Must specify -Dtomcat.dir=&lt;tomcat root&gt;" 
+         unless="tomcat.dir"/>
+    <delete dir="${tomcat.dir}/webapps/${webapp.name}"/>
+    <delete>
+     <fileset dir="${tomcat.dir}/common/lib" casesensitive="yes">
+       <include name="cog-jglobus.jar"/>
+       <include name="xml-apis.jar"/>
+       <include name="cryptix.jar"/>
+       <include name="cryptix-asn1.jar"/>
+       <include name="cryptix32.jar"/>
+       <include name="jce-jdk13-125.jar"/>
+       <include name="jgss.jar"/>
+       <include name="log4j-1.2.8.jar"/>
+       <include name="puretls.jar"/>
+     </fileset>
+    </delete>
+    <delete file="${tomcat.dir}/server/lib/cog-tomcat.jar"/>
+    <antcall target="deploySecureTomcat" />
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- This target generates the war file that should run in any servlet   -->
+  <!-- container. Some shared files might need to be installed separately  -->
+  <!-- =================================================================== -->
+
+  <target name="war" 
+          description="Creates a war file. Must specify -Dwar.file=&lt;war file path&gt;">
+   <fail message="Must specify -Dwar.file=&lt;war file path&gt;" 
+         unless="war.file"/>
+   <mkdir dir="temp-tomcat"/>
+   <antcall target="deployTomcat">
+     <param name="tomcat.dir" value="temp-tomcat"/>
+   </antcall>
+   <war destfile="${war.file}"
+        webxml="temp-tomcat/webapps/${webapp.name}/WEB-INF/web.xml" 
+        excludes="WEB-INF/web.xml" 
+        basedir="temp-tomcat/webapps/${webapp.name}"/>
+   <delete dir="temp-tomcat"/>
+ </target>
+
+</project>

Added: incubator/apollo/globus/common/source/share/tomcat/web.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/share/tomcat/web.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/share/tomcat/web.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+  <display-name>WSRF Container Servlet</display-name>
+
+   <listener>
+     <listener-class>org.apache.axis.transport.http.AxisHTTPSessionListener</listener-class>
+   </listener>
+
+  <servlet>
+    <servlet-name>WSRFServlet</servlet-name>
+    <display-name>WSRF Container Servlet</display-name>
+    <servlet-class>
+        org.globus.wsrf.container.AxisServlet
+    </servlet-class>
+    <load-on-startup>true</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>WSRFServlet</servlet-name>
+    <url-pattern>/servlet/AxisServlet</url-pattern>
+  </servlet-mapping>
+
+  <servlet-mapping>
+    <servlet-name>WSRFServlet</servlet-name>
+    <url-pattern>*.jws</url-pattern>
+  </servlet-mapping>
+
+  <servlet-mapping>
+    <servlet-name>WSRFServlet</servlet-name>
+    <url-pattern>/services/*</url-pattern>
+  </servlet-mapping>
+
+  <session-config>
+    <!-- Default to 5 minute session timeouts -->
+    <session-timeout>5</session-timeout>
+  </session-config>
+
+  <mime-mapping>
+      <extension>wsdl</extension>
+      <mime-type>text/xml</mime-type>
+  </mime-mapping>
+
+  <mime-mapping>
+     <extension>xsd</extension>
+     <mime-type>text/xml</mime-type>
+  </mime-mapping>
+
+</web-app>

Added: incubator/apollo/globus/common/source/src/org/globus/bootstrap/Bootstrap.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/src/org/globus/bootstrap/Bootstrap.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/src/org/globus/bootstrap/Bootstrap.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,110 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.bootstrap;
+
+import java.io.IOException;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+public class Bootstrap {
+
+    private static final String GLOBUS_LOCATION = "GLOBUS_LOCATION";
+
+    private static final Class[] MAIN_PARAMS_TYPE = {String[].class};
+
+    public static void main(String[] args) throws BootstrapException {
+        
+        String base = System.getProperty(GLOBUS_LOCATION);
+        if (base == null) {
+            throw new BootstrapException(GLOBUS_LOCATION + 
+                                         " system property not set");
+        }
+
+        if (args.length == 0) {
+            throw new BootstrapException("Class name argument required");
+        }
+
+        String launchClass = args[0];
+        String[] launchArgs = new String[args.length-1];
+        System.arraycopy(args, 1, launchArgs, 0, launchArgs.length);
+
+        File baseDir = new File(base);
+        if (!baseDir.exists() || 
+            !baseDir.isDirectory() ||
+            !baseDir.canRead()) {
+            throw new BootstrapException(baseDir + " does not exist, is not a directory, or is not readable");
+        }
+        try {
+            baseDir = baseDir.getCanonicalFile();
+        } catch (IOException e) {
+            throw new BootstrapException("Failed to get the canonical form of " + base);
+        }
+        File libDir = new File(baseDir, "lib");
+        if (!libDir.exists() || 
+            !libDir.isDirectory() ||
+            !libDir.canRead()) {
+            throw new BootstrapException(libDir + " does not exist, is not a directory, or is not readable");
+        }
+        
+        File[] jars = libDir.listFiles(new JarFilter());
+        URL[] urlJars = null;
+        try {
+            if (jars == null) {
+                urlJars = new URL[1];
+            } else {
+                urlJars = new URL[jars.length + 1];
+                for (int i=0;i<jars.length;i++) {
+                    urlJars[i+1] = jars[i].toURL();
+                }
+            }
+            urlJars[0] = baseDir.toURL();
+        } catch (IOException e) {
+            throw new BootstrapException("Error during startup processing", e);
+        }
+
+        URLClassLoader loader = new URLClassLoader(urlJars);
+
+        Thread.currentThread().setContextClassLoader(loader);
+
+        try {
+            Class mainClass = loader.loadClass(launchClass);
+
+            Method mainMethod = mainClass.getMethod("main", MAIN_PARAMS_TYPE);
+
+            mainMethod.invoke(null, new Object[] {launchArgs});
+        } catch (ClassNotFoundException e) {
+            throw new BootstrapException("Class '" + launchClass + "' not found");
+        } catch (NoSuchMethodException e) {
+            throw new BootstrapException("Class '" + launchClass + "' has no main(String[]) method");
+        } catch (InvocationTargetException e) {
+            Throwable cause = e.getTargetException();
+            throw new BootstrapException("Error during startup processing", cause);
+        } catch (IllegalAccessException e) {
+            throw new BootstrapException("Error during startup processing", e);
+        }
+    }
+    
+    private static class JarFilter implements FilenameFilter {
+        public boolean accept(File dir, String name) {
+            return (name.endsWith(".jar"));
+        }
+    }
+        
+}

Added: incubator/apollo/globus/common/source/src/org/globus/bootstrap/BootstrapException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/src/org/globus/bootstrap/BootstrapException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/src/org/globus/bootstrap/BootstrapException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,149 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.bootstrap;
+
+/**
+ *
+ */
+public class BootstrapException extends Exception {
+
+    /**
+     * The possibly null root cause exception.
+     * @serial
+     */
+    private Throwable exception;
+
+    /**
+     * Constructs a new instance of <tt>BootstrapException</tt>.
+     * The root exception and the detailed message are null.
+     */
+    public BootstrapException() {
+        super();
+    }
+
+    /**
+     * Constructs a new instance of <tt>BootstrapException</tt> with a 
+     * detailed message. The root exception is null.
+     *
+     * @param detail A possibly null string containing details of the 
+     *        exception.
+     *
+     * @see java.lang.Throwable#getMessage
+     */
+    public BootstrapException(String detail) {
+        super(detail);
+    }
+
+    /**
+     * Constructs a new instance of <tt>BootstrapException</tt> with a
+     * detailed message and a root exception.
+     *
+     * @param detail A possibly null string containing details of the 
+     *        exception.
+     * @param ex A possibly null root exception that caused this exception.
+     *
+     * @see java.lang.Throwable#getMessage
+     * @see #getException
+     */
+    public BootstrapException(String detail, Throwable ex) {
+        super(detail);
+        exception = ex;
+    }
+
+    /**
+     * Returns the root exception that caused this exception.
+     * @return The possibly null root exception that caused this exception.
+     */
+    public Throwable getException() {
+        return exception;
+    }
+
+    /**
+     * Prints this exception's stack trace to <tt>System.err</tt>.
+     * If this exception has a root exception; the stack trace of the
+     * root exception is printed to <tt>System.err</tt> instead.
+     */
+    public void printStackTrace() {
+        printStackTrace( System.err );
+    }
+
+    /**
+     * Prints this exception's stack trace to a print stream.
+     * If this exception has a root exception; the stack trace of the
+     * root exception is printed to the print stream instead.
+     * @param ps The non-null print stream to which to print.
+     */
+    public void printStackTrace(java.io.PrintStream ps) {
+        if ( exception != null ) {
+            String superString = super.toString();
+            synchronized ( ps ) {
+            ps.print(superString
+                     + (superString.endsWith(".") ? "" : ".")
+                     + " Caused by ");
+            exception.printStackTrace( ps );
+            }
+        } else {
+            super.printStackTrace( ps );
+        }
+    }
+
+    /**
+     * Prints this exception's stack trace to a print writer.
+     * If this exception has a root exception; the stack trace of the
+     * root exception is printed to the print writer instead.
+     * @param pw The non-null print writer to which to print.
+     */
+    public void printStackTrace(java.io.PrintWriter pw) {
+        if ( exception != null ) {
+            String superString = super.toString();
+            synchronized (pw) {
+                pw.print(superString
+                         + (superString.endsWith(".") ? "" : ".")
+                         + " Caused by ");
+                exception.printStackTrace( pw );
+            }
+        } else {
+            super.printStackTrace( pw );
+        }
+    }
+
+    public String getMessage() {
+        String answer = super.getMessage();
+        if (exception != null && exception != this) {
+            answer += " [Caused by: " + exception.getMessage() + "]";
+        }
+        return answer;
+    }
+    
+    /**
+     * Returns the string representation of this exception.
+     * The string representation contains
+     * this exception's class name, its detailed messsage, and if
+     * it has a root exception, the string representation of the root
+     * exception. This string representation
+     * is meant for debugging and not meant to be interpreted
+     * programmatically.
+     * @return The non-null string representation of this exception.
+     * @see java.lang.Throwable#getMessage
+     */
+    public String toString() {
+        String answer = super.toString();
+        if (exception != null && exception != this) {
+            answer += " [Caused by: " + exception.toString() + "]";
+        }
+        return answer;
+    }
+}

Added: incubator/apollo/globus/common/source/src/org/globus/tools/DeployConstants.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/src/org/globus/tools/DeployConstants.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/src/org/globus/tools/DeployConstants.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,22 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.tools;
+
+public interface DeployConstants {
+    
+    public static final String CONFIG_BASE_DIR = "etc";
+    
+}

Added: incubator/apollo/globus/common/source/src/org/globus/tools/gar/GenerateUndeploy.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/common/source/src/org/globus/tools/gar/GenerateUndeploy.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/common/source/src/org/globus/tools/gar/GenerateUndeploy.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,195 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.tools.gar;
+
+import org.apache.axis.utils.XMLUtils;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.InputStream;
+import java.io.PrintWriter;
+
+import java.util.Enumeration;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+import org.globus.tools.DeployConstants;
+
+public class GenerateUndeploy {
+    public static void main(String[] args) throws Exception {
+        if (args.length != 2) {
+            throw new Exception("Usage: GenerateUndeploy <gar file> <undeploy dir>");
+        }
+
+        JarFile jar = new JarFile(args[0]);
+        String garID = new File(args[0]).getName();
+        int extensionPos = garID.lastIndexOf('.');
+
+        if (extensionPos != -1) {
+            garID = garID.substring(0, extensionPos);
+        }
+
+        String baseDir = args[1] + File.separator + "etc" + File.separator +
+            "globus_packages" + File.separator + garID + File.separator;
+        File dir = new File(baseDir);
+        dir.mkdirs();
+
+        FileWriter file = new FileWriter(baseDir + "undeploy.xml");
+        PrintWriter out = new PrintWriter(file);
+        out.println("<project default=\"undeploy\" basedir=\".\">");
+
+        /*
+        out.println("<path id=\"classpath\">");
+        out.println("  <fileset dir=\"${deploy.dir}/lib\">");
+        out.println("    <include name=\"*.jar\"/>");
+        out.println("  </fileset>");
+        out.println("  <pathelement path=\"${java.class.path}\"/>");
+        out.println("</path>");
+        */
+
+        out.println("\n");
+        out.println("<property environment=\"env\"/>");
+        out.println("<property file=\"build.properties\"/>");
+        out.println("<property file=\"${user.home}/build.properties\"/>");
+        out.println(
+            "<property name=\"env.GLOBUS_LOCATION\" value=\"../../..\"/>");
+        out.println(
+            "<property name=\"deploy.dir\" value=\"${env.GLOBUS_LOCATION}\"/>");
+        out.println("\n");
+        out.println("<target name=\"undeploy\">");
+
+        out.println("  <delete verbose=\"true\" dir=\"${deploy.dir}/" + 
+                    DeployConstants.CONFIG_BASE_DIR + "/" + garID + "\"/>");
+
+        /*
+        out.println(
+            "  <available file=\"" + "undeploy.wsdd\" " +
+            "property=\"undeploy.available\"/>"
+        );
+        out.println("  <antcall target=\"undeployDescriptor\"/>");
+        */
+
+        for (Enumeration e = jar.entries(); e.hasMoreElements();) {
+            ZipEntry entry = (ZipEntry) e.nextElement();
+
+            String name = entry.getName();
+
+            if (entry.isDirectory()) {
+                if (name.equals("docs/")) {
+                    out.println(
+                        "  <delete verbose=\"true\" dir=\"${deploy.dir}/docs/" + garID + "\"/>"
+                    );
+                } else if (name.equals("share/")) {
+                    out.println(
+                        "  <delete verbose=\"true\" dir=\"${deploy.dir}/share/" + garID + "\"/>"
+                    );
+                }
+                continue;
+            }
+
+            if (name.startsWith("lib/")) {
+                String nm = name.substring("lib/".length());
+                if (name.endsWith(".jar")) {
+                    out.println(
+                       "  <delete verbose=\"true\" file=\"${deploy.dir}/lib/" +
+                       nm + "\"/>");
+                } else if (nm.indexOf("LICENSE") != -1) {
+                    out.println(
+                       "  <delete verbose=\"true\" file=\"${deploy.dir}/share/licenses/" +
+                       nm + "\"/>");
+                }
+            } else if (name.startsWith("schema/")) {
+                out.println(
+                    "  <delete verbose=\"true\" file=\"${deploy.dir}/share/"
+                    + name + "\"/>"
+                );
+            } else if (name.startsWith("bin/")) {
+                out.println(
+                    "  <delete verbose=\"true\" file=\"${deploy.dir}/" + name +
+                    "\"/>"
+                );
+                //            } else if (name.equals("server-deploy.wsdd")) {
+                // writeUndeployment(jar, baseDir, entry);
+            }
+        }
+
+        out.println("</target>");
+
+        /*
+        out.println(
+            "<target name=\"undeployDescriptor\" " +
+            "if=\"undeploy.available\">"
+        );
+        out.println(
+            "  <echo message=\"undeploying " + garID +
+            " from server config\"/>"
+        );
+        out.println("  <java classname=\"org.apache.axis.utils.Admin\"");
+        out.println("        classpathref=\"classpath\"");
+        out.println("        fork=\"true\"");
+        out.println("        dir=\"${deploy.dir}/\"");
+        out.println("        failonerror=\"true\">");
+        out.println("    <arg value=\"server\"/>");
+        out.println(
+            "    <arg value=\"${deploy.dir}/etc/globus_packages/" + garID +
+            "/undeploy.wsdd\"/>"
+        );
+        out.println("  </java>");
+        out.println("</target>");
+        */
+
+        out.println("</project>");
+        out.flush();
+        out.close();
+    }
+
+    /*
+    private static void writeUndeployment(
+        JarFile jar,
+        String undeployLocation,
+        ZipEntry entry
+    ) throws Exception {
+        FileWriter file =
+            new FileWriter(undeployLocation + "undeploy.wsdd");
+        PrintWriter out = new PrintWriter(file);
+        InputStream input = jar.getInputStream(entry);
+        Document doc = XMLUtils.newDocument(input);
+        NodeList nodes =
+            doc.getElementsByTagNameNS(
+                "http://xml.apache.org/axis/wsdd/", "service"
+            );
+        out.println(
+            "<undeployment xmlns=\"http://xml.apache.org/axis/wsdd/\">"
+        );
+
+        for (int i = 0; i < nodes.getLength(); i++) {
+            Element element = (Element) nodes.item(i);
+            out.println(
+                "<service name=\"" + element.getAttribute("name") + "\"/>"
+            );
+        }
+
+        out.println("</undeployment>");
+        out.flush();
+        out.close();
+    }
+    */
+
+}

Added: incubator/apollo/globus/core/samples/authzService/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/authzService/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/authzService/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,160 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_core_samples" basedir=".">
+    <description>
+        WSRF Core Authz Service Sample
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+    
+    <property environment="env"/>
+ 
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" location="../../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="base.name" value="wsrf_core_samples_authzService"/>
+    <property name="package.name" value="globus_${base.name}"/>
+    <property name="gar.name" value="${package.name}.gar"/>
+    <property name="jar.name" value="${base.name}.jar"/>
+    <property name="stubs.jar.name" value="${base.name}_stubs.jar"/>
+    <property name="build.dir"  location="build"/>
+    <property name="build.dest" location="build/classes"/>
+    <property name="build.lib.dir" location="build/lib"/>
+    <property name="stubs.dir" location="build/stubs"/>
+    <property name="stubs.src" location="build/stubs/src"/>
+    <property name="stubs.dest" location="build/stubs/classes"/>
+    <property name="build.packages" location=
+        "${deploy.dir}/share/globus_wsrf_common/build-packages.xml"/>
+    <property name="build.stubs" location=
+        "${deploy.dir}/share/globus_wsrf_tools/build-stubs.xml"/>
+    <property name="java.debug" value="on"/>
+
+    <property name="schema.src" location="${deploy.dir}/share/schema"/>
+    <property name="schema.local"   location="schema"/>
+    <property name="schema.dest"  location="${build.dir}/schema"/>
+
+    <property name="garjars.id" value="garjars"/>
+    <fileset dir="${build.lib.dir}" id="garjars"/>
+
+    <property name="garschema.id" value="garschema"/>
+    <fileset dir="${schema.dest}" id="garschema">
+        <include name="core/samples/**/*"/>
+    </fileset>
+
+    <target name="init">
+        <mkdir dir="${build.dir}"/>
+        <mkdir dir="${build.dest}"/>
+        <mkdir dir="${build.lib.dir}"/>
+
+        <mkdir dir="${stubs.dir}"/>
+        <mkdir dir="${stubs.src}"/>
+        <mkdir dir="${stubs.dest}"/>
+
+        <mkdir dir="${schema.dest}"/>
+        <copy toDir="${schema.dest}">
+            <fileset dir="${schema.src}" casesensitive="yes">
+                <include name="wsrf/**/*"/>
+                <include name="ws/**/*"/>
+                <include name="core/security/**/*"/>
+                <include name="core/samples/authzService/*"/>
+            </fileset>
+        </copy>
+
+        <available property="stubs.present" type="dir" 
+                   file="${stubs.src}/org/globus/wsrf/samples/authzService" />
+
+        <condition property="compiler.jvmarg" value="-source 1.4">
+          <equals arg1="${ant.java.version}" arg2="1.5"/>
+        </condition>
+        <condition property="compiler.jvmarg" value="">
+         <not>
+           <isset property="${compiler.jvmarg}"/>
+         </not>
+        </condition>
+    </target>
+
+    <target name="stubs" unless="stubs.present" depends="init">
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/samples/authzService"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+            <property name="wsdl.file" 
+                value="authzService_service.wsdl"/>
+        </ant>
+    </target>
+  
+    <target name="compileStubs" depends="stubs">
+       <javac srcdir="${stubs.src}" destdir="${stubs.dest}" 
+            debug="${java.debug}">
+            <include name="**/*.java"/>
+            <classpath>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+        <copy todir="${build.dest}" >
+              <fileset dir="src" includes="**/*.properties" />
+              <fileset dir="src" includes="**/*.xml" />
+        </copy>
+    </target>
+
+    <target name="compile" depends="compileStubs">
+        <javac srcdir="src" destdir="${build.dest}"
+            debug="${java.debug}">
+            <include name="**/*.java"/>
+            <classpath>
+                <pathelement location="${stubs.dest}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+    </target>
+
+    <target name="jarStubs" depends="compileStubs">
+        <jar destfile="${build.lib.dir}/${stubs.jar.name}" 
+             basedir="${stubs.dest}"/>
+    </target>
+
+    <target name="jar" depends="compile">
+        <jar destfile="${build.lib.dir}/${jar.name}" basedir="${build.dest}"/>
+    </target>
+
+    <target name="dist" depends="jarStubs, jar">
+        <ant antfile="${build.packages}" target="makeGar">
+            <reference refid="${garjars.id}"/>  
+            <reference refid="${garschema.id}"/>  
+        </ant>            
+    </target>
+
+    <target name="clean">
+        <delete dir="tmp"/>
+        <delete dir="${build.dir}"/>
+        <delete file="${gar.name}"/>
+    </target>
+
+    <target name="deploy" depends="dist">
+        <ant antfile="${build.packages}" target="deployGar"/>
+    </target>  
+
+    <target name="undeploy">
+        <ant antfile="${build.packages}" target="undeployGar">
+            <property name="gar.id" value="${package.name}"/>
+        </ant>
+    </target>
+
+    <target name="all" depends="deploy"/>
+
+</project>

Added: incubator/apollo/globus/core/samples/authzService/deploy-jndi-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/authzService/deploy-jndi-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/authzService/deploy-jndi-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jndiConfig xmlns="http://wsrf.globus.org/jndi/config">
+    <service name="SampleAuthzService">
+        <resource 
+            name="home"
+            type="org.globus.wsrf.samples.authzService.SampleAuthzHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.samples.authzService.SampleAuthzResource</value>
+                </parameter>
+                <parameter>
+                    <name>signature</name>
+                    <value>false</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+</jndiConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/samples/authzService/deploy-server.wsdd
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/authzService/deploy-server.wsdd?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/authzService/deploy-server.wsdd	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment name="defaultServerConfig" 
+    xmlns="http://xml.apache.org/axis/wsdd/" 
+    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <service name="SampleAuthzService" provider="Handler" use="literal" 
+        style="document">
+        <parameter name="allowedMethodsClass" 
+            value="org.globus.wsrf.samples.authzService.AuthzServicePortType"/>
+        <parameter name="handlerClass" 
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className" 
+            value="org.globus.wsrf.samples.authzService.SampleAuthzService"/>
+        <wsdlFile>share/schema/core/samples/authzService/authzService_service.wsdl</wsdlFile>
+        <parameter name="scope" value="Application"/>
+        <parameter name="providers" value="
+             GetRPProvider GetMRPProvider SetRPProvider 
+        GetCurrentMessageProvider QueryRPProvider"/>
+    </service>
+
+</deployment>

Added: incubator/apollo/globus/core/samples/authzService/pkgdata/filelist
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/authzService/pkgdata/filelist?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/authzService/pkgdata/filelist	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,5 @@
+/lib/wsrf_core_samples_authzService.jar
+/lib/wsrf_core_samples_authzService_stubs.jar
+/etc/gpt/packages/globus_wsrf_core_samples_authzService/undeploy.xml
+/etc/globus_wsrf_core_samples_authzService/server-config.wsdd
+/etc/globus_wsrf_core_samples_authzService/jndi-config.xml

Added: incubator/apollo/globus/core/samples/authzService/pkgdata/pkg_data_src.gpt
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/authzService/pkgdata/pkg_data_src.gpt?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/authzService/pkgdata/pkg_data_src.gpt	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE gpt_package_metadata SYSTEM "package.dtd">
+
+<gpt_package_metadata Format_Version="0.01" Name="globus_java_ws_core_authz_sample">
+
+    <Aging_Version Age="0" Major="0" Minor="1"/>
+    <Description>
+        The Java WS Core authorization sample package
+    </Description>
+    <Functional_Group>Core</Functional_Group>
+    <Version_Stability Release="alpha" />
+
+    <src_pkg >
+
+        <Source_Dependencies Type="compile" >
+            <Dependency Name="globus_java_ws_core" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+        </Source_Dependencies>
+
+        <Build_Environment >
+            <cflags ></cflags>
+            <external_includes ></external_includes>
+            <pkg_libs ></pkg_libs>
+            <external_libs ></external_libs>
+        </Build_Environment>
+
+        <With_Flavors build="no" />
+
+        <Version_Label>0.1</Version_Label>
+
+        <Build_Instructions>
+            <Build_Step> ant deploy -Ddeploy.dir=INSTALLDIR_GPTMACRO </Build_Step>
+        </Build_Instructions>
+
+    </src_pkg >
+
+</gpt_package_metadata>

Added: incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/SampleAuthzHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/SampleAuthzHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/SampleAuthzHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/SampleAuthzResource.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/SampleAuthzResource.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/SampleAuthzResource.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/SampleAuthzService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/SampleAuthzService.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/authzService/src/org/globus/wsrf/samples/authzService/SampleAuthzService.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_core_samples" basedir=".">
+
+    <description>
+        Targets for core samples
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+    
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+
+    <target name="compile">
+        <ant dir="counter" target="compile"/>
+        <ant dir="management" target="compile"/>
+        <ant dir="authzService" target="compile"/>
+    </target>
+
+    <target name="deploy">
+        <ant dir="counter" target="deploy"/>
+        <ant dir="management" target="deploy"/>
+        <ant dir="authzService" target="deploy"/>
+    </target>
+
+   <target name="clean">
+        <ant dir="counter" target="clean"/>
+        <ant dir="management" target="clean"/>
+        <ant dir="authzService" target="clean"/>
+    </target>
+
+   <target name="test">
+        <ant dir="counter" target="test"/>
+        <ant dir="management" target="test"/>
+        <ant dir="authzService" target="test"/>
+    </target>
+  
+   <target name="all" depends="compile"/>
+
+</project>

Added: incubator/apollo/globus/core/samples/counter/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,163 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_core_samples" basedir=".">
+    <description>
+        WSRF Core Counter Sample
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+    
+    <property environment="env"/>
+ 
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="../../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="base.name" value="wsrf_core_samples_counter"/>
+    <property name="package.name" value="globus_${base.name}"/>
+    <property name="gar.name" value="${package.name}.gar"/>
+    <property name="jar.name" value="${base.name}.jar"/>
+    <property name="stubs.jar.name" value="${base.name}_stubs.jar"/>
+    <property name="build.dir"  location="build"/>
+    <property name="build.dest" location="build/classes"/>
+    <property name="build.lib.dir" location="build/lib"/>
+    <property name="stubs.dir" location="build/stubs"/>
+    <property name="stubs.src" location="build/stubs/src"/>
+    <property name="stubs.dest" location="build/stubs/classes"/>
+    <property name="build.packages" location=
+        "${deploy.dir}/share/globus_wsrf_common/build-packages.xml"/>
+    <property name="build.stubs" location=
+        "${deploy.dir}/share/globus_wsrf_tools/build-stubs.xml"/>
+    <property name="java.debug" value="on"/>
+
+    <property name="schema.src" location="${deploy.dir}/share/schema"/>
+    <property name="schema.local"   location="schema"/>
+    <property name="schema.dest"  location="${build.dir}/schema"/>
+
+    <property name="garjars.id" value="garjars"/>
+    <fileset dir="${build.lib.dir}" id="garjars"/>
+
+    <property name="garschema.id" value="garschema"/>
+    <fileset dir="${schema.dest}" id="garschema">
+        <include name="core/samples/**/*"/>
+    </fileset>
+
+    <property name="garetc.id" value="garetc"/>
+    <fileset dir="etc" id="garetc"/>
+
+    <target name="init">
+        <mkdir dir="${build.dir}"/>
+        <mkdir dir="${build.dest}"/>
+        <mkdir dir="${build.lib.dir}"/>
+
+        <mkdir dir="${stubs.dir}"/>
+        <mkdir dir="${stubs.src}"/>
+        <mkdir dir="${stubs.dest}"/>
+
+        <mkdir dir="${schema.dest}"/>
+        <copy toDir="${schema.dest}">
+            <fileset dir="${schema.src}" casesensitive="yes">
+                <include name="wsrf/**/*"/>
+                <include name="ws/**/*"/>
+                <include name="core/samples/counter/*"/>
+            </fileset>
+        </copy>
+
+        <available property="stubs.present" type="dir" 
+                   file="${stubs.src}/com/counter" />
+
+        <condition property="compiler.jvmarg" value="-source 1.4">
+          <equals arg1="${ant.java.version}" arg2="1.5"/>
+        </condition>
+        <condition property="compiler.jvmarg" value="">
+         <not>
+           <isset property="${compiler.jvmarg}"/>
+         </not>
+        </condition>
+    </target>
+
+    <target name="stubs" unless="stubs.present" depends="init">
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/samples/counter"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+            <property name="wsdl.file" 
+                value="counter_service.wsdl"/>
+        </ant>
+    </target>
+  
+    <target name="compileStubs" depends="stubs">
+       <javac srcdir="${stubs.src}" destdir="${stubs.dest}" 
+            debug="${java.debug}">
+            <include name="**/*.java"/>
+            <classpath>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+	<copy todir="${build.dest}" >
+	      <fileset dir="src" includes="**/*.properties" />
+	      <fileset dir="src" includes="**/*.xml" />
+	</copy>
+    </target>
+
+    <target name="compile" depends="compileStubs">
+        <javac srcdir="src" destdir="${build.dest}"
+            debug="${java.debug}">
+            <include name="**/*.java"/>
+            <classpath>
+                <pathelement location="${stubs.dest}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+    </target>
+
+    <target name="jarStubs" depends="compileStubs">
+        <jar destfile="${build.lib.dir}/${stubs.jar.name}" 
+             basedir="${stubs.dest}"/>
+    </target>
+
+    <target name="jar" depends="compile">
+        <jar destfile="${build.lib.dir}/${jar.name}" basedir="${build.dest}"/>
+    </target>
+
+    <target name="dist" depends="jarStubs, jar">
+        <ant antfile="${build.packages}" target="makeGar">
+            <reference refid="${garjars.id}"/>  
+            <reference refid="${garschema.id}"/>  
+            <reference refid="${garetc.id}"/>  
+        </ant>            
+    </target>
+
+    <target name="clean">
+        <delete dir="tmp"/>
+        <delete dir="${build.dir}"/>
+        <delete file="${gar.name}"/>
+    </target>
+
+    <target name="deploy" depends="dist">
+        <ant antfile="${build.packages}" target="deployGar"/>
+    </target>  
+
+    <target name="undeploy">
+        <ant antfile="${build.packages}" target="undeployGar">
+            <property name="gar.id" value="${package.name}"/>
+        </ant>
+    </target>
+
+    <target name="all" depends="deploy"/>
+
+</project>

Added: incubator/apollo/globus/core/samples/counter/deploy-jndi-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/deploy-jndi-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/deploy-jndi-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jndiConfig xmlns="http://wsrf.globus.org/jndi/config">
+    <service name="CounterService">
+        <resource
+            name="home"
+            type="org.globus.wsrf.samples.counter.CounterHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.samples.counter.PersistentCounter</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://counter.com}CounterKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.Integer</value>
+                </parameter>
+                <parameter>
+                    <name>cacheLocation</name>
+                    <value>java:comp/env/services/CounterService/cache</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+      <resource name="cache" 
+                type="org.globus.wsrf.utils.cache.LRUCache">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>  
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>timeout</name>
+                    <value>120000</value>
+                </parameter>
+            </resourceParams>
+       </resource>
+    </service>
+    <service name="SecureCounterService">
+        <resource
+            name="home"
+            type="org.globus.wsrf.samples.counter.CounterHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.samples.counter.secure.SecureCounter</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://counter.com}CounterKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.Integer</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+</jndiConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/samples/counter/deploy-server.wsdd
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/deploy-server.wsdd?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/deploy-server.wsdd	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment name="defaultServerConfig" 
+    xmlns="http://xml.apache.org/axis/wsdd/" 
+    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <service name="CounterService" provider="Handler" 
+        use="literal" style="document">
+        <parameter name="allowedMethodsClass" 
+            value="com.counter.CounterPortType"/>
+        <parameter name="handlerClass" 
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className" 
+            value="org.globus.wsrf.samples.counter.CounterService"/>
+        <wsdlFile>share/schema/core/samples/counter/counter_service.wsdl</wsdlFile>
+        <parameter name="scope" value="Application"/>
+        <parameter name="providers" value="
+            DestroyProvider SetTerminationTimeProvider GetRPProvider 
+            QueryRPProvider GetMRPProvider 
+            SubscribeProvider GetCurrentMessageProvider"/>
+    </service>
+
+    <service name="SecureCounterService" provider="Handler" 
+        use="literal" style="document">
+        <parameter name="allowedMethodsClass" 
+            value="com.counter.CounterPortType"/>
+        <parameter name="handlerClass" 
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className" 
+            value="org.globus.wsrf.samples.counter.CounterService"/>
+        <wsdlFile>share/schema/core/samples/counter/counter_service.wsdl</wsdlFile>
+        <parameter name="scope" value="Application"/>
+        <parameter name="providers" value="
+            DestroyProvider SetTerminationTimeProvider GetRPProvider 
+            QueryRPProvider GetMRPProvider 
+            SubscribeProvider GetCurrentMessageProvider"/>
+	<parameter name="securityDescriptor" value="@config.dir@/security-config.xml"/>
+    </service>
+
+</deployment>

Added: incubator/apollo/globus/core/samples/counter/etc/post-deploy.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/etc/post-deploy.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/etc/post-deploy.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+
+<!-- ===================================================================
+
+Notes:
+   This is a build file for use with the Jakarta Ant build tool.
+
+Prerequisites:
+
+   jakarta-ant from http://jakarta.apache.org
+
+
+Build Instructions:
+
+   This file is automatically called at the end of the deployment
+   of the corresponding component's gar (see build-packages.xml).
+
+Copyright:
+Copyright (c) 1999 University of Chicago and The University of
+Southern California. All Rights Reserved.
+
+==================================================================== -->
+<project default="all" basedir=".">
+
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="."/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="abs.deploy.dir" location="${deploy.dir}"/>
+    <property name="build.launcher" 
+        location="${abs.deploy.dir}/share/globus_wsrf_common/build-launcher.xml"/>
+
+    <target name="setup">
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="counter-client"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.samples.counter.client.CounterClient"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="secure-counter-client"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.samples.counter.client.CounterClient"/>
+	    <property name="default.cmd.line" value="-secure"/>
+        </ant>
+    </target>
+
+</project>

Added: incubator/apollo/globus/core/samples/counter/etc/security-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/etc/security-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/etc/security-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,21 @@
+<securityConfig xmlns="http://www.globus.org">
+    <method name="createCounter">
+        <auth-method>
+            <GSISecureConversation/>
+        </auth-method>
+    </method>
+    <method name="destroy">
+        <auth-method>
+            <GSISecureConversation/>
+        </auth-method>
+    </method>
+    <method name="add">
+        <auth-method>
+            <GSISecureMessage/>
+        </auth-method>
+    </method>
+    <auth-method>
+        <none/>
+    </auth-method>
+    <authz value="self"/> 
+</securityConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/samples/counter/pkgdata/filelist
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/pkgdata/filelist?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/pkgdata/filelist	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,8 @@
+/bin/counter-client
+/bin/secure-counter-client
+/lib/wsrf_core_samples_counter.jar
+/lib/wsrf_core_samples_counter_stubs.jar
+/etc/gpt/packages/globus_wsrf_core_samples_counter/undeploy.xml
+/etc/globus_wsrf_core_samples_counter/security-config.xml
+/etc/globus_wsrf_core_samples_counter/server-config.wsdd
+/etc/globus_wsrf_core_samples_counter/jndi-config.xml

Added: incubator/apollo/globus/core/samples/counter/pkgdata/pkg_data_src.gpt
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/pkgdata/pkg_data_src.gpt?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/pkgdata/pkg_data_src.gpt	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE gpt_package_metadata SYSTEM "package.dtd">
+
+<gpt_package_metadata Format_Version="0.01" Name="globus_java_ws_core_counter_sample">
+
+    <Aging_Version Age="0" Major="0" Minor="1"/>
+    <Description>
+        The Java WS Core counter sample package
+    </Description>
+    <Functional_Group>Core</Functional_Group>
+    <Version_Stability Release="alpha" />
+
+    <src_pkg >
+
+        <Source_Dependencies Type="compile" >
+            <Dependency Name="globus_java_ws_core" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+        </Source_Dependencies>
+
+        <Build_Environment >
+            <cflags ></cflags>
+            <external_includes ></external_includes>
+            <pkg_libs ></pkg_libs>
+            <external_libs ></external_libs>
+        </Build_Environment>
+
+        <With_Flavors build="no" />
+
+        <Version_Label>0.1</Version_Label>
+
+        <Build_Instructions>
+            <Build_Step> ant deploy -Ddeploy.dir=INSTALLDIR_GPTMACRO </Build_Step>
+        </Build_Instructions>
+
+    </src_pkg >
+
+</gpt_package_metadata>

Added: incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/Counter.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/Counter.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/Counter.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/CounterHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/CounterHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/CounterHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/CounterService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/CounterService.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/CounterService.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/PersistentCounter.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/PersistentCounter.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/PersistentCounter.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/Add.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/Add.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/Add.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/CounterClient.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/CounterClient.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/CounterClient.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/Create.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/Create.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/Create.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/client-security-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/client-security-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/client/client-security-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<securityConfig xmlns="http://www.globus.org">
+    <authz value="self"/>
+    <GSISecureConversation>
+        <integrity/>
+    </GSISecureConversation>
+</securityConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/secure/SecureCounter.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/secure/SecureCounter.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/counter/src/org/globus/wsrf/samples/counter/secure/SecureCounter.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/management/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/management/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/management/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,155 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_core_samples" basedir=".">
+    <description>
+        WSRF Core Management Service Sample
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+    
+    <property environment="env"/>
+ 
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="../../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="base.name" value="wsrf_core_samples_mgmt"/>
+    <property name="package.name" value="globus_${base.name}"/>
+    <property name="gar.name" value="${package.name}.gar"/>
+    <property name="jar.name" value="${base.name}.jar"/>
+    <property name="stubs.jar.name" value="${base.name}_stubs.jar"/>
+    <property name="build.dir"  location="build"/>
+    <property name="build.dest" location="build/classes"/>
+    <property name="build.lib.dir" location="build/lib"/>
+    <property name="stubs.dir" location="build/stubs"/>
+    <property name="stubs.src" location="build/stubs/src"/>
+    <property name="stubs.dest" location="build/stubs/classes"/>
+    <property name="build.packages" location=
+        "${deploy.dir}/share/globus_wsrf_common/build-packages.xml"/>
+    <property name="build.stubs" location=
+        "${deploy.dir}/share/globus_wsrf_tools/build-stubs.xml"/>
+    <property name="java.debug" value="on"/>
+
+    <property name="schema.src" location="${deploy.dir}/share/schema"/>
+    <property name="schema.local"   location="schema"/>
+    <property name="schema.dest"  location="${build.dir}/schema"/>
+
+    <property name="garjars.id" value="garjars"/>
+    <fileset dir="${build.lib.dir}" id="garjars"/>
+
+    <property name="garschema.id" value="garschema"/>
+    <fileset dir="${schema.dest}" id="garschema">
+        <include name="core/samples/**/*"/>
+    </fileset>
+
+    <target name="init">
+        <mkdir dir="${build.dir}"/>
+        <mkdir dir="${build.dest}"/>
+        <mkdir dir="${build.lib.dir}"/>
+
+        <mkdir dir="${stubs.dir}"/>
+        <mkdir dir="${stubs.src}"/>
+        <mkdir dir="${stubs.dest}"/>
+
+        <mkdir dir="${schema.dest}"/>
+        <copy toDir="${schema.dest}">
+            <fileset dir="${schema.src}" casesensitive="yes">
+                <include name="wsrf/**/*"/>
+                <include name="ws/**/*"/>
+                <include name="core/samples/management/*"/>
+            </fileset>
+        </copy>
+
+        <available property="stubs.present" type="dir" 
+                   file="${stubs.src}/com/management" />
+
+        <condition property="compiler.jvmarg" value="-source 1.4">
+          <equals arg1="${ant.java.version}" arg2="1.5"/>
+        </condition>
+        <condition property="compiler.jvmarg" value="">
+         <not>
+           <isset property="${compiler.jvmarg}"/>
+         </not>
+        </condition>
+    </target>
+
+    <target name="stubs" unless="stubs.present" depends="init">
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/samples/management"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+            <property name="wsdl.file" 
+                value="management_service.wsdl"/>
+        </ant>
+    </target>
+  
+    <target name="compileStubs" depends="stubs">
+       <javac srcdir="${stubs.src}" destdir="${stubs.dest}" 
+            debug="${java.debug}">
+            <include name="**/*.java"/>
+            <classpath>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+    </target>
+
+    <target name="compile" depends="compileStubs">
+        <javac srcdir="src" destdir="${build.dest}"
+            debug="${java.debug}">
+            <include name="**/*.java"/>
+            <classpath>
+                <pathelement location="${stubs.dest}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+    </target>
+
+    <target name="jarStubs" depends="compileStubs">
+        <jar destfile="${build.lib.dir}/${stubs.jar.name}" 
+             basedir="${stubs.dest}"/>
+    </target>
+
+    <target name="jar" depends="compile">
+        <jar destfile="${build.lib.dir}/${jar.name}" basedir="${build.dest}"/>
+    </target>
+
+    <target name="dist" depends="jarStubs, jar">
+        <ant antfile="${build.packages}" target="makeGar">
+            <reference refid="${garjars.id}"/>  
+            <reference refid="${garschema.id}"/>  
+        </ant>            
+    </target>
+
+    <target name="clean">
+        <delete dir="tmp"/>
+        <delete dir="${build.dir}"/>
+        <delete file="${gar.name}"/>
+    </target>
+
+    <target name="deploy" depends="dist">
+        <ant antfile="${build.packages}" target="deployGar"/>
+    </target>  
+
+    <target name="undeploy">
+        <ant antfile="${build.packages}" target="undeployGar">
+            <property name="gar.id" value="${package.name}"/>
+        </ant>
+    </target>
+
+    <target name="all" depends="deploy"/>
+
+</project>

Added: incubator/apollo/globus/core/samples/management/deploy-jndi-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/management/deploy-jndi-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/management/deploy-jndi-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jndiConfig xmlns="http://wsrf.globus.org/jndi/config">
+    <service name="ManagementService">
+        <resource
+            name="home"
+            type="org.globus.wsrf.samples.management.AxisRegistryHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+</jndiConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/samples/management/deploy-server.wsdd
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/management/deploy-server.wsdd?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/management/deploy-server.wsdd	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment name="defaultServerConfig" 
+    xmlns="http://xml.apache.org/axis/wsdd/" 
+    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <service name="ManagementService" provider="Handler" 
+        use="literal" style="document">
+        <parameter name="allowedMethodsClass" 
+            value="com.management.ManagementPort"/>
+        <parameter name="handlerClass" 
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className" 
+            value="org.globus.wsrf.samples.management.ManagementService"/>
+        <wsdlFile>share/schema/core/samples/management/management_service.wsdl</wsdlFile>
+        <parameter name="scope" value="Application"/>
+        <parameter name="providers" value="
+            GetRPProvider QueryRPProvider SetRPProvider
+        "/>
+    </service>
+
+</deployment>

Added: incubator/apollo/globus/core/samples/management/pkgdata/filelist
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/management/pkgdata/filelist?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/management/pkgdata/filelist	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,5 @@
+/lib/wsrf_core_samples_mgmt_stubs.jar
+/lib/wsrf_core_samples_mgmt.jar
+/etc/gpt/packages/globus_wsrf_core_samples_mgmt/undeploy.xml
+/etc/globus_wsrf_core_samples_mgmt/server-config.wsdd
+/etc/globus_wsrf_core_samples_mgmt/jndi-config.xml

Added: incubator/apollo/globus/core/samples/management/pkgdata/pkg_data_src.gpt
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/management/pkgdata/pkg_data_src.gpt?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/management/pkgdata/pkg_data_src.gpt	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE gpt_package_metadata SYSTEM "package.dtd">
+
+<gpt_package_metadata Format_Version="0.01" Name="globus_java_ws_core_management_sample">
+
+    <Aging_Version Age="0" Major="0" Minor="1"/>
+    <Description>
+        The Java WS Core management service sample package
+    </Description>
+    <Functional_Group>Core</Functional_Group>
+    <Version_Stability Release="alpha" />
+
+    <src_pkg >
+
+        <Source_Dependencies Type="compile" >
+            <Dependency Name="globus_java_ws_core" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+        </Source_Dependencies>
+
+        <Build_Environment >
+            <cflags ></cflags>
+            <external_includes ></external_includes>
+            <pkg_libs ></pkg_libs>
+            <external_libs ></external_libs>
+        </Build_Environment>
+
+        <With_Flavors build="no" />
+
+        <Version_Label>0.1</Version_Label>
+
+        <Build_Instructions>
+            <Build_Step>ant deploy -Ddeploy.dir=INSTALLDIR_GPTMACRO</Build_Step>
+        </Build_Instructions>
+
+    </src_pkg >
+
+</gpt_package_metadata>

Added: incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisPropertySet.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisPropertySet.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisPropertySet.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisRegistryHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisRegistryHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisRegistryHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisService.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisService.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisServiceProperty.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisServiceProperty.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/AxisServiceProperty.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/ManagementService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/ManagementService.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/samples/management/src/org/globus/wsrf/samples/management/ManagementService.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,294 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_core" basedir=".">
+    <description>
+        Java WS Core Implementation
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+    
+    <property environment="env"/>
+ 
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="name" value="Globus Toolkit Java WS Core"/>
+    <property name="version" value="3.9.4"/>
+    <property name="globus.copyright" value="Copyright &#169; 1999-2003 University of Chicago and The University of Southern California.  All rights reserved."/>
+    <property name="env.GLOBUS_LOCATION" value="../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="base.name" value="wsrf_core"/>
+    <property name="package.name" value="globus_${base.name}"/>
+    <property name="gar.name" value="${package.name}.gar"/>
+    <property name="jar.name" value="${base.name}.jar"/>
+    <property name="stubs.jar.name" value="${base.name}_stubs.jar"/>
+    <property name="src.dir" value="src"/>
+    <property name="build.dir"  location="build"/>
+    <property name="build.dest" location="build/classes"/>
+    <property name="build.lib.dir" location="build/lib"/>
+    <property name="build.javadocs" value="${build.dir}/javadocs"/>
+    <property name="stubs.dir" location="build/stubs"/>
+    <property name="stubs.src" location="build/stubs/src"/>
+    <property name="stubs.dest" location="build/stubs/classes"/>
+    <property name="build.packages" location=
+        "${deploy.dir}/share/globus_wsrf_common/build-packages.xml"/>
+    <property name="build.stubs" location=
+        "${deploy.dir}/share/globus_wsrf_tools/build-stubs.xml"/>
+    <property name="java.debug" value="on"/>
+    <property name="java.deprecation" value="true"/>
+
+    <property name="src.dir"   location="src"/>
+
+    <property name="schema.src"   location="${deploy.dir}/share/schema"/>
+    <property name="schema.dest"  location="${build.dir}/schema"/>
+
+    <property name="garjars.id" value="garjars"/>
+    <fileset dir="${build.lib.dir}" id="garjars"/>
+
+    <property name="garschema.id" value="garschema"/>
+    <fileset dir="${schema.dest}" id="garschema"/>
+
+    <property name="garetc.id" value="garetc"/>
+    <fileset dir="etc" id="garetc"/>
+
+    <property name="garshare.id" value="garshare"/>
+    <fileset dir="share" id="garshare"/>
+
+    <property name="gardocs.id" value="gardocs"/>
+    <fileset dir="docs" id="gardocs"/>
+
+    <target name="init">
+        <mkdir dir="${build.dir}"/>
+        <mkdir dir="${build.dest}"/>
+        <mkdir dir="${build.lib.dir}"/>
+
+        <mkdir dir="${stubs.dir}"/>
+        <mkdir dir="${stubs.src}"/>
+        <mkdir dir="${stubs.dest}"/>
+
+        <mkdir dir="${schema.dest}"/>
+        <copy toDir="${schema.dest}">
+            <fileset dir="${schema.src}" casesensitive="yes">
+                <include name="core/notification/**"/>
+                <include name="core/security/**"/>
+                <include name="core/types/**"/>
+                <include name="core/management/**"/>
+                <include name="wsrf/**"/>
+                <include name="ws/**"/>
+            </fileset>
+        </copy>
+
+        <!-- this should match the last thing generated in "stubs" target -->
+        <available property="stubs.present" type="dir" 
+                   file="${stubs.src}/org/globus/wsrf/core/notification" />
+
+        <condition property="compiler.jvmarg" value="-source 1.4">
+          <equals arg1="${ant.java.version}" arg2="1.5"/>
+        </condition>
+        <condition property="compiler.jvmarg" value="">
+         <not>
+           <isset property="${compiler.jvmarg}"/>
+         </not>
+        </condition>
+    </target>
+
+    <target name="stubs" unless="stubs.present" depends="init">
+        <property name="mapping.file" 
+                  value="${basedir}/share/NStoPkg.properties"/>
+
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="ns.excludes" value=""/>
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/wsrf/properties"/>
+            <property name="wsdl.file" 
+                value="WS-ResourceProperties_service.wsdl"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+        </ant>
+
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="ns.excludes" value=""/>
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/wsrf/lifetime"/>
+            <property name="wsdl.file" 
+                value="WS-ResourceLifetime_service.wsdl"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+        </ant>
+
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="ns.excludes" value=""/>
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/wsrf/notification"/>
+            <property name="wsdl.file" 
+                value="WS-BaseN_service.wsdl"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+        </ant>
+
+       <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="ns.excludes" value=""/>
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/wsrf/servicegroup"/>
+            <property name="wsdl.file" 
+                value="WS-ServiceGroup_service.wsdl"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+        </ant>
+
+        <!-- Security, WS Secure Conversation -->
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="ns.excludes" value=""/>
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/security/secconv"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+            <property name="wsdl.file" 
+                value="secure_conversation_service.wsdl"/>
+        </ant>
+
+        <!-- Authorization -->
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/security/authorization"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+            <property name="wsdl.file" value="authz_service.wsdl"/>
+        </ant>
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/types"/>
+            <property name="wsdl.file" 
+                value="timestamp.wsdl"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+        </ant>
+
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="ns.excludes" value=""/>
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/notification"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+            <property name="wsdl.file" 
+                value="subscription_manager_service.wsdl"/>
+        </ant>        
+
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/notification"/>
+            <property name="wsdl.file" 
+                value="notification_consumer_service.wsdl"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+        </ant>
+
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/management"/>
+            <property name="wsdl.file" 
+                value="shutdown_service.wsdl"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+        </ant>
+
+        <copy toDir="${stubs.src}" overwrite="yes">
+            <fileset dir="${src.dir}" casesensitive="yes">
+                <include name="org/oasis/**/*"/>
+            </fileset>
+        </copy>
+    </target>
+  
+    <target name="compileStubs" depends="stubs">
+       <javac srcdir="${stubs.src}" destdir="${stubs.dest}" 
+            debug="${java.debug}" deprecation="${java.deprecation}">
+            <include name="**/*.java"/>
+            <classpath>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+    </target>
+
+    <target name="compile" depends="compileStubs">
+        <javac srcdir="${src.dir}" destdir="${build.dest}"
+            debug="${java.debug}" deprecation="${java.deprecation}">
+            <include name="**/*.java"/>
+            <exclude name="org/oasis/**"/>
+            <classpath>
+                <pathelement location="${stubs.dest}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+	<copy todir="${build.dest}" >
+	      <fileset dir="${src.dir}" includes="**/*.properties" />
+	      <fileset dir="${src.dir}" includes="**/*.xml" />
+	</copy>
+    </target>
+
+    <target name="jarStubs" depends="compileStubs">
+        <jar destfile="${build.lib.dir}/${stubs.jar.name}" 
+             basedir="${stubs.dest}"/>
+    </target>
+
+    <target name="jar" depends="compile">
+        <jar destfile="${build.lib.dir}/${jar.name}" basedir="${build.dest}"/>
+    </target>
+
+    <target name="dist" depends="jarStubs, jar">
+        <ant antfile="${build.packages}" target="makeGar">
+            <reference refid="${garjars.id}"/>  
+            <reference refid="${garschema.id}"/>  
+            <reference refid="${garetc.id}"/>  
+            <reference refid="${gardocs.id}"/>  
+            <reference refid="${garshare.id}"/>  
+        </ant>            
+    </target>
+
+    <target name="clean">
+        <delete dir="tmp"/>
+        <delete dir="${build.dir}"/>
+        <delete file="${gar.name}"/>
+    </target>
+
+    <target name="deploy" depends="dist">
+        <ant antfile="${build.packages}" target="deployGar">
+            <property name="noSchema" value="true"/>
+        </ant>
+    </target>  
+
+    <target name="undeploy">
+        <ant antfile="${build.packages}" target="undeployGar">
+            <property name="gar.id" value="${package.name}"/>
+        </ant>
+    </target>
+
+    <target name="all" depends="deploy"/>
+
+   <target name="javadocs" depends="compile">
+    <mkdir dir="${build.javadocs}"/>
+    <javadoc destdir="${build.javadocs}"
+             author="true"
+             version="true"
+             use="true"
+             windowtitle="${name} ${version} API"
+             doctitle="${name} ${version}"
+             bottom="${globus.copyright}">
+      <classpath>
+        <fileset dir="${deploy.dir}/lib">
+          <include name="*.jar"/>
+        </fileset>
+      </classpath>
+      <link href="http://java.sun.com/j2se/1.3/docs/api/" />
+      <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
+      <link href="http://ws.apache.org/axis/java/apiDocs/"/>
+      <link href="http://ws.apache.org/ws-fx/addressing/apidocs/"/>
+     <link href="http://www-unix.mcs.anl.gov/~gawor/jglobus-nightly/doc/"/>
+      <packageset dir="${src.dir}" defaultexcludes="yes"/>
+      <packageset dir="${stubs.src}" defaultexcludes="yes"/>
+    </javadoc>
+  </target>
+
+</project>

Added: incubator/apollo/globus/core/source/deploy-client.wsdd
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/deploy-client.wsdd?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/deploy-client.wsdd	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment name="defaultClientConfig"
+    xmlns="http://xml.apache.org/axis/wsdd/" 
+    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" 
+    xmlns:wsrp=
+    "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd" 
+    xmlns:wsnt=
+    "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd"
+    xmlns:wsbf=
+    "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd"
+    xmlns:wsa=
+    "http://schemas.xmlsoap.org/ws/2004/03/addressing"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <globalConfiguration>
+        <parameter name="sendXsiTypes" value="true"/>
+        <parameter name="sendMultiRefs" value="true"/>
+        <parameter name="sendXMLDeclaration" value="true"/>
+        
+        <requestFlow>
+            <handler type="java:org.globus.wsrf.handlers.AddressingHandler"/>
+            <handler type="java:org.globus.wsrf.impl.security.authentication.ClientPropertiesHandler"/>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+                <parameter name="className" value="org.globus.wsrf.impl.security.authentication.securemsg.X509EncryptHandler"/>
+            </handler>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+                <parameter name="className" value="org.globus.wsrf.impl.security.authentication.securemsg.X509SignHandler"/>
+            </handler>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+		<parameter name="className" value="org.globus.wsrf.impl.security.authentication.UsernameHandler"/>
+ 	    </handler>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+                <parameter name="className" value="org.globus.wsrf.impl.security.authentication.secureconv.SecContextHandler"/>
+                <parameter name="authService" value="auto"/>
+            </handler>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+                <parameter name="className" value="org.globus.wsrf.impl.security.authentication.secureconv.GSSHandler"/>
+            </handler>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+                <parameter name="className" value="org.globus.wsrf.impl.security.authorization.TrustedTargetHandler"/>
+            </handler>
+            <handler type="java:org.globus.wsrf.handlers.MessageLoggingHandler"/>
+        </requestFlow>
+
+        <responseFlow>
+            <handler type="java:org.globus.wsrf.handlers.AddressingHandler"/>
+            <handler type="java:org.globus.wsrf.handlers.MessageLoggingHandler"/>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+                <parameter name="className" value="org.globus.wsrf.impl.security.authentication.wssec.WSSecurityClientHandler"/>
+            </handler>
+        </responseFlow>
+
+    </globalConfiguration>
+
+    <transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender">
+        <requestFlow>
+            <handler type="java:org.globus.axis.handlers.HTTP11Handler"/>
+        </requestFlow>
+    </transport>
+
+    <transport name="https" pivot="java:org.globus.axis.transport.HTTPSSender">
+        <requestFlow>
+            <handler type="java:org.globus.axis.handlers.HTTP11Handler"/>
+        </requestFlow>
+    </transport>
+
+    <transport name="local" 
+        pivot="java:org.apache.axis.transport.local.LocalSender"/>
+    <transport name="java" 
+        pivot="java:org.apache.axis.transport.java.JavaSender"/>
+
+    <typeMapping 
+        name="TopicExpressionType" 
+        qname="wsnt:TopicExpressionType" 
+        type="java:org.oasis.wsn.TopicExpressionType"
+        deserializer="org.globus.wsrf.encoding.TopicExpressionDeserializerFactory"
+        serializer="org.globus.wsrf.encoding.TopicExpressionSerializerFactory"
+        encodingStyle="" />
+
+    <typeMapping 
+        name=">SetResourceProperties" 
+        qname="wsrp:>SetResourceProperties" 
+        type="java:org.oasis.wsrf.properties.SetResourceProperties_Element"
+        deserializer="org.globus.wsrf.encoding.AnyListDeserializerFactory"
+        serializer="org.globus.wsrf.encoding.AnyListSerializerFactory"
+        encodingStyle="" />
+
+    <typeMapping 
+        name="QueryExpressionType" 
+        qname="wsrp:QueryExpressionType" 
+        type="java:org.oasis.wsrf.properties.QueryExpressionType"
+        deserializer="org.globus.wsrf.encoding.QueryExpressionDeserializerFactory"
+        serializer="org.globus.wsrf.encoding.QueryExpressionSerializerFactory"
+        encodingStyle="" />
+
+    <!-- WS-Addressing Bits -->
+
+    <typeMapping 
+        encodingStyle="" 
+        qname="wsa:EndpointReferenceType" 
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" 
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        type="java:org.apache.axis.message.addressing.EndpointReferenceType" />
+
+    <typeMapping
+        encodingStyle=""
+        qname="wsa:ReferencePropertiesType"
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        type="java:org.apache.axis.message.addressing.ReferencePropertiesType" />
+
+    <typeMapping 
+        encodingStyle="" 
+        qname="wsa:AttributedURI" 
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        type="java:org.apache.axis.message.addressing.AttributedURI" />
+
+    <typeMapping 
+        encodingStyle=""
+        qname="wsa:AttributedQName" 
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        type="java:org.apache.axis.message.addressing.AttributedQName" />
+
+    <typeMapping
+        encodingStyle=""
+        qname="wsa:ServiceNameType"
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        type="java:org.apache.axis.message.addressing.ServiceNameType" />
+    
+    <!-- WS-BaseFaults Bits -->
+    
+    <typeMapping 
+        encodingStyle=""
+        qname="wsbf:BaseFaultType"
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        type="java:org.oasis.wsrf.faults.BaseFaultType" />
+
+    <!-- WS Trust and WS Secure Conversation -->
+    <typeMapping 
+        encodingStyle="" 
+        qname="ns1:SecurityContextTokenType" 
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" 
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        type="java:org.globus.ws.sc.SecurityContextTokenType"
+        xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/04/sc" />
+
+    <typeMapping 
+        encodingStyle="" 
+        qname="ns1:BinaryExchangeType" 
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory" 
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        type="java:org.globus.ws.trust.BinaryExchangeType"
+        xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/04/trust" />
+</deployment>
+

Added: incubator/apollo/globus/core/source/deploy-jndi-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/deploy-jndi-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/deploy-jndi-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jndiConfig xmlns="http://wsrf.globus.org/jndi/config">
+    <global>
+        <resource
+            name="notificationConsumerHome"
+            type="org.globus.wsrf.impl.notification.NotificationConsumerHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.NotificationConsumerCallbackManagerImpl</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://www.globus.org/namespaces/2004/06/core}NotificationConsumerKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+        <resource
+            name="subscriptionHome"
+            type="org.globus.wsrf.impl.notification.SubscriptionHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.notification.PersistentSubscription</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://www.globus.org/namespaces/2004/06/core}SubscriptionKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+                <parameter>
+                    <name>cacheLocation</name>
+                    <value>java:comp/env/services/SubscriptionManagerService/cache</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+        <resource
+            name="wm/ContainerWorkManager"
+            type="org.globus.wsrf.impl.work.WorkManagerImpl">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+        <resource
+            name="timer/ContainerTimer"
+            type="org.globus.wsrf.impl.timer.TimerManagerImpl">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+       <resource name="query/eval/xpath"
+                  type="org.globus.wsrf.impl.XPathExpressionEvaluator">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+        <resource name="query/ContainerQueryEngine"
+                  type="org.globus.wsrf.impl.QueryEngineImpl">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+       <resource name="topic/eval/simple"
+                  type="org.globus.wsrf.impl.SimpleTopicExpressionEvaluator">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+        <resource name="topic/ContainerTopicExpressionEngine"
+                  type="org.globus.wsrf.impl.TopicExpressionEngineImpl">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+
+    </global>
+    <service name="NotificationConsumerService">
+        <resourceLink
+            name="home"
+            target="java:comp/env/notificationConsumerHome"/>
+    </service>
+    <service name="SubscriptionManagerService">
+        <resourceLink
+            name="home"
+            target="java:comp/env/subscriptionHome"/>
+        <resource name="cache"
+            type="org.globus.wsrf.utils.cache.LRUCache">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>timeout</name>
+                    <value>120000</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+    <service name="gsi/AuthenticationService">
+        <resource
+            name="home"
+            type="org.globus.wsrf.impl.security.authentication.secureconv.service.SecurityContextHome">
+            <resourceParams>
+                <parameter>
+                    <name>
+                        factory
+                    </name>
+                    <value>
+		    org.globus.wsrf.jndi.BeanFactory
+                    </value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.security.authentication.secureconv.service.SecurityContext</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://www.globus.org/namespaces/2004/06/core}SecureContextKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+</jndiConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/source/deploy-server.wsdd
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/deploy-server.wsdd?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/deploy-server.wsdd	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,320 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment name="defaultServerConfig" 
+    xmlns="http://xml.apache.org/axis/wsdd/" 
+    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" 
+    xmlns:wsrp=
+      "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd" 
+    xmlns:wsnt=
+      "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd"
+    xmlns:wsa=
+      "http://schemas.xmlsoap.org/ws/2004/03/addressing"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <globalConfiguration>
+        <parameter name="sendXsiTypes" value="true"/>
+        <!-- @CONTAINER_SECURITY_DESCRIPTOR@ -->
+
+        <!-- OPERATION PROVIDERS -->
+
+        <parameter 
+            name="DestroyProvider" 
+            value="org.globus.wsrf.impl.lifetime.DestroyProvider"/>
+        <parameter 
+            name="SetTerminationTimeProvider"
+            value="org.globus.wsrf.impl.lifetime.SetTerminationTimeProvider"/>
+        <parameter 
+            name="GetRPProvider"
+            value="org.globus.wsrf.impl.properties.GetResourcePropertyProvider"/>
+        <parameter 
+            name="GetMRPProvider"
+            value="org.globus.wsrf.impl.properties.GetMultipleResourcePropertiesProvider"/>
+        <parameter 
+            name="SetRPProvider"
+            value="org.globus.wsrf.impl.properties.SetResourcePropertiesProvider"/>
+        <parameter 
+            name="QueryRPProvider"
+            value="org.globus.wsrf.impl.properties.QueryResourcePropertiesProvider"/>
+        <parameter 
+            name="SubscribeProvider"
+            value="org.globus.wsrf.impl.notification.SubscribeProvider"/>
+
+        <parameter
+            name="GetCurrentMessageProvider"
+            value="org.globus.wsrf.impl.notification.GetCurrentMessageProvider"/>
+
+        <parameter
+            name="PauseSubscriptionProvider"
+            value="org.globus.wsrf.impl.notification.PauseSubscriptionProvider"/>
+
+        <parameter
+            name="ResumeSubscriptionProvider"
+            value="org.globus.wsrf.impl.notification.ResumeSubscriptionProvider"/>
+
+        <parameter
+            name="NotificationConsumerProvider"
+            value="org.globus.wsrf.impl.notification.NotificationConsumerProvider"/>
+        <!-- WS Secure Conversation service -->
+        <parameter name="authenticationService" 
+            value="gsi/AuthenticationService"/>
+
+        <requestFlow>
+            <!-- The AddressingHandler must be first -->
+            <handler type="java:org.globus.wsrf.handlers.AddressingHandler"/>
+            <!-- The URLMapper must be second -->
+            <handler type="java:org.globus.wsrf.handlers.URLMapper"/>
+            <!-- @TOMCAT_SEC_HANDLER@ -->
+            <!-- The AuthenticationServiceHandler must be third -->
+            <handler type="AuthenticationServiceHandler"/>
+
+            <handler type="java:org.globus.wsrf.handlers.MessageLoggingHandler"/>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+		    <parameter name="className" value="org.globus.wsrf.impl.security.authentication.wssec.WSSecurityHandler"/>
+ 	    </handler>
+	    <handler type="java:org.globus.wsrf.impl.security.authentication.SecurityPolicyHandler"/>
+	    <handler type="java:org.globus.wsrf.impl.security.authorization.AuthorizationHandler"/>
+            <!-- The FaultHandler must be last -->
+            <handler type="java:org.globus.wsrf.handlers.FaultHandler"/>
+        </requestFlow>
+
+        <responseFlow>
+            <!-- The WSDLHandler must be first -->
+            <handler type="java:org.globus.wsrf.handlers.WSDLHandler"/>
+            <handler type="java:org.globus.wsrf.handlers.AddressingHandler"/>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+		<parameter name="className" value="org.globus.wsrf.impl.security.authentication.securemsg.X509EncryptHandler"/>
+ 	    </handler>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+		<parameter name="className" value="org.globus.wsrf.impl.security.authentication.securemsg.X509SignHandler"/>
+ 	    </handler>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+		<parameter name="className" value="org.globus.wsrf.impl.security.authentication.UsernameHandler"/>
+ 	    </handler>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+               <parameter name="className" value="org.globus.wsrf.impl.security.authentication.secureconv.GSSHandler"/>
+            </handler>
+            <handler 
+                type="java:org.globus.wsrf.handlers.MessageLoggingHandler"/>
+        </responseFlow>
+
+    </globalConfiguration>
+
+    <handler name="RPCDispatcher" 
+        type="java:org.apache.axis.providers.java.RPCProvider"/>
+    <handler name="URLMapper" 
+        type="java:org.apache.axis.handlers.http.URLMapper"/>
+    <handler name="MsgDispatcher" 
+        type="java:org.apache.axis.providers.java.MsgProvider"/>
+    <handler name="LocalRequester"
+        type="java:org.globus.axis.transport.local.LocalRequester"/>
+    <handler name="LocalResponder" 
+        type="java:org.apache.axis.transport.local.LocalResponder"/>
+    <handler name="logger" 
+        type="java:org.apache.axis.handlers.LogHandler"/>
+    <handler name="Authenticate" 
+        type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>
+    <handler name="AuthenticationServiceHandler" 
+        type="java:org.globus.wsrf.impl.security.authentication.secureconv.service.AuthenticationServiceHandler"/>
+
+    <service name="AdminService" provider="java:MSG">
+        <namespace>http://xml.apache.org/axis/wsdd/</namespace>
+        <parameter name="allowedMethods" value="AdminService"/>
+        <parameter name="enableRemoteAdmin" value="false"/>
+        <parameter name="className" value="org.apache.axis.utils.Admin"/>
+    </service>
+ 
+    <service name="Version" provider="java:RPC">
+        <parameter name="allowedMethods" value="getVersion"/>
+        <parameter name="className" value="org.apache.axis.Version"/>
+    </service>
+
+    <service name="NotificationConsumerService" provider="Handler" 
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter 
+            name="handlerClass" 
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className" 
+            value="org.globus.wsrf.impl.notification.NotificationConsumerProvider"/>
+        <wsdlFile>share/schema/core/notification/notification_consumer_service.wsdl</wsdlFile>
+        <typeMapping
+            deserializer=
+            "org.apache.axis.encoding.ser.ElementDeserializerFactory"
+            encodingStyle="" 
+            qname="xsd:anyType"
+            type="java:java.lang.Object"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
+        <typeMapping 
+            name="ResourcePropertyValueChangeNotificationElementType" 
+            qname="ns1:ResourcePropertyValueChangeNotificationElementType" 
+            xmlns:ns1="http://wsrf.globus.org/core/notification" 
+            type="java:org.globus.wsrf.core.notification.ResourcePropertyValueChangeNotificationElementType"
+            serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+            deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+            encodingStyle="" />
+    </service>
+
+
+    <service name="SubscriptionManagerService" provider="Handler" 
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="scope" value="Application"/>
+        <parameter 
+            name="providers"
+            value="DestroyProvider SetTerminationTimeProvider
+            GetRPProvider PauseSubscriptionProvider"/>
+        <parameter 
+            name="handlerClass" 
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className" 
+            value="org.globus.wsrf.impl.notification.ResumeSubscriptionProvider"/>
+        <wsdlFile>share/schema/core/notification/subscription_manager_service.wsdl</wsdlFile>
+    </service>
+
+    <service name="gsi/AuthenticationService" provider="Handler" 
+        use="literal" style="document">
+        <parameter 
+            name="handlerClass" 
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="className" 
+            value="org.globus.wsrf.impl.security.authentication.secureconv.service.AuthenticationServiceImpl"/>
+        <wsdlFile>share/schema/core/security/secconv/secure_conversation_service.wsdl</wsdlFile>
+    </service>
+
+    <service name="ShutdownService" provider="java:RPC" 
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="className" 
+            value="org.globus.wsrf.container.ShutdownService"/>
+        <wsdlFile>share/schema/core/management/shutdown_service.wsdl</wsdlFile>
+        <parameter name="securityDescriptor" value="org/globus/wsrf/impl/security/descriptor/gsi-security-config.xml"/>
+    </service>
+
+    <transport name="http">
+        <parameter name="qs:list"
+            value="org.apache.axis.transport.http.QSListHandler"/>
+        <parameter name="qs:method" 
+            value="org.apache.axis.transport.http.QSMethodHandler"/>
+        <parameter name="qs:wsdl" 
+            value="org.apache.axis.transport.http.QSWSDLHandler"/>
+        <requestFlow>
+            <handler
+            type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
+        </requestFlow>
+    </transport>
+
+    <transport name="local">
+        <requestFlow>
+            <handler type="LocalRequester"/>
+        </requestFlow>
+        <responseFlow>
+            <handler type="LocalResponder"/>
+        </responseFlow>
+    </transport>
+
+    <transport name="SimpleHTTP">
+        <requestFlow/>
+    </transport>
+
+    <typeMapping 
+        name="DeleteType" 
+        qname="wsrp:DeleteType" 
+        type="java:org.oasis.wsrf.properties.DeleteType"
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+        encodingStyle="" />
+
+    <typeMapping 
+        name="InsertType" 
+        qname="wsrp:InsertType" 
+        type="java:org.oasis.wsrf.properties.InsertType"
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+        encodingStyle="" />
+
+    <typeMapping 
+        name="UpdateType" 
+        qname="wsrp:UpdateType" 
+        type="java:org.oasis.wsrf.properties.UpdateType"
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+        encodingStyle="" />
+
+    <typeMapping 
+        name="TopicExpressionType" 
+        qname="wsnt:TopicExpressionType" 
+        type="java:org.oasis.wsn.TopicExpressionType"
+        deserializer="org.globus.wsrf.encoding.TopicExpressionDeserializerFactory"
+        serializer="org.globus.wsrf.encoding.TopicExpressionSerializerFactory"
+        encodingStyle="" />
+
+    <typeMapping 
+        name=">SetResourceProperties" 
+        qname="wsrp:>SetResourceProperties" 
+        type="java:org.oasis.wsrf.properties.SetResourceProperties_Element"
+        deserializer="org.globus.wsrf.encoding.AnyListDeserializerFactory"
+        serializer="org.globus.wsrf.encoding.AnyListSerializerFactory"
+        encodingStyle="" />
+
+    <typeMapping 
+        name="QueryExpressionType" 
+        qname="wsrp:QueryExpressionType" 
+        type="java:org.oasis.wsrf.properties.QueryExpressionType"
+        deserializer="org.globus.wsrf.encoding.QueryExpressionDeserializerFactory"
+        serializer="org.globus.wsrf.encoding.QueryExpressionSerializerFactory"
+        encodingStyle="" />
+
+    <!-- WS-Addressing Bits -->
+
+   <typeMapping 
+         encodingStyle="" 
+         qname="wsa:EndpointReferenceType" 
+         deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" 
+         serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+         type="java:org.apache.axis.message.addressing.EndpointReferenceType" />
+
+   <typeMapping
+         encodingStyle=""
+         qname="wsa:ReferencePropertiesType"
+         deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+         serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+         type="java:org.apache.axis.message.addressing.ReferencePropertiesType" />
+
+   <typeMapping 
+        encodingStyle="" 
+        qname="wsa:AttributedURI" 
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        type="java:org.apache.axis.message.addressing.AttributedURI" />
+
+   <typeMapping 
+        encodingStyle=""
+        qname="wsa:AttributedQName" 
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        type="java:org.apache.axis.message.addressing.AttributedQName" />
+
+   <typeMapping
+        encodingStyle=""
+        qname="wsa:ServiceNameType"
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        type="java:org.apache.axis.message.addressing.ServiceNameType" />
+    
+    <!-- WS Trust and WS Secure Conversation -->
+    <typeMapping 
+        encodingStyle="" 
+        qname="ns1:SecurityContextTokenType" 
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" 
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        type="java:org.globus.ws.sc.SecurityContextTokenType"
+        xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/04/sc" />
+
+    <typeMapping 
+        encodingStyle="" 
+        qname="ns1:BinaryExchangeType" 
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory" 
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        type="java:org.globus.ws.trust.BinaryExchangeType"
+        xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/04/trust" />
+</deployment>

Added: incubator/apollo/globus/core/source/docs/developer_notes.php
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/docs/developer_notes.php?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/docs/developer_notes.php	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,241 @@
+<?php
+
+$title = "GT 4.0 Developer Notes: Java WS Core";
+
+include_once( "/mcs/www-unix.globus.org/include/globus_header.inc" ); 
+?>
+
+
+
+<p class="small"><a href="http://www.globus.org">Globus</a> &gt; <a href="http://www-unix.globus.org/toolkit/">Toolkit</a> &gt; <a href="http://www-unix.globus.org/toolkit/docs/">Documents</a> &gt; <a href="http://www-unix.globus.org/toolkit/docs/development/index.html">Development</a> &gt;  <a href="http://www-unix.globus.org/toolkit/docs/development/3.9.2/index.html">3.9.2</a> &lt; </p>
+<h1>GT 4.0 Developer Notes: Java WS Core</h1>
+
+<h2>Tomcat</h2>
+
+<p>
+To deploy GT4 installation into Tomcat run:
+<pre>
+cd $GLOBUS_LOCATION
+ant -f share/globus_wsrf_common/tomcat/tomcat.xml deployTomcat -Dtomcat.dir=<b>&lt;tomcat.dir&gt</b>
+</pre>
+
+Where <i>&lt;tomcat.dir&gt;</i> is an <b>absolute</b> path to the Tomcat installation directory. 
+</p>
+
+<p>
+To create a <code>.war</code> of GT4 installation do:
+<pre>
+cd $GLOBUS_LOCATION
+ant -f share/globus_wsrf_common/tomcat/tomcat.xml war -Dwar.file=<b>&lt;war.file&gt</b>
+</pre>
+
+Where <i>&lt;war.file&gt;</i> specifies an <b>absolute</b> path of the war file. <br><br>Please note that deploying a <code>war</code> file might not be enough to have a working GT4 deployment. For example, in some cases the <code>xalan.jar</code> must be placed in the <code>endorsed</code> directory of the container.
+</p>
+
+
+<h2>Testing</h2>
+
+<h3>Conventions</h3>
+
+<p>
+Group your tests under <i>PackageTests.java</i> and/or <i>SecurityTests.java</i> (The naming is important because these names are used to discover the tests dynamically). Put all tests that require any type of credentials in <i>SecurityTests.java</i> test suite. 
+</p>
+
+<h3>Running</h3>
+
+<p>
+To execute the tests on GT4 install run (assuming the tests have been deployed into GT4 install):
+
+<pre>
+cd $GLOBUS_LOCATION
+ant -f share/globus_wsrf_test/runtests.xml runServer -Dtests.jar=&lt;test.jar&gt;
+</pre>
+
+Where <i>&lt;test.jar&gt;</i> is an <b>absolute</b> path to the jar file that contains the tests. By default, the tests that use a container will try to access a container running at <i>http://localhost:8080/wsrf/services/</i>. To specify a different container use <i>-Dtest.server.url=&lt;url&gt;</i> property. To execute PackageTests only specify <i>-DbasicTestsOnly=true</i>. To execute SecurityTests only specify <i>-DsecurityTestsOnly=true</i>. <br>
+The test reports will be put in <i>$GLOBUS_LOCATION/share/globus_wsrf_test/test-reports</i> directory by default. The different test reports directory can be specified by passing <i>-Djunit.reports.dir=&lt;directory&gt;</i>.
+</p>
+
+<h2>Activation</h2>
+
+<h3>Service</h3>
+
+<h4>Axis RPCProvider</h4>
+
+<p>
+Instance of a service is always created on an invocation. It depends on the 'scope' setting if one instance of the service is used for all invocations (<i>Application</i> scope), if one instance is created per invocation (<i>Request</i> scope), or one instance per session (<i>Session</i> scope). The <i>Request</i> scope is default (if scope parameter is not set in the deployment descriptor). If service implements the <a href="http://java.sun.com/j2ee/1.4/docs/api/javax/xml/rpc/server/ServiceLifecycle.html">javax.xml.rpc.server.ServiceLifecycle</a> interface the lifecycle methods they will be called accordingly to the scope setting as a service instance is created and destroyed. For example, in <i>Application</i> scope <i>destroy()</i> will be called on container shutdown, and in <i>Request</i> scope it will be called after the service method is called. JAAS credentials will not be associated with a thread when a service instance is created.
+</p>
+
+<h4>Globus RPCProvider</h4>
+
+<p>
+Only <i>Application</i> and <i>Request</i> scopes are supported. <br>
+If <i>Request</i> scope things behave just like in Axis RPCProvider (service/providers instances are created per invocation, no JAAS credentials, ServiceLifecycle methods called right before and after service method invocation). <br>
+If <i>Application</i> scope service/provider instances are created either on first invocation or on container startup if <i>"loadOnStartup"</i> parameter in the deployment descriptor is set:
+
+<pre>
+&lt;parameter name="loadOnStartup" value="true'/&gt;
+</pre>
+
+This will work in the same way in the standalone container and in Tomcat.
+If the service or the container is configured with a security descriptor, the appropriate credentials will be associated with the thread during activation (using JAAS). Also, during activation a basic Axis MessageContext will be associated with the thread with only <i>Constants.MC_HOME_DIR</i>, <i>Constants.MC_CONFIGPATH</i>, and the right target service properties set (see <a href="#MessageContext">MessageContext Properties</a> section for details). If service or providers implement the <a href="http://java.sun.com/j2ee/1.4/docs/api/javax/xml/rpc/server/ServiceLifecycle.html">javax.xml.rpc.server.ServiceLifecycle</a> interface the lifecycle methods will be called accordingly.
+</p>
+
+<h3>ResourceHome</h3>
+
+<p>
+ResourceHome will be activated on the first service invocation or during container startup if <i>"loadOnStartup"</i> parameter is set. If ResourceHome get activated in such ways, proper MessageContext and/or JAAS subject will be associated with the thread. Also proper MessageContext and/or JAAS subject will be associated with the thread if the ResourceHome gets activated by a separate thread directly looking up the ResourceHome implementation in JNDI. This actually applies to all <i>resource</i> entries directly defined under <i>service</i> entries in <i>jndi-config.xml</i> and configured with <i>org.globus.wsrf.jndi.BeanFactory</i> factory.
+</p>
+
+<h4>ServiceResourceHome</h4>
+
+<p>
+If you are using ServiceResourceHome please make sure to deploy the service with <i>"loadOnStartup"</i> option enabled and in <i>Application</i> scope. That will ensure that the ResourceHome is initialized with the right service/resource.
+</p>
+
+<a name="MessageContext"></a>
+<h2>MessageContext Properties</h2>
+
+<ul>
+<li>
+Constants.MC_HOME_DIR - the base directory from which the wsdl files are loaded from. 
+</li>
+<li>
+Constants.MC_CONFIGPATH - the base directory from which different configuration files are loaded from. For example, use that to load files from etc/ directory.
+</li>
+<li>
+Constants.MC_REMOTE_ADDR - contains the IP address of the client
+</li>
+<li>
+MessageContext.TRANS_URL - the request url
+</li>
+</ul>
+
+<p>
+In the standalone container the <i>Constants.MC_HOME_DIR</i> and <i>Constants.MC_CONFIGPATH</i> properties will usually point to the same directory. However, in Tomcat they will point to two different directories so make sure to use the right property to load the configuration files.
+</p>
+
+<h2>Local Invocations</h2>
+
+<p>
+Services in the container can be invoked locally. Local invocations work just like remote invocations (all handlers are called, messages get serialized/deserialized) but messages do not travel over the network - everything happens in memory. 
+</p>
+<p>
+Local invocations can only be made on the server side and only when a Axis MessageContext is associated with a current thread. URLs with "<i>local</i>" protocol name are used for local invocations. To invoke a service locally do:
+
+<table cellpadding="5">
+
+<tr>
+<td valign="top">1</td>
+<td valign="top">
+<p>Register "<i>local</i>" protocol handler:</p>
+<pre>
+import org.globus.axis.transport.local.LocalTransportUtils;
+...
+<b>LocalTransportUtils.init();</b>
+...
+</pre>
+</td>
+</tr>
+
+<tr>
+<td valign="top">2</td>
+<td valign="top">
+<p>Create a service URL with "<i>local</i>" protocol:</p>
+<pre>
+URL url = new URL(<b>"local:///wsrf/services/MyService"</b>);
+</pre>
+</td>
+</tr>
+
+<tr>
+<td valign="top">3</td>
+<td valign="top">
+<p>Configure the service stub for local invocation and make the call:</p>
+<pre>
+MyServiceAddressingLocator locator = 
+       new MyServiceAddressingLocator();
+MyService port = locator.getMyServicePort(url);
+
+<b>LocalTransportUtils.enableLocalTransport((Stub)port);</b>
+
+port.hello();
+</pre>
+
+</table>
+</p>
+
+<h3>Tomcat</h3>
+
+<p>
+Special configuration is required to enable local invocations in Tomcat. The "<i>local</i>" protocol URL handler must be installed in a different way. 
+[ADD MORE INFO HERE HOW].
+</p>
+
+
+
+<h2>Using ResourceHomeImpl</h2>
+
+<p>
+If <i>ResourceHomeImpl</i> is configured with resource class that implements the <i>PersistentResource</i> interface it will store the resource objects wrapped in Java <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ref/SoftReference.html">SoftReference</a>. That allows the JVM to automatically reclaim these resource objects thus reducing the memory usage. Since the JVM can decide to reclaim these objects at any point sometimes a resource object can be reclaimed between two subsequent invocations on the same resource. This for example can cause the state of the resource to be reloaded from disk on each call.<br>
+To prevent the JVM from reclaiming the resource objects so quickly a cache can be setup up to hold direct references to these objects. We provide a basic LRU (least recently used) cache implementation. Other cache implementations can be used as long as they implement the <i>org.globus.wsrf.utils.cache.Cache</i> interface.
+</p>
+
+<p>
+To configure a cache for <i>ResourceHomeImpl</i> first define a cache resource:
+</p>
+<pre>
+&lt;resource name="cache" 
+             type="org.globus.wsrf.utils.cache.LRUCache"&gt;
+  &lt;resourceParams&gt;
+     &lt;parameter&gt;
+        &lt;name&gt;factory&lt;/name&gt;
+        &lt;value&gt;org.globus.wsrf.jndi.BeanFactory&lt;/value&gt;
+     &lt;/parameter&gt;
+     &lt;parameter&gt;
+        &lt;name&gt;timeout&lt;/name&gt;
+        &lt;value&gt;120000&lt;/value&gt;
+     &lt;/parameter&gt;
+  &lt;/resourceParams&gt;
+&lt;/resource>
+</pre>
+<p>
+In this case a LRU cache is configured. The "<i>timeout</i>" parameter (in ms) is used to specify the idle time of the resource object before it is removed from cache.
+<br>
+The same cache resource can be reused in different services but usually once cache per service will be configured. 
+</p>
+<p>
+Once the cache resource is defined add the "<i>cacheLocation</i>" parameter to the service <i>home</i> resource. The "<i>cacheLocation</i>" parameter value is the JNDI name of the cache resource:
+</p>
+<pre>
+&lt;service name="CounterService"&gt;
+   &lt;resource name="home" type="..."&gt;
+      &lt;resourceParams&gt;
+         ...<b>
+         &lt;parameter&gt;
+            &lt;name&gt;cacheLocation&lt;/name&gt;
+            &lt;value&gt;java:comp/env/CounterService/cache&lt;/value&gt;
+         &lt;/parameter&gt;</b>
+         ...
+      &lt;/resourceParams&gt;
+   ...
+</pre>
+<p>
+Please note that once the object is removed from the cache it is still up to the JVM to actually reclaim the object.
+</p>
+
+<h2>Proxy Support</h2>
+
+<p>
+A basic proxy support is provided. A <b><code>org.globus.wsrf.proxy.port</code></b> system property can be set to the port of the proxy server (the proxy server must run on the same machine as the container). This will make any code that uses <code>ServiceHost</code> or <code>AddressingUtils</code> API return the address of the proxy server instead of the container. This could be useful for example for debugging purposes.<br>
+The <b><code>org.globus.wsrf.proxy.port</code></b> system property can be passed to <code>globus-start-container</code> script via <code>GLOBUS_OPTIONS</code> environment property. For example:
+
+<pre>
+setenv GLOBUS_OPTIONS="-Dorg.globus.wsrf.proxy.port=5555"
+globus-start-container
+</pre>
+
+Please note that not all of the core code will obey the proxy port setting.
+ 
+</p>
+
+<?php include("http://www-unix.globus.org/include/globus_footer.inc"); ?>

Added: incubator/apollo/globus/core/source/docs/notes.html
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/docs/notes.html?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/docs/notes.html	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,43 @@
+<html>
+
+<head>
+<title>Notes</title>
+</head>
+
+<body>
+
+<h2>Axis Notes</h2>
+
+<ol>
+
+<li>
+With mixed content type, the simple types are serialized as plain text and the type information is lost. The <i>org.apache.axis.message.Text</i> nodes are used to store or keep the text value.
+</li>
+
+<li>
+If you see elements on the wire with empty namespaces (xmlns=""), check the <i>TypeDesc</i> of the generated bean. This is probably because you are missing 'elementFormDefault="qualified"' attribute in your wsdl &lt;type&gt;&lt;schema&gt; section or in your xsd file.
+</li>
+
+<li>
+If you see a "incompatible types" error while compiling generated stubs and type classes, for example:
+<pre>
+found   : com.ibm.wsrf.notification.ResumeFailedFaultType
+required: java.lang.Throwable
+</pre>
+This usually might happen for types defined for faults. Sometimes WSDL2Java will generate for a wsdl fault a proper class that extends AxisFault and sometimes it will generate a plain type bean. In the latter case this will result in the above error. One solution to this problem is to move the stub generation for your service to the top of the list. Another solution is delete (before compile step) the stubs generated for all WSRF namespaces. Yet another solution is to tell WSDL2Java program not to generate classes for all WSRF namespaces (using -x option). 
+</li>
+
+<li>
+Axis doesn't currently support <code>&lt;xsd:choice maxOccurs="unbounded"&gt;</code> correctly. Also, Axis will incorrectly serialize the qname for beans that were generated from:
+<pre>
+ &lt;xs:extension base="xs:QName"&gt;
+   ...
+ &lt;/xs:extension&gt;
+</pre>
+</li>
+
+</ol>
+
+</body>
+</html>
+

Added: incubator/apollo/globus/core/source/etc/client-jndi-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/etc/client-jndi-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/etc/client-jndi-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jndiConfig xmlns="http://wsrf.globus.org/jndi/config">
+    <global>
+        <resource
+            name="notificationConsumerHome"
+            type="org.globus.wsrf.impl.notification.NotificationConsumerHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.NotificationConsumerCallbackManagerImpl</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://www.globus.org/namespaces/2004/06/core}NotificationConsumerKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+        <resource
+            name="wm/ContainerWorkManager"
+            type="org.globus.wsrf.impl.work.WorkManagerImpl">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+        <resource
+            name="timer/ContainerTimer"
+            type="org.globus.wsrf.impl.timer.TimerManagerImpl">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+       <resource name="query/eval/xpath"
+                  type="org.globus.wsrf.impl.XPathExpressionEvaluator">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+        <resource name="query/ContainerQueryEngine"
+                  type="org.globus.wsrf.impl.QueryEngineImpl">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+       <resource name="topic/eval/simple"
+                  type="org.globus.wsrf.impl.SimpleTopicExpressionEvaluator">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+        <resource name="topic/ContainerTopicExpressionEngine"
+                  type="org.globus.wsrf.impl.TopicExpressionEngineImpl">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </global>
+    <service name="NotificationConsumerService">
+        <resourceLink
+            name="home"
+            target="java:comp/env/notificationConsumerHome"/>
+    </service>
+    <service name="gsi/AuthenticationService">
+        <resource
+            name="home"
+            type="org.globus.wsrf.impl.security.authentication.secureconv.service.SecurityContextHome">
+            <resourceParams>
+                <parameter>
+                    <name>
+                        factory
+                    </name>
+                    <value>
+		    org.globus.wsrf.jndi.BeanFactory
+                    </value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.security.authentication.secureconv.service.SecurityContext</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://www.globus.org/namespaces/2004/06/core}SecureContextKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+</jndiConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/source/etc/client-server-config.wsdd
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/etc/client-server-config.wsdd?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/etc/client-server-config.wsdd	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment name="defaultServerConfig" 
+    xmlns="http://xml.apache.org/axis/wsdd/" 
+    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" 
+    xmlns:wsrp=
+      "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd" 
+    xmlns:wsnt=
+      "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd"
+    xmlns:wsa=
+      "http://schemas.xmlsoap.org/ws/2004/03/addressing"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <globalConfiguration>
+        <parameter name="sendXsiTypes" value="true"/>
+
+	<!-- Authentication service -->
+	<parameter name="authenticationService" 
+		value="gsi/AuthenticationService"/>
+
+        <requestFlow>
+            <!-- The AddressingHandler must be first -->
+            <handler type="java:org.globus.wsrf.handlers.AddressingHandler"/>
+            <!-- The URLMapper must be second -->
+            <handler type="java:org.globus.wsrf.handlers.URLMapper"/>
+            <!-- The AuthenticationServiceHandler must be third -->
+            <handler type="AuthenticationServiceHandler"/>
+
+            <handler type="java:org.globus.wsrf.handlers.MessageLoggingHandler"/>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+		    <parameter name="className" value="org.globus.wsrf.impl.security.authentication.wssec.WSSecurityHandler"/>
+ 	    </handler>
+	    <handler type="java:org.globus.wsrf.impl.security.authentication.SecurityPolicyHandler"/>
+	    <handler type="java:org.globus.wsrf.impl.security.authorization.AuthorizationHandler"/>
+            <!-- The FaultHandler must be last -->
+            <handler type="java:org.globus.wsrf.handlers.FaultHandler"/>
+        </requestFlow>
+
+        <responseFlow>
+            <!-- The WSDLHandler must be first -->
+            <handler type="java:org.globus.wsrf.handlers.WSDLHandler"/>
+            <handler type="java:org.globus.wsrf.handlers.AddressingHandler"/>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+		<parameter name="className" value="org.globus.wsrf.impl.security.authentication.securemsg.X509EncryptHandler"/>
+ 	    </handler>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+		<parameter name="className" value="org.globus.wsrf.impl.security.authentication.securemsg.X509SignHandler"/>
+ 	    </handler>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+		<parameter name="className" value="org.globus.wsrf.impl.security.authentication.UsernameHandler"/>
+ 	    </handler>
+            <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+               <parameter name="className" value="org.globus.wsrf.impl.security.authentication.secureconv.GSSHandler"/>
+            </handler>
+            <handler type="java:org.globus.wsrf.handlers.MessageLoggingHandler"/>
+        </responseFlow>
+
+    </globalConfiguration>
+
+    <handler name="RPCDispatcher" 
+        type="java:org.apache.axis.providers.java.RPCProvider"/>
+    <handler name="URLMapper" 
+        type="java:org.apache.axis.handlers.http.URLMapper"/>
+    <handler name="MsgDispatcher" 
+        type="java:org.apache.axis.providers.java.MsgProvider"/>
+    <handler name="LocalResponder" 
+        type="java:org.apache.axis.transport.local.LocalResponder"/>
+    <handler name="logger" 
+        type="java:org.apache.axis.handlers.LogHandler"/>
+    <handler name="Authenticate" 
+        type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>
+    <handler name="AuthenticationServiceHandler" 
+        type="java:org.globus.wsrf.impl.security.authentication.secureconv.service.AuthenticationServiceHandler"/>
+
+    <service name="gsi/AuthenticationService" provider="Handler" 
+        use="literal" style="document">
+        <parameter 
+            name="handlerClass" 
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="className" 
+            value="org.globus.wsrf.impl.security.authentication.secureconv.service.AuthenticationServiceImpl"/>
+        <wsdlFile>share/schema/core/security/secconv/secure_conversation_service.wsdl</wsdlFile>
+    </service>
+
+    <service name="NotificationConsumerService" provider="java:RPC" 
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="className" 
+            value="org.globus.wsrf.impl.notification.NotificationConsumerProvider"/>
+        <wsdlFile>share/schema/core/notification/notification_consumer_service.wsdl</wsdlFile>    
+        <typeMapping
+            deserializer=
+            "org.apache.axis.encoding.ser.ElementDeserializerFactory"
+            encodingStyle="" 
+            qname="xsd:anyType"
+            type="java:java.lang.Object"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
+        <typeMapping 
+            name="ResourcePropertyValueChangeNotificationElementType" 
+            qname="ns1:ResourcePropertyValueChangeNotificationElementType" 
+            xmlns:ns1="http://wsrf.globus.org/core/notification" 
+            type="java:org.globus.wsrf.core.notification.ResourcePropertyValueChangeNotificationElementType"
+            serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+            deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+            encodingStyle="" />
+    </service>
+
+    <transport name="http">
+        <parameter name="qs:list" 
+            value="org.apache.axis.transport.http.QSListHandler"/>
+        <parameter name="qs:method" 
+            value="org.apache.axis.transport.http.QSMethodHandler"/>
+        <parameter name="qs:wsdl" 
+            value="org.apache.axis.transport.http.QSWSDLHandler"/>
+        <requestFlow>
+            <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
+        </requestFlow>
+    </transport>
+
+    <transport name="local">
+        <responseFlow>
+            <handler type="LocalResponder"/>
+        </responseFlow>
+    </transport>
+
+    <transport name="SimpleHTTP">
+        <requestFlow/>
+    </transport>
+
+    <typeMapping 
+        name="DeleteType" 
+        qname="wsrp:DeleteType" 
+        type="java:org.oasis.wsrf.properties.DeleteType"
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+        encodingStyle="" />
+
+    <typeMapping 
+        name="InsertType" 
+        qname="wsrp:InsertType" 
+        type="java:org.oasis.wsrf.properties.InsertType"
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+        encodingStyle="" />
+
+    <typeMapping 
+        name="UpdateType" 
+        qname="wsrp:UpdateType" 
+        type="java:org.oasis.wsrf.properties.UpdateType"
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+        encodingStyle="" />
+
+    <typeMapping 
+        name="TopicExpressionType" 
+        qname="wsnt:TopicExpressionType" 
+        type="java:org.oasis.wsn.TopicExpressionType"
+        deserializer="org.globus.wsrf.encoding.TopicExpressionDeserializerFactory"
+        serializer="org.globus.wsrf.encoding.TopicExpressionSerializerFactory"
+        encodingStyle="" />
+
+    <typeMapping 
+        name="QueryExpressionType" 
+        qname="wsrp:QueryExpressionType" 
+        type="java:org.oasis.wsrf.properties.QueryExpressionType"
+        deserializer="org.globus.wsrf.encoding.QueryExpressionDeserializerFactory"
+        serializer="org.globus.wsrf.encoding.QueryExpressionSerializerFactory"
+        encodingStyle="" />
+
+    <!-- WS-Addressing Bits -->
+
+   <typeMapping 
+         encodingStyle="" 
+         qname="wsa:EndpointReferenceType" 
+         deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" 
+         serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+         type="java:org.apache.axis.message.addressing.EndpointReferenceType" />
+
+   <typeMapping
+         encodingStyle=""
+         qname="wsa:ReferencePropertiesType"
+         deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
+         serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+         type="java:org.apache.axis.message.addressing.ReferencePropertiesType" />
+
+   <typeMapping 
+        encodingStyle="" 
+        qname="wsa:AttributedURI" 
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        type="java:org.apache.axis.message.addressing.AttributedURI" />
+
+   <typeMapping 
+        encodingStyle=""
+        qname="wsa:AttributedQName" 
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        type="java:org.apache.axis.message.addressing.AttributedQName" />
+
+   <typeMapping
+        encodingStyle=""
+        qname="wsa:ServiceNameType"
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory"
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        type="java:org.apache.axis.message.addressing.ServiceNameType" />
+
+    <!-- WS Trust and WS Secure Conversation -->
+    <typeMapping 
+        encodingStyle="" 
+        qname="ns1:SecurityContextTokenType" 
+        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" 
+        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
+        type="java:org.globus.ws.sc.SecurityContextTokenType"
+        xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/04/sc" />
+
+    <typeMapping 
+        encodingStyle="" 
+        qname="ns1:BinaryExchangeType" 
+        deserializer="org.apache.axis.encoding.ser.SimpleDeserializerFactory" 
+        serializer="org.apache.axis.encoding.ser.SimpleSerializerFactory"
+        type="java:org.globus.ws.trust.BinaryExchangeType"
+        xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/04/trust" />
+</deployment>

Added: incubator/apollo/globus/core/source/etc/container-log4j.properties
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/etc/container-log4j.properties?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/etc/container-log4j.properties	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,17 @@
+# Set root category priority to WARN and its only appender to A1.
+
+log4j.rootCategory=ERROR, A1
+
+# A1 is set to be a ConsoleAppender.
+
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} [%t,%M:%L] %m%n
+
+# Display any warnings generated by our code
+log4j.category.org.globus=INFO
+
+# Enable SOAP Message Logging
+# log4j.category.org.globus.wsrf.handlers.MessageLoggingHandler=DEBUG

Added: incubator/apollo/globus/core/source/etc/global_security_descriptor.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/etc/global_security_descriptor.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/etc/global_security_descriptor.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<securityConfig xmlns="http://www.globus.org">
+    <credential>
+        <key-file value="@KEY_FILE@"/>
+        <cert-file value="@CERT_FILE@"/>
+    </credential>
+</securityConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/source/etc/log4j.properties
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/etc/log4j.properties?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/etc/log4j.properties	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,22 @@
+# Set root category priority to WARN and its only appender to A1.
+
+log4j.rootCategory=ERROR, A1
+
+# A1 is set to be a ConsoleAppender.
+
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} [%t,%M:%L] %m%n
+
+# Display any warnings generated by our code
+log4j.category.org.globus=WARN
+
+# Enable SOAP Message Logging
+# log4j.category.org.globus.wsrf.handlers.MessageLoggingHandler=DEBUG
+
+# Disabled to prevent users from seeing errors during 
+# notifications with C client
+log4j.category.org.apache.axis.message.addressing.handler.AddressingHandler=OFF
+

Added: incubator/apollo/globus/core/source/etc/post-deploy.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/etc/post-deploy.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/etc/post-deploy.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,176 @@
+<?xml version="1.0"?>
+
+<!-- ===================================================================
+
+Notes:
+   This is a build file for use with the Jakarta Ant build tool.
+
+Prerequisites:
+
+   jakarta-ant from http://jakarta.apache.org
+
+
+Build Instructions:
+
+   This file is automatically called at the end of the deployment
+   of the corresponding component's gar (see build-packages.xml).
+
+Copyright:
+Copyright (c) 1999 University of Chicago and The University of
+Southern California. All Rights Reserved.
+
+==================================================================== -->
+<project default="all" basedir=".">
+
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="."/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="abs.deploy.dir" location="${deploy.dir}"/>
+    <property name="build.launcher" 
+        location="${abs.deploy.dir}/share/globus_wsrf_common/build-launcher.xml"/>
+
+    <target name="setup" depends="setCredentialLocationUnix, setCredentialLocationWindows, setupContainerDescriptor">
+
+        <move file="${abs.deploy.dir}/etc/${gar.id}/log4j.properties" 
+              todir="${abs.deploy.dir}"
+              failonerror="false"/>
+
+        <move file="${abs.deploy.dir}/etc/${gar.id}/container-log4j.properties" 
+              todir="${abs.deploy.dir}"
+              failonerror="false"/>
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="globus-start-container"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.container.ServiceContainer"/>
+            <property name="default.jvm.options"
+                value="-Dlog4j.configuration=container-log4j.properties"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="globus-stop-container"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.container.ShutdownClient"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="wsrf-destroy"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.client.Destroy"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="wsrf-set-termination-time"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.client.SetTerminationTime"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="wsrf-get-property"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.client.GetProperty"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="wsrf-get-properties"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.client.GetProperties"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="wsrf-query"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.client.Query"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="wsrf-insert-property"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.client.InsertProperty"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="wsrf-update-property"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.client.UpdateProperty"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="wsrf-delete-property"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.client.DeleteProperty"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="wsn-subscribe"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.client.Subscribe"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="wsn-pause-subscription"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.client.Pause"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="wsn-resume-subscription"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.client.Resume"/>
+        </ant>
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="wsn-get-current-message"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.client.GetCurrentMessage"/>
+        </ant>
+    </target>
+
+    <target name="testPlatform">
+        <condition property="is.unix">
+            <os family="unix"/>
+        </condition>
+        <condition property="is.windows">
+            <os family="windows"/>
+        </condition>
+    </target>
+
+    <target name="setCredentialLocationUnix" depends="testPlatform" if="is.unix">
+        <replace 
+            file="${abs.deploy.dir}/etc/${gar.id}/global_security_descriptor.xml" 
+            token="@CERT_FILE@" 
+            value="/etc/grid-security/containercert.pem"/>
+        <replace 
+            file="${abs.deploy.dir}/etc/${gar.id}/global_security_descriptor.xml" 
+            token="@KEY_FILE@" 
+            value="/etc/grid-security/containerkey.pem"/>        
+    </target>
+
+
+    <target name="setCredentialLocationWindows" depends="testPlatform" if="is.windows">
+        <replace 
+            file="${abs.deploy.dir}/etc/${gar.id}/global_security_descriptor.xml" 
+            token="@CERT_FILE@" 
+            value="${abs.deploy.dir}/etc/containercert.pem"/>
+        <replace 
+            file="${abs.deploy.dir}/etc/${gar.id}/global_security_descriptor.xml" 
+            token="@KEY_FILE@" 
+            value="${abs.deploy.dir}/etc/containerkey.pem"/>        
+    </target>
+
+    <target name="setupContainerDescriptor" if="enable.container.desc">
+        <replace file="${abs.deploy.dir}/etc/${gar.id}/server-config.wsdd">
+            <replacetoken><![CDATA[<!-- @CONTAINER_SECURITY_DESCRIPTOR@ -->]]></replacetoken>
+            <replacevalue><![CDATA[<parameter 
+            name="containerSecDesc" 
+            value="etc/globus_wsrf_core/global_security_descriptor.xml"/>]]></replacevalue>
+        </replace>
+
+    </target>
+        
+</project>

Added: incubator/apollo/globus/core/source/pkgdata/filelist
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/pkgdata/filelist?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/pkgdata/filelist	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,23 @@
+bin/wsn-get-current-message
+bin/wsn-pause-subscription
+bin/wsn-resume-subscription
+bin/wsn-subscribe
+bin/wsrf-destroy
+bin/wsrf-get-properties
+bin/wsrf-get-property
+bin/wsrf-query
+bin/wsrf-set-termination-time
+bin/globus-start-container
+bin/globus-stop-container
+lib/wsrf_core.jar
+lib/wsrf_core_stubs.jar
+share/globus_wsrf_core/NStoPkg.properties
+etc/gpt/packages/globus_wsrf_core/undeploy.xml
+etc/globus_wsrf_core/server-config.wsdd
+etc/globus_wsrf_core/client-server-config.wsdd
+etc/globus_wsrf_core/jndi-config.xml
+docs/globus_wsrf_core/developer_notes.php
+docs/globus_wsrf_core/notes.html
+client-config.wsdd
+log4j.properties
+container-log4j.properties

Added: incubator/apollo/globus/core/source/pkgdata/pkg_data_src.gpt
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/pkgdata/pkg_data_src.gpt?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/pkgdata/pkg_data_src.gpt	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE gpt_package_metadata SYSTEM "package.dtd">
+
+<gpt_package_metadata Format_Version="0.01" Name="globus_java_ws_core">
+
+    <Aging_Version Age="0" Major="0" Minor="1"/>
+    <Description>
+        The Java WS Core package
+    </Description>
+    <Functional_Group>Core</Functional_Group>
+    <Version_Stability Release="alpha" />
+
+    <src_pkg >
+
+        <Source_Dependencies Type="compile" >
+            <Dependency Name="globus_java_ws_core_common" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+            <Dependency Name="globus_java_ws_core_tools" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+            <Dependency Name="globus_ws_core_schema" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+        </Source_Dependencies>
+
+        <Source_Dependencies Type="pgm_runtime" >
+            <Dependency Name="globus_java_ws_core_registry" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+        </Source_Dependencies>
+
+        <Build_Environment >
+            <cflags ></cflags>
+            <external_includes ></external_includes>
+            <pkg_libs ></pkg_libs>
+            <external_libs ></external_libs>
+        </Build_Environment>
+
+        <With_Flavors build="no" />
+
+        <Version_Label>0.1</Version_Label>
+
+        <Build_Instructions>
+            <Build_Step>ant deploy -Denable.container.desc -Ddeploy.dir=INSTALLDIR_GPTMACRO</Build_Step>
+        </Build_Instructions>
+
+    </src_pkg >
+
+</gpt_package_metadata>

Added: incubator/apollo/globus/core/source/share/NStoPkg.properties
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/share/NStoPkg.properties?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/share/NStoPkg.properties	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,37 @@
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd=org.oasis.wsrf.properties
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl=org.oasis.wsrf.properties
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl/bindings=org.oasis.wsrf.properties
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl/service=org.oasis.wsrf.properties
+
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd=org.oasis.wsrf.lifetime
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.wsdl=org.oasis.wsrf.lifetime
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.wsdl/service=org.oasis.wsrf.lifetime
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.wsdl/bindings=org.oasis.wsrf.lifetime
+
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd=org.oasis.wsrf.faults
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.wsdl=org.oasis.wsrf.faults
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.wsdl/bindings=org.oasis.wsrf.faults
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.wsdl/service=org.oasis.wsrf.faults
+
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.xsd=org.oasis.wsrf.servicegroup
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.wsdl=org.oasis.wsrf.servicegroup
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.wsdl/bindings=org.oasis.wsrf.servicegroup
+http\://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.wsdl/service=org.oasis.wsrf.servicegroup
+
+http\://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd=org.oasis.wsn
+http\://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.wsdl=org.oasis.wsn
+http\://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.wsdl/bindings=org.oasis.wsn
+http\://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.wsdl/service=org.oasis.wsn
+
+http\://schemas.xmlsoap.org/ws/2004/03/addressing=org.apache.axis.message.addressing
+
+http\://www.gridforum.org/namespaces/2004/03/ogsa-authz/saml=org.globus.wsrf.security.authorization
+http\://www.gridforum.org/namespaces/2004/03/ogsa-authz/saml/service=org.globus.wsrf.security.authorization
+http\://www.gridforum.org/namespaces/2004/03/ogsa-authz/saml/bindings=org.globus.wsrf.security.authorization
+
+http\://schemas.xmlsoap.org/ws/2004/04/trust=org.globus.ws.trust
+http\://schemas.xmlsoap.org/ws/2002/12/policy=org.globus.ws.policy
+http\://schemas.xmlsoap.org/ws/2004/04/sc=org.globus.ws.sc
+http\://wsrf.globus.org/core/2004/07/security/secconv=org.globus.wsrf.security.impl.secconv
+http\://wsrf.globus.org/core/2004/07/security/secconv/bindings=org.globus.wsrf.security.impl.secconv
+http\://wsrf.globus.org/core/2004/07/security/secconv/service=org.globus.wsrf.security.impl.secconv

Added: incubator/apollo/globus/core/source/src/org/globus/axis/configuration/EngineConfigurationFactoryServlet.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/axis/configuration/EngineConfigurationFactoryServlet.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/axis/configuration/EngineConfigurationFactoryServlet.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,94 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.axis.configuration;
+
+import org.globus.tools.DeployConstants;
+import org.globus.wsrf.config.ContainerConfig;
+
+import org.apache.axis.configuration.EngineConfigurationFactoryDefault;
+import org.apache.axis.configuration.DirProvider;
+import org.apache.axis.AxisProperties;
+import org.apache.axis.ConfigurationException;
+import org.apache.axis.EngineConfiguration;
+import org.apache.axis.EngineConfigurationFactory;
+import org.apache.axis.utils.Messages;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import java.io.File;
+
+public class EngineConfigurationFactoryServlet
+    extends EngineConfigurationFactoryDefault
+{
+    protected static Log log =
+        LogFactory.getLog(EngineConfigurationFactoryServlet.class.getName());
+
+    private ServletContext ctx;
+    
+    public static EngineConfigurationFactory newFactory(Object param) {
+        return (param instanceof ServletConfig)
+               ? new EngineConfigurationFactoryServlet((ServletConfig)param)
+               : null;
+    }
+
+    protected EngineConfigurationFactoryServlet(ServletConfig conf) {
+        super();
+        this.ctx = conf.getServletContext();
+    }
+
+    public EngineConfiguration getServerEngineConfig() {
+        return getServerEngineConfig(ctx);
+    }
+
+    private static 
+            EngineConfiguration getServerEngineConfig(ServletContext ctx) {
+        // Respect the system property setting for a different config file
+        String configFile = 
+                AxisProperties.getProperty(OPTION_SERVER_CONFIG_FILE);
+        if (configFile == null) {
+            configFile = SERVER_CONFIG_FILE;
+        }
+        
+        String appWebInfPath = "/WEB-INF";
+        String realWebInfPath = ctx.getRealPath(appWebInfPath);
+
+        if (realWebInfPath == null) {
+            log.error(Messages.getMessage("servletEngineWebInfError00"));
+        }
+
+        String configProfile = 
+            ctx.getInitParameter(ContainerConfig.CONFIG_PROFILE);
+        if (configProfile != null) {
+            configFile = configProfile + "-" + configFile;
+        }
+
+        DirProvider config = null;
+
+        String baseDir = realWebInfPath + File.separator + 
+            DeployConstants.CONFIG_BASE_DIR;
+        try {
+            config = new DirProvider(baseDir, configFile);
+        } catch (ConfigurationException e) {
+            log.error(Messages.getMessage("servletEngineWebInfError00"), e);
+        }
+        
+        return config;
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/axis/description/Resources.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/axis/description/Resources.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/axis/description/Resources.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,101 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.axis.description;
+
+import java.util.ListResourceBundle;
+
+/**
+ * I18N class.
+ */
+public class Resources extends ListResourceBundle
+{
+    public Object[][] getContents()
+    {
+        return contents;
+    }
+
+    static final Object[][] contents =
+        {
+            {
+                "invalidPivotHandler",
+                "[CORE] ''providers'' parameter of ''{0}'' service requires ''{1}'' provider"
+            },
+            {
+                "invalidScope",
+                "[CORE] ''scope'' parameter of ''{0}'' service must be set to ''{1}'' or ''{2}''"
+            },
+            {
+                "invalidNumberOfParams",
+                "[CORE] Having more than one input parameter is not allowed"
+            },
+            {
+                "missingOperation",
+                "[CORE] Operation ''{0}'' defined in wsdl but it''s not implemented in the ''{1}'' service."
+            },
+            {
+                "missingFault",
+                "[CORE] Fault ''{0}'' defined in wsdl but it''is not thrown by the ''{1}'' operation in the ''{2}'' service."
+            },
+            {
+                "typeDescNoXmlType",
+                "[CORE] No xml type defined in TypeDesc of ''{0}'' class"
+            },
+            {
+                "noFaultTypeDesc",
+                "[CORE] No TypeDesc for ''{0}'' fault class"
+            },
+            {
+                "noFaultMessage",
+                "[CORE] No wsdl:message entry for ''{0}'' fault for ''{1}'' service"
+            },
+            {
+                "invalidFaultPart",
+                "[CORE] No wsdl:part entry or invalid number of entries (0 or more than 1) for ''{0}'' fault for ''{1}'' service"
+            },
+            {
+                "missingElementAttribute",
+                "[CORE] Missing ''element'' attribute of wsdl:part entry for ''{0}'' fault for ''{1}'' service"
+            },
+            {
+                "missingElementFault",
+                "[CORE] Missing ''xsd:element'' definition for ''{0}'' fault for ''{1}'' service"
+            },
+            {
+                "missingTypeFault",
+                "[CORE] Missing ''xsd:type'' definition for ''{0}'' fault for ''{1}'' service"
+            },
+            {
+                "noTypeQName",
+                "[CORE] No type qname"
+            },
+            {
+                "noPortConfig",
+                "[CORE] No {0}Port parameter defined. Unable to determine service url"
+            },
+            {
+                "noWSDLImportLocationError",
+                "[CORE] No ''location'' attribute in wsdl import"
+            },
+            {
+                "noWSDLBinding",
+                "[CORE] wsdl binding information missing for service ''{0}''"
+            },
+            {
+                "noSOAPAddressError",
+                "[CORE] SOAP address not found"
+            }
+        };
+}

Added: incubator/apollo/globus/core/source/src/org/globus/axis/description/ServiceDescUtil.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/axis/description/ServiceDescUtil.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/axis/description/ServiceDescUtil.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,748 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.axis.description;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.io.File;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.wsdl.Fault;
+import javax.wsdl.Part;
+import javax.wsdl.Message;
+import javax.wsdl.WSDLException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.AxisEngine;
+import org.apache.axis.AxisFault;
+import org.apache.axis.EngineConfiguration;
+import org.apache.axis.MessageContext;
+import org.apache.axis.WSDDEngineConfiguration;
+import org.apache.axis.deployment.wsdd.WSDDDeployment;
+import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
+import org.apache.axis.description.JavaServiceDesc;
+import org.apache.axis.description.OperationDesc;
+import org.apache.axis.description.ParameterDesc;
+import org.apache.axis.description.ServiceDesc;
+import org.apache.axis.description.FaultDesc;
+import org.apache.axis.description.TypeDesc;
+import org.apache.axis.enum.Scope;
+import org.apache.axis.handlers.soap.SOAPService;
+import org.apache.axis.providers.java.JavaProvider;
+import org.apache.axis.utils.cache.ClassCache;
+import org.apache.axis.utils.cache.JavaClass;
+import org.apache.axis.wsdl.symbolTable.BindingEntry;
+import org.apache.axis.wsdl.symbolTable.Parameter;
+import org.apache.axis.wsdl.symbolTable.Parameters;
+import org.apache.axis.wsdl.symbolTable.SymbolTable;
+import org.apache.axis.wsdl.symbolTable.TypeEntry;
+import org.apache.axis.wsdl.toJava.JavaGeneratorFactory;
+import org.apache.axis.message.addressing.handler.AddressingHandler;
+import org.apache.axis.message.addressing.util.AddressingUtils;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import org.globus.axis.providers.RPCProvider;
+import org.globus.util.I18n;
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.config.ContainerConfig;
+import org.globus.wsrf.container.ServiceHost;
+import org.globus.wsrf.container.ServiceManager;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This class updates the Java service description with information retreived
+ * from the wsdl file. It also updates the soap address location url in the
+ * wsdl file.
+ */
+public class ServiceDescUtil {
+
+    public static final String PROVIDER_MAPPING =
+        "providerMapping";
+
+    public static final String PROVIDERS_OPTION =
+        "providers";
+
+    private static final String INITIALIZED =
+        "org.globus.wsrf.axis.servicedesc.initialized";
+
+    public static final String ALLOWED_METHODS_CLASS =
+        "allowedMethodsClass";
+
+    public static final String ACTION_MAP =
+        "addressing.action.map";
+
+    static Log logger =
+        LogFactory.getLog(ServiceDescUtil.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public static void resetOperations(MessageContext msgContext)
+        throws AxisFault {
+	// first ensure service is initialized
+        try {
+            ServiceManager.initializeService(msgContext);
+        } catch (AxisFault e) {
+            throw e;
+        } catch (Exception e) {
+            throw AxisFault.makeFault(e);
+        }
+	// then reset operations
+        AddressingHandler.resetContextOperations(msgContext);
+    }
+
+    public static void initializeService(MessageContext msgContext)
+        throws Exception {
+        SOAPService service = msgContext.getService();
+        if (service == null) {
+            return;
+        }
+        ServiceDesc serviceDesc =
+            service.getInitializedServiceDesc(msgContext);
+        synchronized (serviceDesc) {
+            if (serviceDesc.getProperty(INITIALIZED) != null) {
+                return;
+            }
+
+            //TODO: reserialize is never used?
+            boolean reserialize = false;
+            if (initializeProviders(msgContext, service, serviceDesc)) {
+                reserialize = true;
+            }
+            updateAllowedMethods(msgContext, service, serviceDesc);
+            if (fixNamespaces(msgContext, service, serviceDesc)) {
+                reserialize = true;
+            }
+
+            serviceDesc.setProperty(INITIALIZED, Boolean.TRUE);
+        }
+    }
+
+    public static boolean initializeProviders(MessageContext msgCtx,
+                                              SOAPService service,
+                                              ServiceDesc serviceDesc)
+        throws Exception {
+        boolean operDescModified = false;
+
+        boolean rightHandler =
+            (service.getPivotHandler() instanceof RPCProvider);
+
+        String providers = (String)service.getOption(PROVIDERS_OPTION);
+        if (providers == null) {
+            if (rightHandler) {
+                // fall through
+            } else {
+                return operDescModified;
+            }
+        } else {
+            if (rightHandler) {
+                // fall through
+            } else {
+                throw new Exception(
+                i18n.getMessage(
+                    "invalidPivotHandler",
+                    new Object[] {service.getName(),
+                                  RPCProvider.class.getName()}));
+            }
+        }
+
+        String scopeOpt = (String)service.getOption(JavaProvider.OPTION_SCOPE);
+        Scope scope = Scope.getScope(scopeOpt, Scope.DEFAULT);
+        if (scope != Scope.APPLICATION && scope != Scope.REQUEST) {
+            throw new Exception(
+                i18n.getMessage(
+                    "invalidScope",
+                    new Object[] {service.getName(),
+                                  Scope.APPLICATION_STR,
+                                  Scope.REQUEST_STR}));
+        }
+
+        AxisEngine engine = msgCtx.getAxisEngine();
+
+        if (scope == Scope.APPLICATION) {
+            Class serviceClass = ((JavaServiceDesc)serviceDesc).getImplClass();
+            Object serviceInstance =
+                RPCProvider.getNewServiceInstance(msgCtx, serviceClass);
+            engine.getApplicationSession().set(serviceDesc.getName(),
+                                               serviceInstance);
+        }
+
+        if (providers == null) {
+            return operDescModified;
+        }
+
+        WSDDGlobalConfiguration globalConfig = null;
+
+        EngineConfiguration config = engine.getConfig();
+        if (config instanceof WSDDEngineConfiguration) {
+            WSDDDeployment deployment =
+                ((WSDDEngineConfiguration)config).getDeployment();
+            globalConfig = deployment.getGlobalConfiguration();
+        }
+
+        ClassCache cache = engine.getClassCache();
+        ClassLoader cl = msgCtx.getClassLoader();
+
+        JavaServiceDesc providerDesc;
+        String provider;
+        Class providerClass;
+        Map mapping = null;
+        JavaClass jc;
+        StringTokenizer tokens = new StringTokenizer(providers);
+
+        while(tokens.hasMoreTokens()) {
+            provider = tokens.nextToken();
+
+            // lookup global paramter for this provider name
+            if (globalConfig != null) {
+                String tmp  = globalConfig.getParameter(provider);
+                if (tmp != null) {
+                    provider = tmp.trim();
+                }
+            }
+
+            // load the class and introspect it
+            jc = cache.lookup(provider, cl);
+            providerClass = jc.getJavaClass();
+            providerDesc = new JavaServiceDesc();
+            providerDesc.loadServiceDescByIntrospection(providerClass);
+
+            List operations = providerDesc.getOperations();
+            Iterator iter = operations.iterator();
+            String operationName = null;
+            Object providerObj = null;
+            while(iter.hasNext()) {
+                OperationDesc operation = (OperationDesc)iter.next();
+                operationName = operation.getName();
+                if (serviceDesc.getOperationsByName(operationName) == null) {
+
+                    if (logger.isDebugEnabled()) {
+                        logger.debug("Added operation '" + operationName +
+                                     "' for " + serviceDesc.getName() +
+                                     " service");
+                    }
+
+                    serviceDesc.addOperationDesc(operation);
+
+                    if (mapping == null) {
+                        mapping = new HashMap();
+                        // set mapping
+                        service.setOption(PROVIDER_MAPPING,
+                                          mapping);
+                    }
+
+                    if (providerObj == null) {
+                        // this ensures that only one instance of the provider
+                        // is created even though multiple operations of the
+                        // same provider are added
+                        if (scope == Scope.APPLICATION) {
+                            // for application scope create instance
+                            providerObj =
+                                RPCProvider.getNewServiceInstance(msgCtx,
+                                                                  providerClass);
+                            String key = serviceDesc.getName() + "/" +
+                                providerObj.hashCode();
+                            engine.getApplicationSession().set(key, providerObj);
+                        } else {
+                            // for request scope just pass class
+                            providerObj = providerClass;
+                        }
+                    }
+
+                    mapping.put(operation, providerObj);
+                }
+            }
+        }
+
+        operDescModified = (mapping != null);
+
+        return operDescModified;
+    }
+
+    public static boolean fixNamespaces(MessageContext msgCtx,
+                                        SOAPService service,
+                                        ServiceDesc serviceDesc)
+        throws Exception {
+        boolean operDescModified = false;
+
+        service.generateWSDL(msgCtx);
+        Document wsdlDoc = (Document)msgCtx.getProperty("WSDL");
+        if (wsdlDoc == null) {
+            return operDescModified;
+        }
+        msgCtx.removeProperty("WSDL");
+
+        AxisEngine engine = msgCtx.getAxisEngine();
+        ClassCache cache = engine.getClassCache();
+        ClassLoader cl = msgCtx.getClassLoader();
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("Fixing namespaces for: " + serviceDesc.getName());
+        }
+        SymbolTable table =
+            new SymbolTable(new JavaGeneratorFactory().getBaseTypeMapping(),
+                            true,
+                            logger.isDebugEnabled(),
+                            !serviceDesc.isWrapped());
+
+        table.setQuiet(!logger.isDebugEnabled());
+
+        File wsdlFile = new File(serviceDesc.getWSDLFile());
+        if (!wsdlFile.exists()) {
+            String homeDir = (String)msgCtx.getProperty(org.apache.axis.Constants.MC_HOME_DIR);
+            if (homeDir == null) {
+                homeDir = ".";
+            }
+            wsdlFile = new File(homeDir, serviceDesc.getWSDLFile());
+        }
+
+        table.populate(wsdlFile.getAbsolutePath(), wsdlDoc);
+
+        HashMap symbolMap = table.getHashMap();
+
+        Iterator symbols = symbolMap.values().iterator();
+
+        boolean hasBinding = false;
+
+        while (symbols.hasNext()) {
+            Vector symbolVector = (Vector) symbols.next();
+
+            for (int i = 0; i < symbolVector.size(); ++i) {
+                if (symbolVector.get(i) instanceof BindingEntry) {
+                    hasBinding = true;
+
+                    BindingEntry bindingEntry =
+                        (BindingEntry) symbolVector.get(i);
+
+                    Binding binding = bindingEntry.getBinding();
+
+                    PortType portType = binding.getPortType();
+
+                    Iterator operations = portType.getOperations().iterator();
+
+                    // get parameters
+                    while (operations.hasNext()) {
+                        Operation operation = (Operation) operations.next();
+
+                        String opName = operation.getName();
+
+                        // for the operation defined in wsdl get the service
+                        // operation description
+                        OperationDesc operationDesc =
+                            serviceDesc.getOperationByName(opName);
+
+                        if (operationDesc == null &&
+                            Character.isUpperCase(opName.charAt(0))) {
+                            opName = Character.toLowerCase(opName.charAt(0)) +
+                                opName.substring(1);
+                            logger.debug("Trying: " + opName);
+                            operationDesc =
+                                serviceDesc.getOperationByName(opName);
+                        }
+
+                        if (operationDesc == null) {
+                            throw new Exception(
+                                   i18n.getMessage(
+                                         "missingOperation",
+                                         new Object[] { operation.getName(),
+                                                        serviceDesc.getName() }
+                                   )
+                            );
+                        }
+
+                        // creates WS-Addressing reply Action Operation mapping
+                        createWSAActionMapping(serviceDesc,
+                                               operationDesc,
+                                               portType.getQName(),
+                                               operation);
+
+                        Parameters params =
+                            bindingEntry.getParameters(operation);
+
+                        if (params.list.size() > 1) {
+                            throw new Exception(
+                                i18n.getMessage("invalidNumberOfParams"));
+                        }
+
+                        for (int j=0;j<params.list.size();j++) {
+                            Parameter param = (Parameter)params.list.get(j);
+
+                            if (param.getMode() == Parameter.IN) {
+                                // fix the qname
+                                // qname of the parameter in the service
+                                // description will match the qname
+                                // in service wsdl
+                                ParameterDesc paramDesc =
+                                    operationDesc.getParameter(j);
+                                if (paramDesc != null) {
+                                    paramDesc.setQName(param.getQName());
+                                    operDescModified = true;
+                                }
+                            }
+
+                        }
+
+                        // fix element names for Faults
+                        fixFaults(serviceDesc,
+                                  operationDesc,
+                                  cache,
+                                  cl,
+                                  operation,
+                                  table);
+
+                        if (params.returnParam != null) {
+                            operationDesc.setReturnQName(
+                                params.returnParam.getQName());
+                        }
+
+                        QName operationName =
+                            new QName(portType.getQName().getNamespaceURI(),
+                                      opName);
+                        operationDesc.setElementQName(operationName);
+                    }
+                }
+            }
+        }
+
+        if (!hasBinding) {
+             throw new WSDLException(
+                         WSDLException.OTHER_ERROR,
+                         i18n.getMessage("noWSDLBinding",
+                                         new Object[] {serviceDesc.getName()})
+             );
+        }
+
+        return operDescModified;
+    }
+
+    private static void createWSAActionMapping(ServiceDesc serviceDesc,
+                                               OperationDesc operationDesc,
+                                               QName portTypeQName,
+                                               Operation operation)
+        throws Exception {
+        String action = AddressingUtils.getOutputAction(portTypeQName,
+                                                        operation);
+        Map actionMap = (Map)serviceDesc.getProperty(ACTION_MAP);
+        if (actionMap == null) {
+            actionMap = new HashMap();
+            serviceDesc.setProperty(ACTION_MAP, actionMap);
+        }
+        actionMap.put(operationDesc, action);
+    }
+
+    private static void fixFaults(ServiceDesc serviceDesc,
+                                  OperationDesc operationDesc,
+                                  ClassCache cache,
+                                  ClassLoader cl,
+                                  Operation operation,
+                                  SymbolTable table)
+        throws Exception {
+        Map faultMap = new HashMap();
+
+        // step 1: get xml types of faults associated with the
+        // operation and create a fault map of xmlType->FaultDesc
+        List list = operationDesc.getFaults();
+        if (list != null) {
+            JavaClass jc = null;
+            TypeDesc typeDesc = null;
+            Iterator iter = list.iterator();
+            while (iter.hasNext()) {
+                FaultDesc fault = (FaultDesc)iter.next();
+                QName xmlType = fault.getXmlType();
+                if (xmlType == null) {
+                    jc = cache.lookup(fault.getClassName(), cl);
+                    typeDesc = TypeDesc.getTypeDescForClass(jc.getJavaClass());
+                    if (typeDesc != null) {
+                        xmlType = typeDesc.getXmlType();
+                        if (xmlType == null) {
+                            logger.warn(i18n.getMessage("typeDescNoXmlType",
+                                                        jc.getJavaClass()));
+                            continue;
+                        }
+                    } else {
+                        logger.warn(i18n.getMessage("noFaultTypeDesc",
+                                                    jc.getJavaClass()));
+                        continue;
+                    }
+                    // we could also set the fault.setXmlType()
+                }
+                faultMap.put(xmlType, fault);
+            }
+        }
+
+        // step 2: update xml element names for FaultDesc
+        // classes using the fault map generated in step 1
+        Map faults = operation.getFaults();
+        Iterator iter = faults.entrySet().iterator();
+        while(iter.hasNext()) {
+            Map.Entry entry = (Map.Entry)iter.next();
+            Fault fault = (Fault)entry.getValue();
+            Message message = fault.getMessage();
+            if (message == null) {
+                logger.warn(
+                 i18n.getMessage("noFaultMessage",
+                                 new Object[] { entry.getKey(),
+                                                serviceDesc.getName() })
+                );
+                continue;
+            }
+            Map parts = message.getParts();
+            if (parts == null || parts.size() != 1) {
+                logger.warn(
+                 i18n.getMessage("invalidFaultPart",
+                                 new Object[] { entry.getKey(),
+                                                serviceDesc.getName() })
+                );
+                continue;
+            }
+            Part part = (Part)parts.values().iterator().next();
+            QName elementQName = part.getElementName();
+            if (elementQName == null) {
+                logger.warn(
+                 i18n.getMessage("missingElementAttribute",
+                                 new Object[] { entry.getKey(),
+                                                serviceDesc.getName() })
+                );
+                continue;
+            }
+            TypeEntry elementTypeEntry =
+                table.getElement(elementQName);
+            if (elementTypeEntry == null) {
+                logger.warn(
+                 i18n.getMessage("missingElementFault",
+                                 new Object[] { entry.getKey(),
+                                                serviceDesc.getName() })
+                );
+                continue;
+            }
+            TypeEntry typeEntry =
+                elementTypeEntry.getRefType();
+            if (typeEntry == null) {
+                logger.warn(
+                 i18n.getMessage("missingTypeFault",
+                                 new Object[] { entry.getKey(),
+                                                serviceDesc.getName() })
+                );
+                continue;
+            }
+            QName typeQName = typeEntry.getQName();
+            if (typeQName == null) {
+                throw new Exception(i18n.getMessage("noTypeQName"));
+            }
+            FaultDesc faultDesc =
+                (FaultDesc)faultMap.get(typeQName);
+            if (faultDesc == null) {
+                logger.warn(
+                 i18n.getMessage("missingFault",
+                                 new Object[] { elementQName,
+                                                operationDesc.getName(),
+                                                serviceDesc.getName() })
+                );
+            } else {
+                logger.debug("Updated fault qname '" + elementQName +
+                             "' for operation '" + operationDesc.getName() +
+                             "'");
+                faultDesc.setQName(elementQName);
+            }
+        }
+    }
+
+    public static void updateWSDL(MessageContext ctx)
+        throws Exception {
+        updateWSDLSOAPAddress(ctx);
+        updateWSDLImport(ctx);
+    }
+
+    public static void updateWSDLImport(MessageContext ctx)
+        throws Exception {
+        Document doc = (Document)ctx.getProperty("WSDL");
+        if (doc == null) {
+            return;
+        }
+        SOAPService service = ctx.getService();
+        if (service == null) {
+            return;
+        }
+        ServiceDesc serviceDesc =
+            service.getInitializedServiceDesc(ctx);
+
+        String wsdlURL =
+            ContainerConfig.getExternalWebRoot(ctx) +
+            serviceDesc.getWSDLFile();
+
+        NodeList nodes =
+            doc.getElementsByTagNameNS(Constants.WSDL_NS, "import");
+
+        for (int i = 0; i < nodes.getLength(); i++) {
+            Element importElement = (Element) nodes.item(i);
+            String location = importElement.getAttribute("location");
+
+            if (location == null) {
+                throw new WSDLException(
+                           WSDLException.OTHER_ERROR,
+                           i18n.getMessage("noWSDLImportLocationError")
+                );
+            }
+
+            // fix relative imports
+            if (location.indexOf("://") == -1) {
+                String wsdlDir = wsdlURL.substring(0, wsdlURL.lastIndexOf("/"));
+                int subPath = location.indexOf("../");
+
+                while (subPath != -1) {
+                    location = location.substring(subPath + 3);
+                    wsdlDir = wsdlDir.substring(0, wsdlDir.lastIndexOf("/"));
+                    subPath = location.indexOf("../");
+                }
+
+                importElement.setAttribute("location",
+                                           wsdlDir + "/" + location);
+            }
+        }
+    }
+
+    public static void updateWSDLSOAPAddress(MessageContext ctx)
+        throws Exception {
+        Document doc = (Document)ctx.getProperty("WSDL");
+        if (doc == null) {
+            return;
+        }
+        NodeList nodes =
+            doc.getElementsByTagNameNS(Constants.WSDL_SOAP_NS, "address");
+
+        if (nodes.getLength() == 0) {
+            throw new WSDLException(WSDLException.OTHER_ERROR,
+                                    i18n.getMessage("noSOAPAddressError"));
+        }
+
+        AxisEngine engine = ctx.getAxisEngine();
+        ContainerConfig config = ContainerConfig.getConfig(engine);
+
+        String servicePath = ctx.getTargetService();
+
+        for (int i = 0; i < nodes.getLength(); i++) {
+            Element address = (Element) nodes.item(i);
+
+            URL url = new URL(ServiceHost.getProtocol(ctx),
+                              ServiceHost.getHost(ctx),
+                              ServiceHost.getPort(ctx),
+                              "/" + config.getWSRFLocation() + servicePath);
+
+            address.setAttribute("location", url.toExternalForm());
+        }
+    }
+
+    public static void updateAllowedMethods(MessageContext msgCtx,
+                                            SOAPService service,
+                                            ServiceDesc serviceDesc)
+        throws Exception {
+        List allowedOperations = null;
+
+        // allowed operation set already
+        if (serviceDesc.getAllowedMethods() != null) {
+            allowedOperations = serviceDesc.getAllowedMethods();
+        } else {
+            // null if the 'allowedMethods' parameter is set to '*'
+            if (service.getOption(JavaProvider.OPTION_ALLOWEDMETHODS) != null) {
+                return;
+            } else {
+                allowedOperations = getAllowedOperations(msgCtx,
+                                                         service,
+                                                         serviceDesc);
+                if (allowedOperations == null) {
+                    return;
+                }
+            }
+        }
+
+        List removedOperations = new ArrayList();
+        List operations = serviceDesc.getOperations();
+        Iterator iter = operations.iterator();
+        while(iter.hasNext()) {
+            OperationDesc operation = (OperationDesc)iter.next();
+            if (!allowedOperations.contains(operation.getName())) {
+                removedOperations.add(operation);
+                if (logger.isDebugEnabled()) {
+                    logger.debug("operation '" + operation.getName() +
+                                 "' disallowed for service '" +
+                                 service.getName() + "'");
+                }
+            } else {
+                if (logger.isDebugEnabled()) {
+                    logger.debug("operation '" + operation.getName() +
+                                 "' allowed for service '" +
+                                 service.getName() + "'");
+                }
+            }
+        }
+
+        iter = removedOperations.iterator();
+        while(iter.hasNext()) {
+            serviceDesc.removeOperationDesc((OperationDesc)iter.next());
+        }
+    }
+
+    protected static List getAllowedOperations(MessageContext msgCtx,
+                                               SOAPService service,
+                                               ServiceDesc serviceDesc)
+        throws Exception {
+        String allowedClass =
+            (String)service.getOption(ALLOWED_METHODS_CLASS);
+        if (allowedClass == null) {
+            return null;
+        }
+
+        AxisEngine engine = msgCtx.getAxisEngine();
+        ClassCache cache = engine.getClassCache();
+        ClassLoader cl = msgCtx.getClassLoader();
+        JavaClass jc = cache.lookup(allowedClass, cl);
+
+        List allowedOperations = new ArrayList();
+        Method[] methods = getMethods(jc.getJavaClass());
+        for (int i = 0; i < methods.length; i++) {
+            if (Modifier.isPublic(methods[i].getModifiers())) {
+                allowedOperations.add(methods[i].getName());
+            }
+        }
+
+        return allowedOperations;
+    }
+
+    protected static Method[] getMethods(Class clazz) {
+        if (clazz.isInterface()){
+            // Returns all methods incl inherited
+            return clazz.getMethods();
+        } else {
+            return clazz.getDeclaredMethods();
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/axis/handlers/HTTP11Handler.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/axis/handlers/HTTP11Handler.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/axis/handlers/HTTP11Handler.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,52 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.axis.handlers;
+
+import java.util.Hashtable;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.MessageContext;
+import org.apache.axis.handlers.BasicHandler;
+import org.apache.axis.transport.http.HTTPConstants;
+
+public class HTTP11Handler extends BasicHandler {
+
+    private static final Hashtable ENCODING_CHUNKED_HEADERS;
+
+    static {
+        ENCODING_CHUNKED_HEADERS = new Hashtable();
+        ENCODING_CHUNKED_HEADERS.put(
+                   HTTPConstants.HEADER_TRANSFER_ENCODING,
+                   HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED);
+    }
+
+    public void invoke(MessageContext msgCtx) throws AxisFault {
+        Object value =
+            msgCtx.getProperty(MessageContext.HTTP_TRANSPORT_VERSION);
+        if (value == null) {
+            msgCtx.setProperty(MessageContext.HTTP_TRANSPORT_VERSION,
+                               HTTPConstants.HEADER_PROTOCOL_V11);
+            Hashtable headers = 
+                (Hashtable)msgCtx.getProperty(HTTPConstants.REQUEST_HEADERS);
+            if (headers == null) {
+                msgCtx.setProperty(HTTPConstants.REQUEST_HEADERS,
+                                   ENCODING_CHUNKED_HEADERS);
+            }
+        }
+    }
+    
+}
+

Added: incubator/apollo/globus/core/source/src/org/globus/axis/handlers/ServiceDescHandler.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/axis/handlers/ServiceDescHandler.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/axis/handlers/ServiceDescHandler.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,35 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.axis.handlers;
+
+import org.globus.axis.description.ServiceDescUtil;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.MessageContext;
+import org.apache.axis.handlers.BasicHandler;
+
+public class ServiceDescHandler extends BasicHandler {
+
+    public void invoke(MessageContext messageContext) throws AxisFault {
+        try {
+            ServiceDescUtil.initializeService(messageContext);
+        } catch (Exception e) {
+            throw AxisFault.makeFault(e);
+        }
+    }
+    
+}
+

Added: incubator/apollo/globus/core/source/src/org/globus/axis/providers/PrivilegedInvokeMethodAction.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/axis/providers/PrivilegedInvokeMethodAction.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/axis/providers/PrivilegedInvokeMethodAction.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.axis.providers;
+
+import org.apache.axis.MessageContext;
+
+import java.lang.reflect.Method;
+
+import java.security.PrivilegedExceptionAction;
+
+class PrivilegedInvokeMethodAction implements PrivilegedExceptionAction {
+
+    private RPCProvider provider;
+    private MessageContext msgContext;
+    private Method method;
+    private Object obj;
+    private Object[] argValues;
+
+    public PrivilegedInvokeMethodAction(
+        RPCProvider provider,
+        MessageContext msgContext,
+        Method method,
+        Object obj,
+        Object[] argValues
+    ) {
+        this.provider = provider;
+        this.msgContext = msgContext;
+        this.method = method;
+        this.obj = obj;
+        this.argValues = argValues;
+    }
+
+    public Object run() throws Exception {
+	return this.provider.invokeMethodSub(this.msgContext, this.method, 
+					     this.obj,
+					     this.argValues);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/axis/providers/RPCProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/axis/providers/RPCProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/axis/providers/RPCProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,129 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.axis.providers;
+
+import java.util.Map;
+
+import javax.xml.rpc.holders.IntHolder;
+import javax.xml.rpc.server.ServiceLifecycle;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.Handler;
+import org.apache.axis.MessageContext;
+import org.apache.axis.description.OperationDesc;
+import org.apache.axis.enum.Scope;
+
+import java.lang.reflect.Method;
+
+import javax.security.auth.Subject;
+
+import org.globus.gsi.jaas.JaasSubject;
+
+import org.globus.axis.description.ServiceDescUtil;
+
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+
+import org.globus.wsrf.impl.security.authentication.Constants;
+
+public class RPCProvider extends org.apache.axis.providers.java.RPCProvider {
+
+    private static Log logger =
+        LogFactory.getLog(RPCProvider.class.getName());
+
+    /**
+     */
+    public Object getServiceObject (MessageContext msgContext,
+                                    Handler service,
+                                    String clsName,
+                                    IntHolder scopeHolder)
+        throws Exception {
+        Map mapping = (Map)service.getOption(ServiceDescUtil.PROVIDER_MAPPING);
+        if (mapping == null) {
+            return super.getServiceObject(msgContext, service,
+                                          clsName, scopeHolder);
+        }
+        OperationDesc operation = msgContext.getOperation();
+        if (operation == null) {
+            return super.getServiceObject(msgContext, service,
+                                          clsName, scopeHolder);
+        }
+        Object provider = mapping.get(operation);
+        if (provider == null) {
+            return super.getServiceObject(msgContext, service,
+                                          clsName, scopeHolder);
+        }
+        if (logger.isDebugEnabled()) {
+            logger.debug("Invoking '" + operation.getName() +
+                         "' operation on " + provider);
+        }
+
+        Scope scope = Scope.getScope((String)service.getOption(OPTION_SCOPE),
+                                     Scope.DEFAULT);
+        scopeHolder.value = scope.getValue();
+        if (scope == Scope.APPLICATION) {
+            return provider;
+        } else {
+            // must be REQUEST scope
+            return getNewServiceInstance(msgContext, (Class)provider);
+        }
+    }
+
+    protected Object invokeMethod(MessageContext msgContext, Method method,
+                                  Object obj, Object[] argValues)
+        throws Exception {
+
+        Subject subject =
+            (Subject) msgContext.getProperty(Constants.INVOCATION_SUBJECT);
+
+        if (subject == null) {
+            return invokeMethodSub(msgContext, method, obj, argValues);
+        } else {
+            PrivilegedExceptionAction action =
+                new PrivilegedInvokeMethodAction(this, msgContext, method, obj,
+                                                 argValues);
+
+            try {
+                return JaasSubject.doAs(subject, action);
+            } catch (PrivilegedActionException e) {
+                throw e.getException();
+            }
+        }
+    }
+
+    protected Object invokeMethodSub(MessageContext msgContext, Method method,
+                                     Object obj, Object[] argValues)
+        throws Exception {
+        return super.invokeMethod(msgContext, method, obj, argValues);
+    }
+
+    
+    public static Object getNewServiceInstance(MessageContext msgCtx,
+                                               Class serviceClass)
+        throws Exception {
+        // this should match what's done in JavaProvider.getNewServiceObject()
+        Object service = serviceClass.newInstance();
+        if (service instanceof ServiceLifecycle) {
+            Object ctx = msgCtx.getProperty(
+                org.apache.axis.Constants.MC_SERVLET_ENDPOINT_CONTEXT);
+            ((ServiceLifecycle)service).init(ctx);
+        }
+        return service;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/axis/transport/local/LocalRequester.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/axis/transport/local/LocalRequester.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/axis/transport/local/LocalRequester.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,37 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.axis.transport.local;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.MessageContext;
+import org.apache.axis.handlers.BasicHandler;
+
+/**
+ * This handler is used only with "local" transport. 
+ * It resets the target service set by the LocalSender
+ * so that AddressingHandler and URLHandler can set the 
+ * service appropriately.
+ */
+public class LocalRequester extends BasicHandler {
+    
+    public void invoke(MessageContext msgCtx) throws AxisFault {
+        // reset it becuase LocalSender will set it no matter what
+        msgCtx.setTargetService(null);
+        LocalTransportUtils.restoreProperties(msgCtx);
+    }
+    
+}
+

Added: incubator/apollo/globus/core/source/src/org/globus/axis/transport/local/LocalTransportUtils.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/axis/transport/local/LocalTransportUtils.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/axis/transport/local/LocalTransportUtils.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,119 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.axis.transport.local;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.axis.Constants;
+import org.apache.axis.AxisEngine;
+import org.apache.axis.MessageContext;
+import org.apache.axis.client.Call;
+import org.apache.axis.transport.local.LocalTransport;
+import org.apache.axis.session.Session;
+
+import javax.xml.rpc.Stub;
+
+/**
+ * Utility methods for local invocations.
+ */
+public class LocalTransportUtils {
+    
+    private static final String PROPERTIES = 
+        "contextProperties";
+    
+    private static final String [] PROPS = 
+    {Constants.MC_CONFIGPATH, Constants.MC_HOME_DIR};
+    
+    static {
+        Call.addTransportPackage("org.apache.axis.transport");
+    }
+    
+    /**
+     * Initializes the local transport support.
+     */
+    public static void init() {}
+
+    /**
+     * Configures the stub for proper local invocation.
+     * A MessageContext must be associated with the current
+     * thread.
+     *
+     * @param stub the stub to configure for local invocation.
+     * @return true if stub was successfully configured for
+     *         local invocation. False otherwise.
+     */
+    public static boolean enableLocalTransport(Stub stub) {
+        MessageContext ctx = MessageContext.getCurrentContext();
+        if (ctx == null) {
+            return false;
+        }
+        if (!storeProperties(ctx)) {
+            return false;
+        }
+        AxisEngine engine = ctx.getAxisEngine();
+        stub._setProperty(LocalTransport.LOCAL_SERVER,
+                          engine);
+        return true;
+    }
+    
+    static boolean storeProperties(MessageContext ctx) {
+        if (ctx == null) {
+            throw new IllegalArgumentException();
+        }
+        Map savedProps = new HashMap();
+        Object value = null;
+        for (int i=0;i<PROPS.length;i++) {
+            value = ctx.getProperty(PROPS[i]);
+            if (value != null) {
+                savedProps.put(PROPS[i], value);
+            }
+        }
+        AxisEngine engine = ctx.getAxisEngine();
+        Session session = engine.getApplicationSession();
+        if (session == null) {
+            return false;
+        } 
+        session.set(PROPERTIES, savedProps);
+        return true;
+    }
+
+    static boolean restoreProperties(MessageContext ctx) {
+        if (ctx == null) {
+            throw new IllegalArgumentException();
+        }
+        AxisEngine engine = ctx.getAxisEngine();
+        Session session = engine.getApplicationSession();
+        if (session == null) {
+            return false;
+        }
+        Map savedProps = (Map)session.get(PROPERTIES);
+        if (savedProps == null) {
+            return false;
+        }
+        Iterator iter = savedProps.entrySet().iterator();
+        while(iter.hasNext()) {
+            Map.Entry entry = (Map.Entry)iter.next();
+            ctx.setProperty((String)entry.getKey(),
+                            entry.getValue());
+        }
+        session.remove(PROPERTIES);
+        return true;
+    }
+    
+}
+

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/Constants.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/Constants.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/Constants.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,102 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Implementation specific constants. The NS
+ * constants point to the currently supported namespace versions.
+ */
+public class Constants
+{
+
+    public static final String WSDL_NS = 
+        "http://schemas.xmlsoap.org/wsdl/";
+    public static final String WSDL_SOAP_NS =
+        "http://schemas.xmlsoap.org/wsdl/soap/";
+    public static final String XSD_NS =
+        "http://www.w3.org/2001/XMLSchema";
+    public static final String XSI_NS =
+        "http://www.w3.org/2001/XMLSchema-instance";
+
+    public static final String CONTAINER_PROPERTY =
+        "org.globus.wsrf.container";
+    public static final String DEFAULT_WSRF_LOCATION =
+        "wsrf/services/";
+    public static final QName ANY =
+        org.apache.axis.Constants.XSD_ANY;
+    public static final String CORE_NS =
+        "http://www.globus.org/namespaces/2004/06/core";
+
+   /**
+     * JNDI base path
+     */
+    public static final String JNDI_BASE_NAME =
+        "java:comp/env/";
+
+    /**
+     * JNDI services base path
+     */
+    public static final String JNDI_SERVICES_BASE_NAME =
+        JNDI_BASE_NAME + "/services/";
+
+    /**
+     * JNDI path to entry containing the name of the default subscription
+     * manager service
+     */
+    public static final String SUBSCRIPTION_MANAGER_SERVICE_NAME =
+        "SubscriptionManagerService";
+
+    /**
+     * JNDI path to entry containing the name of the default notification
+     * consumer service
+     */
+    public static final String NOTIFICATION_CONSUMER_SERVICE_NAME =
+        "NotificationConsumerService";
+
+    /**
+     * JNDI path appended to JNDI service path when looking up the service's
+     * resource home
+     */
+    public static final String HOME_NAME =
+        "/home";
+
+    /**
+     * JNDI path to the default work manager
+     */
+    public static final String DEFAULT_WORK_MANAGER =
+        JNDI_BASE_NAME + "/wm/ContainerWorkManager";
+
+    /**
+     * JNDI path to the default timer manager
+     */
+    public static final String DEFAULT_TIMER =
+        JNDI_BASE_NAME + "/timer/ContainerTimer";
+
+    /**
+     * JNDI path to the default query engine
+     */
+    public static final String DEFAULT_QUERY_ENGINE =
+        JNDI_BASE_NAME + "/query/ContainerQueryEngine";
+
+    /**
+     * JNDI path to the default topic expression engine
+     */
+    public static final String DEFAULT_TOPIC_EXPRESSION_ENGINE =
+        JNDI_BASE_NAME + "/topic/ContainerTopicExpressionEngine";
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/InvalidResourceKeyException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/InvalidResourceKeyException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/InvalidResourceKeyException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+/**
+ * This exception is raised if the {@link ResourceKey ResourceKey} is in
+ * any way invalid.
+ */
+public class InvalidResourceKeyException extends ResourceException {
+    
+    public InvalidResourceKeyException() {
+    }
+    
+    public InvalidResourceKeyException(String message) {
+        super(message);
+    }
+    
+    public InvalidResourceKeyException(String message,
+                                       Throwable ex) {
+        super(message, ex);
+    }
+    
+    public InvalidResourceKeyException(Throwable ex) {
+        super(ex);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/NoResourceHomeException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/NoResourceHomeException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/NoResourceHomeException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,61 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+/**
+ * This is a basic exception raised by {@link ResourceContext ResourceContext}
+ * operations in cases where a ResourceHome is not configured for a given
+ * service.
+ */
+public class NoResourceHomeException extends ResourceContextException {
+
+    /**
+     * Creates a NoResourceHomeException without error message.
+     */
+    public NoResourceHomeException() {
+    }
+    
+    /**
+     * Creates a NoResourceHomeException with a given error message.
+     *
+     * @param message error message
+     */
+    public NoResourceHomeException(String message) {
+        super(message);
+    }
+    
+    /**
+     * Creates a NoResourceHomeException with a given error message and nested
+     * exception.
+     *
+     * @param message error message
+     * @param exception nested exception/
+     */
+    public NoResourceHomeException(String message,
+                                   Throwable exception) {
+        super(message, exception);
+    }
+    
+    /**
+     * Creates a NoResourceHomeException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public NoResourceHomeException(Throwable exception) {
+        super("", exception);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/NoSuchResourceException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/NoSuchResourceException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/NoSuchResourceException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+/**
+ * This exception is raised when a resource for a given key is not found.
+ * Usually raised by {@link ResourceHome ResourceHome} operations.
+ */
+public class NoSuchResourceException extends ResourceException {
+    
+    public NoSuchResourceException() {
+    }
+    
+    public NoSuchResourceException(String message) {
+        super(message);
+    }
+    
+    public NoSuchResourceException(String message,
+                                   Throwable ex) {
+        super(message, ex);
+    }
+    
+    public NoSuchResourceException(Throwable ex) {
+        super(ex);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/NotificationConsumerCallbackManager.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/NotificationConsumerCallbackManager.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/NotificationConsumerCallbackManager.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,45 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import java.util.List;
+
+/**
+ * Interface to be implemented by a notification consumer resource.
+ */
+public interface NotificationConsumerCallbackManager extends Resource
+{
+    /**
+     * Register a notification callback
+     *
+     * @param topicPath The topic path for which this callback should be called.
+     *                  May be null, in which case the callback is called for
+     *                  notification messages for which no other callback is
+     *                  registered
+     * @param callback  The notification callback
+     * @see NotifyCallback
+     */
+    public void registerCallback(List topicPath, NotifyCallback callback);
+
+    /**
+     * Get the notification callback for the supplied topic path
+     *
+     * @param topicPath The topic path. A null topic path will return the
+     *                  default callback.
+     * @return The notification callback
+     */
+    public NotifyCallback getCallback(List topicPath);
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/NotificationConsumerManager.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/NotificationConsumerManager.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/NotificationConsumerManager.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,355 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.MessageContext;
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.axis.message.addressing.ReferencePropertiesType;
+import org.apache.axis.server.AxisServer;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.container.ContainerException;
+import org.globus.wsrf.impl.SimpleResourceKey;
+import org.globus.wsrf.impl.notification.ClientNotificationConsumerManager;
+import org.globus.wsrf.impl.notification.NotificationConsumerHome;
+import org.globus.wsrf.impl.notification.ServerNotificationConsumerManager;
+import org.globus.wsrf.impl.security.descriptor.ResourceSecurityDescriptor;
+import org.globus.wsrf.utils.AddressingUtils;
+import org.globus.wsrf.utils.Resources;
+
+public abstract class NotificationConsumerManager {
+
+    private static Log logger =
+        LogFactory.getLog(NotificationConsumerManager.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    protected NotificationConsumerHome notificationConsumerHome;
+
+    protected NotificationConsumerManager() {
+    }
+
+    /**
+     * Returns an instance of <code>NotificationConsumerManager</code>.
+     */
+    public synchronized static NotificationConsumerManager getInstance() {
+        MessageContext ctx = MessageContext.getCurrentContext();
+        if (ctx != null &&
+            ctx.getProperty(MessageContext.TRANS_URL) != null &&
+            ctx.getAxisEngine() instanceof AxisServer) {
+            return new ServerNotificationConsumerManager();
+        } else {
+            return new ClientNotificationConsumerManager();
+        }
+    }
+
+    /**
+     * Returns an instance of <code>NotificationConsumerManager</code>.
+     */
+    public synchronized static NotificationConsumerManager getInstance(
+        Map properties) {
+        MessageContext ctx = MessageContext.getCurrentContext();
+        if (ctx != null &&
+            ctx.getProperty(MessageContext.TRANS_URL) != null &&
+            ctx.getAxisEngine() instanceof AxisServer) {
+            // Ignoring properties on the server side,
+            // maybe throw exception instead?
+            return new ServerNotificationConsumerManager();
+        } else {
+            return new ClientNotificationConsumerManager(properties);
+        }
+    }
+
+    protected void initializeConsumerHome() throws ContainerException {
+        try {
+            Context initialContext = new InitialContext();
+            this.notificationConsumerHome =
+            (NotificationConsumerHome) initialContext.lookup(
+                Constants.JNDI_SERVICES_BASE_NAME +
+                getNotificationConsumerServiceName() +
+                Constants.HOME_NAME
+            );
+        } catch(NamingException e) {
+            throw new ContainerException(
+                i18n.getMessage("notificationConsumerHomeLookupFailure"), e);
+        }
+    }
+
+    /**
+     * Start the notification consumer service
+     *
+     * @throws ContainerException
+     */
+    public abstract void startListening() throws ContainerException;
+
+    /**
+     * Stop the notification consumer service
+     *
+     * @throws ContainerException
+     */
+    public abstract void stopListening() throws ContainerException;
+
+    /**
+     * Is the notification consumer service started?
+     *
+     * @return True if the notification consumer serivce is running, false if
+     *         not
+     */
+    public abstract boolean isListening();
+
+    /**
+     * Returns the base URL of the container in which the notification
+     * consumer service is running in.
+     *
+     * @return the base URL of the container running the notification
+     *         consumer service.
+     */
+    public abstract URL getURL();
+
+    /**
+     * Create a notification consumer resource with the given callbacks. Note
+     * that this method requires that the notification consumer is listening.
+     *
+     * @param topicPaths A array of concrete topic paths
+     * @param callbacks  A array of callbacks corresponding to the topics in the
+     *                   topic path array. A individual callback will be called
+     *                   when the notification consumer services receives a
+     *                   notification message on the topic corresponding to the
+     *                   callback.
+     * @return The endpoint reference of the created notification consumer
+     *         resource
+     * @throws ResourceException
+     */
+    public EndpointReferenceType createNotificationConsumer(
+        List[] topicPaths,
+        NotifyCallback[] callbacks)
+        throws ResourceException {
+        return createNotificationConsumer(topicPaths, callbacks, null);
+    }
+
+    /**
+     * Create a notification consumer resource with the given parameters. Note
+     * that this method requires that the notification consumer is listening.
+     *
+     * @param topicPaths A array of concrete topic paths
+     * @param callbacks  A array of callbacks corresponding to the topics in the
+     *                   topic path array. A individual callback will be called
+     *                   when the notification consumer services receives a
+     *                   notification message on the topic corresponding to the
+     *                   callback.
+     * @param desc       The resource security descriptor to set on the created
+     *                   notification consumer resource.
+     * @return The endpoint reference of the created notification consumer
+     *         resource
+     * @throws ResourceException
+     */
+    public EndpointReferenceType createNotificationConsumer(
+        List[] topicPaths,
+        NotifyCallback[] callbacks,
+        ResourceSecurityDescriptor desc)
+        throws ResourceException {
+        if((topicPaths == null && callbacks != null) ||
+           (topicPaths != null && callbacks == null) ||
+           (topicPaths != null && callbacks != null &&
+            topicPaths.length != callbacks.length)) {
+                throw new IllegalArgumentException(
+                    i18n.getMessage("notificationConsumerArgumentMismatch"));
+            }
+
+        if (isListening() == false) {
+            //TODO: typed exception for this?
+            throw new ResourceException(
+                i18n.getMessage("notificationConsumerNotListening"));
+        }
+
+        ResourceKey key = this.notificationConsumerHome.create(desc);
+        EndpointReferenceType epr = null;
+        NotificationConsumerCallbackManager manager = null;
+
+        try {
+            String address = getURL().toString() +
+                             getNotificationConsumerServiceName();
+            epr = AddressingUtils.createEndpointReference(address,
+                                                          key);
+            manager = (NotificationConsumerCallbackManager)
+                this.notificationConsumerHome.find(key);
+        } catch (ResourceException e) {
+            throw e;
+        } catch(Exception e) {
+            throw new ResourceException("", e);
+        }
+
+        if(topicPaths != null) {
+            for(int i = 0; i < callbacks.length; i++) {
+                manager.registerCallback(topicPaths[i], callbacks[i]);
+            }
+        }
+
+        return epr;
+    }
+
+    /**
+     * Create a notification consumer resource with the given callback. Note
+     * that this method requires that the notification consumer is listening.
+     *
+     * @param callback The callback to be called for incoming notifications
+     * @return The endpoint reference of the created notification consumer
+     *         resource
+     * @throws ResourceException
+     */
+    public EndpointReferenceType createNotificationConsumer(
+        NotifyCallback callback) throws ResourceException {
+        return createNotificationConsumer(callback, null);
+    }
+
+    /**
+     * Create a notification consumer resource with the given callback. Note
+     * that this method requires that the notification consumer is listening.
+     *
+     * @param callback The callback to call upon receipt of a notification on
+     *                 the aboce topic
+     * @param desc     The resource security descriptor to set on the created
+     *                 notification consumer resource.
+     * @return The endpoint reference of the created notification consumer
+     *         resource
+     * @throws ResourceException
+     */
+    public EndpointReferenceType createNotificationConsumer(
+        NotifyCallback callback, ResourceSecurityDescriptor desc)
+        throws ResourceException {
+        return createNotificationConsumer(new List[]{null},
+                                          new NotifyCallback[]{callback},
+                                          desc);
+    }
+
+
+
+    /**
+     * Create a notification consumer resource with the given callback. Note
+     * that this method requires that the notification consumer is listening.
+     *
+     * @param topicPath The concrete topic for which the callback will be
+     *                  called
+     * @param callback  The callback to call upon receipt of a notification on
+     *                  the aboce topic
+     * @return The endpoint reference of the created notification consumer
+     *         resource
+     * @throws ResourceException
+     */
+    public EndpointReferenceType createNotificationConsumer(
+        List topicPath, NotifyCallback callback) throws ResourceException {
+        return createNotificationConsumer(topicPath, callback, null);
+    }
+
+    /**
+     * Create a notification consumer resource with the given callback. Note
+     * that this method requires that the notification consumer is listening.
+     *
+     * @param topicPath The concrete topic for which the callback will be
+     *                  called
+     * @param callback  The callback to call upon receipt of a notification on
+     *                  the aboce topic
+     * @param desc      The resource security descriptor to set on the created
+     *                  notification consumer resource.
+     * @return The endpoint reference of the created notification consumer
+     *         resource
+     * @throws ResourceException
+     */
+    public EndpointReferenceType createNotificationConsumer(
+        List topicPath, NotifyCallback callback,
+        ResourceSecurityDescriptor desc) throws ResourceException {
+        return createNotificationConsumer(new List[]{topicPath},
+                                          new NotifyCallback[]{callback},
+                                          desc);
+    }
+
+    /**
+     * Create a notification consumer resource with no registered callbacks
+     * (incoming notifications will be ignored unless you manually register
+     * callbacks). Note that this method requires that the notification consumer
+     * is listening.
+     *
+     * @return The endpoint reference of the created notification consumer
+     *         resource
+     * @throws ResourceException
+     */
+    public EndpointReferenceType createNotificationConsumer()
+        throws ResourceException {
+        return createNotificationConsumer((List[]) null, null);
+    }
+
+    private ResourceKey getKey(
+        EndpointReferenceType consumerEndpointReference)
+        throws InvalidResourceKeyException {
+        ReferencePropertiesType referenceProperties =
+            consumerEndpointReference.getProperties();
+        return new SimpleResourceKey(
+            referenceProperties.get_any()[0],
+            this.notificationConsumerHome.getKeyTypeClass()
+        );
+    }
+
+    /**
+     * Get the callback manager for a given notification consumer endpoint
+     * reference
+     *
+     * @param consumerEndpointReference The EPR for which to retrieve the
+     *                                  callback manager
+     * @return The callback manager
+     */
+    public NotificationConsumerCallbackManager
+        getNotificationConsumerCallbackManager(
+        EndpointReferenceType consumerEndpointReference)
+        throws ResourceException {
+        ResourceKey key = getKey(consumerEndpointReference);
+        return (NotificationConsumerCallbackManager)
+            this.notificationConsumerHome.find(key);
+    }
+
+    /**
+     * Destroy a notification consumer resource
+     *
+     * @param consumerEndpointReference The endpoint reference of the resource
+     *                                  to remove
+     */
+    public void removeNotificationConsumer(
+        EndpointReferenceType consumerEndpointReference)
+        throws ResourceException {
+        ResourceKey key = getKey(consumerEndpointReference);
+        this.notificationConsumerHome.remove(key);
+    }
+
+    /**
+     * Get the name of the default notification consumer service
+     *
+     * @return The name of the default notification consumer service
+     */
+    protected String getNotificationConsumerServiceName() {
+        return Constants.NOTIFICATION_CONSUMER_SERVICE_NAME;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/NotifyCallback.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/NotifyCallback.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/NotifyCallback.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import java.util.List;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+/**
+ * Interface that is required to be implemented by callbacks registered with the
+ * notification consumer implementation.
+ */
+public interface NotifyCallback
+{
+    /**
+     * Deliver the notification message
+     *
+     * @param topicPath The topic path for the topic that generated the
+     *                  notification
+     * @param producer  The producer endpoint reference
+     * @param message   The notification message
+     */
+    public void deliver(
+        List topicPath,
+        EndpointReferenceType producer,
+        Object message);
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/PersistenceCallback.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/PersistenceCallback.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/PersistenceCallback.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+/**
+ * Defines callback operations for persistence operations. These operations
+ * will be invoked when used with
+ * {@link org.globus.wsrf.impl.ResourceHomeImpl ResourceHomeImpl}.
+ * Currently, the <code>ResourceHomeImpl</code> will only invoke the
+ * {@link #load(ResourceKey) load()} function automatically.
+ * The resource implementation itself is responsible for calling
+ * {@link #store() store()} function to synchronize its state on disk.
+ */
+public interface PersistenceCallback {
+
+    /**
+     * Loads the resource state.
+     *
+     * @throws NoSuchResourceException if no resource state exists for the
+     *         specified key.
+     * @throws InvalidResourceKeyException if the resource key is invalid.
+     * @throws ResourceException if the load operation fails for any other
+     *         reason.
+     */
+    void load(ResourceKey key)
+        throws ResourceException,
+               NoSuchResourceException,
+               InvalidResourceKeyException;
+
+    /**
+     * Saves the resource state.
+     *
+     * @throws ResourceException if the store operation fails.
+     */
+    void store()
+        throws ResourceException;
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/PersistentResource.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/PersistentResource.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/PersistentResource.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,27 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+/**
+ * Defines general purpose interface for persistent resources. 
+ *
+ * @see ResourceIdentifier
+ * @see PersistenceCallback
+ * @see RemoveCallback
+ */
+public interface PersistentResource
+    extends Resource, ResourceIdentifier, PersistenceCallback, RemoveCallback {
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/RemoveCallback.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/RemoveCallback.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/RemoveCallback.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,36 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+/**
+ * Defines a callback operation that is invoked whenever a resource is removed
+ * from {@link ResourceHome ResourceHome}. This is an optional callback 
+ * and the resource does need to implement this function if it does not wish
+ * to be notified when the resource is removed.
+ */
+public interface RemoveCallback {
+    
+    /**
+     * Notifies that the resource was removed. This function must not be
+     * called directly on the resource object. Only 
+     * {@link ResourceHome#remove(ResourceKey) ResourceHome.remove()} is 
+     * allowed to call that method during the remove operation.
+     *
+     * @throws ResourceException if the remove operation fails.
+     */
+    void remove() throws ResourceException;
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/RemoveNotSupportedException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/RemoveNotSupportedException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/RemoveNotSupportedException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+/**
+ * This exception is raised when a {@link ResourceHome ResourceHome} 
+ * implementation does not support removal of resources.
+ */
+public class RemoveNotSupportedException extends ResourceException {
+    
+    public RemoveNotSupportedException() {
+    }
+    
+    public RemoveNotSupportedException(String message) {
+        super(message);
+    }
+    
+    public RemoveNotSupportedException(String message,
+                                       Throwable ex) {
+        super(message, ex);
+    }
+    
+    public RemoveNotSupportedException(Throwable ex) {
+        super(ex);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/Resource.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/Resource.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/Resource.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,23 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+/**
+ * A marker interface for a resource. All resources objects must implement this 
+ * interface.
+ */
+public interface Resource {
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceContext.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceContext.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceContext.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,167 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import java.util.Iterator;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPHeaderElement;
+
+/**
+ * <code>ResourceContext</code> wraps around a {@link SOAPMessageContext
+ * SOAPMessageContext} and provides convenience functions for obtaining
+ * {@link ResourceKey ResourceKey}, {@link ResourceHome ResourceHome},
+ * and resource objects associated with the given SOAP message (referenced
+ * in <code>SOAPMessageContext</code>).
+ */
+public abstract class ResourceContext {
+
+    protected ResourceContext() {}
+
+    /**
+     * Returns <code>ResourceContext</code> associated with the current thread.
+     *
+     * @return <code>ResourceContext</code> associated with the current thread.
+     */
+    public static ResourceContext getResourceContext()
+        throws ResourceContextException {
+        return new org.globus.wsrf.impl.ResourceContextImpl();
+    }
+
+    /**
+     * Returns <code>ResourceContext</code> initialized with a specific
+     * <code>SOAPMessageContext</code>.
+     *
+     * @return <code>ResourceContext</code> initialized with a specific
+     *         <code>SOAPMessageContext</code>.
+     */
+    public static ResourceContext getResourceContext(SOAPMessageContext ctx)
+        throws ResourceContextException {
+        return new org.globus.wsrf.impl.ResourceContextImpl(ctx);
+    }
+
+    /**
+     * Gets <code>ResourceKey</code> instance using <code>ResourceHome</code>
+     * lookup.
+     *
+     * @return <code>ResourceKey</code> of name and type associated with the
+     *         target service' <code>ResourceHome</code>. Returns null if key
+     *         is not found in the message.
+     * @throws ResourceContextException if error occurs during lookup.
+     * @see #getResourceHome()
+     */
+    public abstract ResourceKey getResourceKey()
+        throws ResourceContextException;
+
+    /**
+     * Gets <code>ResourceKey</code> of a given name and type.
+     *
+     * @return <code>ResourceKey</code> of the given type and name. Returns
+     *         null if the key of the specified name was not found in the
+     *         message.
+     * @throws ResourceContextException if error occurs during lookup.
+     */
+    public abstract ResourceKey getResourceKey(QName keyName, Class keyClass)
+        throws ResourceContextException;
+
+    /**
+     * Gets <code>SOAPHeaderElement</code> that contains the resource key
+     * for the service using <code>ResourceHome</code> lookup.
+     *
+     * @return The <code>SOAPHeaderElement</code> that contains the resource
+     *         key for the service. Returns null if one not found.
+     * @throws ResourceContextException if error occurs during lookup.
+     * @see #getResourceHome()
+     */
+    public abstract SOAPHeaderElement getResourceKeyHeader()
+        throws ResourceContextException;
+
+    /**
+     * Gets <code>SOAPHeaderElement</code> of the specified name that contains
+     * the resource key.
+     *
+     * @return The <code>SOAPHeaderElement</code> that contains the resource
+     *         key of the given name. Returns null if one not found.
+     * @throws ResourceContextException if error occurs during lookup.
+     */
+    public abstract SOAPHeaderElement getResourceKeyHeader(QName keyName)
+        throws ResourceContextException;
+
+    /**
+     * Gets <code>ResourceHome</code> associated with the service.
+     *
+     * @return <code>ResourceHome</code> associated with the service. Cannot be
+     *         null.
+     * @throws NoResourceHomeException if <code>ResourceHome</code> is not
+     *         configured for the specified service.
+     * @throws ResourceContextException if any other error.
+     */
+    public abstract ResourceHome getResourceHome()
+        throws ResourceContextException, NoResourceHomeException;
+
+    /**
+     * Gets path of the service.
+     *
+     * @return The path of the service.
+     */
+    public abstract String getService();
+
+    /**
+     * Gets the full URL of the service
+     *
+     * @return The URL of the service
+     */
+    public abstract URL getServiceURL();
+
+    /**
+     * Gets actual resource.
+     *
+     * @return The actual resource object. Cannot be null.
+     * @throws NoSuchResourceException if resource
+     *         was not specified in the request or it does not exist.
+     * @throws ResourceContextException if error occurs during resource lookup.
+     */
+    public abstract Resource getResource()
+        throws ResourceContextException, ResourceException;
+
+    /**
+     * @see SOAPMessageContext#containsProperty(String)
+     */
+    public abstract boolean containsProperty(String name);
+
+    /**
+     * @see SOAPMessageContext#getProperty(String)
+     */
+    public abstract Object getProperty(String name);
+
+    /**
+     * @see SOAPMessageContext#removeProperty(String)
+     */
+    public abstract void removeProperty(String name);
+
+    /**
+     * @see SOAPMessageContext#setProperty(String, Object)
+     */
+    public abstract void setProperty(String name, Object value);
+
+    /**
+     * @see SOAPMessageContext#getPropertyNames()
+     */
+    public abstract Iterator getPropertyNames();
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceContextException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceContextException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceContextException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,62 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import java.rmi.RemoteException;
+
+/**
+ * This is a basic exception raised by {@link ResourceContext ResourceContext}
+ * operations.
+ */
+public class ResourceContextException extends RemoteException {
+
+    /**
+     * Creates a ResourceContextException without error message.
+     */
+    public ResourceContextException() {
+    }
+    
+    /**
+     * Creates a ResourceContextException with a given error message.
+     *
+     * @param message error message
+     */
+    public ResourceContextException(String message) {
+        super(message);
+    }
+    
+    /**
+     * Creates a ResourceContextException with a given error message and nested
+     * exception.
+     *
+     * @param message error message
+     * @param exception nested exception/
+     */
+    public ResourceContextException(String message,
+                                    Throwable exception) {
+        super(message, exception);
+    }
+    
+    /**
+     * Creates a ResourceContextException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public ResourceContextException(Throwable exception) {
+        super("", exception);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,62 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import java.rmi.RemoteException;
+
+/**
+ * This is a basic exception raised by resources or 
+ * {@link ResourceHome ResourceHome} operations.
+ */
+public class ResourceException extends RemoteException {
+
+    /**
+     * Creates a ResourceException without error message.
+     */
+    public ResourceException() {
+    }
+    
+    /**
+     * Creates a ResourceException with a given error message.
+     *
+     * @param message error message
+     */
+    public ResourceException(String message) {
+        super(message);
+    }
+    
+    /**
+     * Creates a ResourceException with a given error message and nested
+     * exception.
+     *
+     * @param message error message
+     * @param exception nested exception/
+     */
+    public ResourceException(String message,
+                             Throwable exception) {
+        super(message, exception);
+    }
+    
+    /**
+     * Creates a ResourceException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public ResourceException(Throwable exception) {
+        super("", exception);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,82 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Defines a basic interface through which resources are discovered, and 
+ * removed. The purpose of <code>ResourceHome</code> is to interact
+ * with a collection of resources of the same type. Each resource type will
+ * have its own custom implementation the <code>ResourceHome</code> interface.
+ * The implementation is expected to provide custom methods for creating
+ * new resources and optionally methods that act on a set of resource objects.
+ */
+public interface ResourceHome {
+
+    /**
+     * The resource key type. The <code>ResourceKey</code> used or 
+     * passed to this <code>ResourceHome</code> must have match this type
+     * (corresponds to {@link ResourceKey#getValue() ResourceKey.getValue()}).
+     *
+     * @return the type of the key.
+     */
+    Class getKeyTypeClass();
+    
+    /**
+     * The name of the resource key. The <code>ResourceKey</code> used or 
+     * passed to this <code>ResourceHome</code> must have match this name 
+     * (corresponds to {@link ResourceKey#getName() ResourceKey.getName()}).
+     *
+     * @return the name of the key.
+     */
+    QName getKeyTypeName();
+    
+    /**
+     * Retrives a resource.
+     * <b>Note:</b> This function must not return null. It must return the 
+     * resource object or throw an exception if there is no resource with the
+     * specified key.
+     *
+     * @throws NoSuchResourceException if no resource exists with the given key
+     * @throws InvalidResourceKeyException if the resource key is invalid.
+     * @throws ResourceException if any other error occurs.
+     * @return non-null resource object.
+     */
+    Resource find(ResourceKey key) 
+        throws ResourceException,
+               NoSuchResourceException,
+               InvalidResourceKeyException;
+    
+    /**
+     * Removes a resource.
+     * If the resource implements the {@link RemoveCallback RemoveCallback}
+     * interface, the implementation must invoke this the remove operation
+     * on the resource.
+     *
+     * @throws NoSuchResourceException if no resource exists with the given key
+     * @throws InvalidResourceKeyException if the resource key is invalid.
+     * @throws RemoveNotSupportedException if remove operation is not 
+     *         supported.
+     * @throws ResourceException if any other error occurs.
+     */
+    void remove(ResourceKey key) 
+        throws ResourceException, 
+               NoSuchResourceException,
+               InvalidResourceKeyException,
+               RemoveNotSupportedException;
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceIdentifier.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceIdentifier.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceIdentifier.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,32 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+/**
+ * This interface is used to retrieve a unique id of the resource.
+ */
+public interface ResourceIdentifier {
+    
+    /**
+     * Returns the unique id of the resource. In most cases this value should
+     * match value returned by {@link ResourceKey#getValue 
+     * ResoureKey.getValue()}.
+     *
+     * @return the id of the resource.
+     */
+    Object getID();
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceKey.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceKey.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceKey.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,55 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import org.globus.wsrf.encoding.SerializationException;
+
+import java.io.Serializable;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+/**
+ * A basic representation of a resource key. A resource key is composed of
+ * name and the actual resource key value.
+ */
+public interface ResourceKey extends Serializable {
+
+    /**
+     * The actual key value.
+     *
+     * @return the key value. Cannot be null.
+     */
+    Object getValue();
+
+    /**
+     * The name of the key.
+     *
+     * @return the name of the key. Cannot be null.
+     */
+    QName getName();
+
+    /**
+     * Converts the resource key into a {@link SOAPElement SOAPElement}.
+     * The element name and namespace must match the name of the key.
+     *
+     * @return the resource key as a <code>SOAPElement</code>
+     * @throws SerializationException in case the conversion fails.
+     */
+    SOAPElement toSOAPElement()
+        throws SerializationException;
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceLifetime.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceLifetime.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceLifetime.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,46 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import java.util.Calendar;
+
+/**
+ * Interface that contains operations which expose the state associated with
+ * resource lifetime.
+ */
+public interface ResourceLifetime
+{
+    /**
+     * Set the termination time
+     *
+     * @param time The termination time to set
+     */
+    public void setTerminationTime(Calendar time);
+
+    /**
+     * Get the termination time
+     *
+     * @return The termination time
+     */
+    public Calendar getTerminationTime();
+
+    /**
+     * Get the current time
+     *
+     * @return The current time
+     */
+    public Calendar getCurrentTime();
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceProperties.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceProperties.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceProperties.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,33 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+/**
+ * This interface is used to identify resources that expose 
+ * <code>ResourcePropertySet</code>.
+ * 
+ * @see ResourcePropertySet
+ */
+public interface ResourceProperties {
+ 
+    /**
+     * Returns <code>ResourcePropertySet</code>.
+     *
+     * @return <code>ResourcePropertySet</code>.
+     */
+    ResourcePropertySet getResourcePropertySet();
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceProperty.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceProperty.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourceProperty.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,132 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import java.util.Iterator;
+
+import javax.xml.soap.SOAPElement;
+
+import org.w3c.dom.Element;
+
+import org.globus.wsrf.encoding.SerializationException;
+
+/**
+ * Represents a single resource property. A resource property can have multiple
+ * values and be converted into a DOM <code>Element</code> or
+ * <code>SOAPElement</code> array.
+ */
+public interface ResourceProperty {
+
+    /**
+     * Adds a value.
+     *
+     * @param value the value to add.
+     */
+    void add(Object value);
+
+    /**
+     * Removes a specific value. If the resource property contains
+     * multiple of the same value, only the first one is removed. 
+     *
+     * @param value value to remove.
+     * @return true if the value was removed. False otherwise.
+     */
+    boolean remove(Object value);
+
+    /**
+     * Retrieves a value at a specific index.
+     *
+     * @param index the index of value to retrieve.
+     * @return the value at the given index. This operation might fail
+     *         if the index is out of bounds.
+     */
+    Object get(int index);
+
+    /**
+     * Sets a value at a specific index.
+     *
+     * @param index the index to set value at.
+     * @param value the new value
+     */
+    void set(int index, Object value);
+
+    /**
+     * Removes all values.
+     */
+    void clear();
+
+    /**
+     * Returns the number of values in the resource property.
+     *
+     * @return the number of values.
+     */
+    int size();
+
+    /**
+     * Returns true if the resource property has any values.
+     *
+     * @return  true if the resource property has any values. False, otherwise.
+     */
+    boolean isEmpty();
+
+
+    /**
+     * Returns iterator over the values of this resource property.
+     *
+     * @return iterator over the values of this resource property.
+     */
+    Iterator iterator();
+
+    /**
+     * Converts the resource property value into a SOAPElement array.
+     * Each value is wrapped into an element named after the resource property.
+     * If the RP has no values (is null), and RP element was defined as:
+     * <ul>
+     * <li>minOccurs >= 0 - the function returns null.</li>
+     * <li>nillable == true - the function returns a single element with
+     * <i>xsi:nil="true"</i> attribute set.</li>
+     * </ul>
+     *
+     * @return the resource property as a SOAPElement array.
+     * @throws SerializationException if conversion fails.
+     */
+    SOAPElement[] toSOAPElements()
+        throws SerializationException;
+
+    /**
+     * Converts the resource property value into a DOM Element array.
+     * Each value is wrapped into an element named after the resource property.
+     * If the RP has no values (is null), and RP element was defined as:
+     * <ul>
+     * <li>minOccurs >= 0 - the function returns null.</li>
+     * <li>nillable == true - the function returns a single element with
+     * <i>xsi:nil="true"</i> attribute set.</li>
+     * </ul>
+     *
+     * @return the resource property as a DOM Element array.
+     * @throws SerializationException if conversion fails.
+     */
+    Element[] toElements()
+        throws SerializationException;
+
+    /**
+     * Gets meta data of this resource property.
+     *
+     * @return meta data of this resource property. Never null.
+     */
+    ResourcePropertyMetaData getMetaData();
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourcePropertyMetaData.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourcePropertyMetaData.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourcePropertyMetaData.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,76 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Defines a metadata information about a resource property.
+ */
+public interface ResourcePropertyMetaData {
+    
+    /**
+     * Returns ResourceProperty name.
+     *
+     * @return the resource property name.
+     */
+    QName getName();
+    
+    /**
+     * Returns if this resource property can be nillable.
+     *
+     * @return true if the resource property can be nillable. False otherwise.
+     */
+    boolean isNillable();
+ 
+    /**
+     * Returns the minimum number of values that this resource property can 
+     * have.
+     * 
+     * @return the minimum number of values that this resource property can 
+     *         have. 
+     */
+    int getMinOccurs();
+
+    /**
+     * Returns the maximum number of values that this resource property can 
+     * have.
+     * 
+     * @return the maximum number of values that this resource property can 
+     *         have. Returns {@link Integer#MAX_VALUE Integer.MAX_VALUE} if
+     *        unlimited.
+     */
+    int getMaxOccurs();
+
+    /**
+     * Returns the Java element type of this property.
+     * When adding or setting element values the input value
+     * will be automatically converted into this type.
+     * If set to <code>Object.class</code> then no conversion
+     * will be done.
+     *
+     * @return Element type of this property.
+     */
+    Class getType();
+
+    /**
+     * Returns whether this property is read only.
+     * 
+     * @return Returns true if this property is read only. False, otherwise.
+     */
+    public boolean isReadOnly();
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourcePropertySet.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourcePropertySet.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/ResourcePropertySet.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,124 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import org.globus.wsrf.encoding.SerializationException;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+import org.w3c.dom.Element;
+
+/**
+ * This interface defines the API used to access a collection of resource 
+ * property contained in a resource.
+ */
+public interface ResourcePropertySet  {
+    
+    /**
+     * Adds a resource property to the set and makes it available to 
+     * queries and subscriptions, etc.
+     *
+     * @param property the <code>ResourceProperty</code> to add.
+     * @return true if property was successfully added, false otherwise.
+     */
+    boolean add(ResourceProperty property);
+    
+    /**
+     * Removes a resource property.
+     *
+     * @param propName the name of the <code>ResourceProperty</code> to remove.
+     * @return true if property was successfully removed, false otherwise.
+     */
+    boolean remove(QName propName);
+    
+    /**
+     * Retrieves a resource property.
+     *
+     * @param propName the name of the <code>ResourceProperty</code> to 
+     *         retrieve.
+     * @return the <code>ResourceProperty</code> that was retrieved. Null if 
+     *         the property does not exist.
+     */
+    ResourceProperty get(QName propName);
+
+    /**
+     * Creates a resource property entry with the specified meta data. Note the
+     * resource property is not added to the set (and thus not target to 
+     * queries or subscriptions)until the {@link #add add} method is called.
+     */
+    ResourceProperty create(ResourcePropertyMetaData rpMetaData);
+
+    /**
+     * Returns an iterator over <code>ResourceProperty</code> entries.
+     *
+     * @return an iterator over <code>ResourceProperty</code> entries.
+     */
+    Iterator iterator();
+
+    /**
+     * Removes all resource properties.
+     */
+    void clear();
+
+    /**
+     * Returns the number of resource properties this set contains.
+     *
+     * @return the number of resource properties contained.
+     */
+    int size();
+
+    /**
+     * Returns true if the set has at least one resource property.
+     *
+     * @return true if the set has at least one resource property. 
+     *         False, otherwise.
+     */
+    boolean isEmpty();
+
+    /**
+     * Indicates if the resource property set allows adding of new arbitrary
+     * resource property elements.
+     *
+     * @return true if adding new resource property elements is allowed. False
+     *         otherwise. Please note that <code>isOpenContent</code> might
+     *         return <code>true</code> but only certain subset of resource
+     *         properties will be allowed to be added.
+     */
+    boolean isOpenContent();
+
+    /**
+     * Returns the element name of the entire resource properties document.
+     *
+     * @return the element name of the entire resource properties document.
+     */
+    QName getName();
+
+    /**
+     * Returns the entire Resource Property document as a SOAPElement.
+     */
+    SOAPElement toSOAPElement()
+        throws SerializationException;
+
+    /**
+     * Returns the entire Resource Property document as a DOM Element.
+     */
+    Element toElement()
+        throws SerializationException;
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/Subscription.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/Subscription.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/Subscription.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,128 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import java.util.Calendar;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.globus.wsrf.impl.security.descriptor.ClientSecurityDescriptor;
+
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsrf.properties.QueryExpressionType;
+
+/**
+ * Interface to be implemented by subscription resources. Exposes the
+ * information associated with a subscription request as well as resource
+ * lifetime related state.
+ */
+public interface Subscription extends Resource, ResourceLifetime
+{
+    /**
+     * Is the subscription paused?
+     *
+     * @return True if the subscription is paused, false if not.
+     */
+    boolean isPaused();
+
+    /**
+     * Pause the subscription
+     *
+     * @throws Exception
+     */
+    void pause() throws Exception;
+
+    /**
+     * Resume the subscription
+     *
+     * @throws Exception
+     */
+    void resume() throws Exception;
+
+    /**
+     * Get the consumer endpoint reference associated with this subscription
+     *
+     * @return The consumer endpoint reference
+     */
+    EndpointReferenceType getConsumerReference();
+
+    /**
+     * Get the producer endpoint reference associated with this subscription
+     *
+     * @return The producer endpoint reference
+     */
+    EndpointReferenceType getProducerReference();
+
+    /**
+     * Get the topic expression associated with this subscription
+     *
+     * @return The topic expression
+     */
+    TopicExpressionType getTopicExpression();
+
+    /**
+     * Get the precondition associated with this subscription
+     *
+     * @return The precondition. May be null if no precondition was specified in
+     *         the subscription.
+     */
+    QueryExpressionType getPrecondition();
+
+    /**
+     * Get the selector expression associated with this subscription
+     *
+     * @return The selector. May be null if no selector was specified in the
+     *         subscription.
+     */
+    QueryExpressionType getSelector();
+
+    /**
+     * Get the policy associated with this subscription
+     *
+     * @return The policy. May be null if no policy was specified in the
+     *         subscription.
+     */
+    Object getSubscriptionPolicy();
+
+    /**
+     * Wrap notification messages in the notify element?
+     *
+     * @return True (default) if notify should be used, false if not.
+     */
+    boolean getUseNotify();
+
+    /**
+     * Get the producing resource
+     *
+     * @return The producing resource
+     */
+    Object getResource() throws Exception;
+
+    /**
+     * Get the time at which the resource was created.
+     *
+     * @return The creation time
+     */
+    public Calendar getCreationTime();
+
+    /**
+     * Get security properties that determine security for the
+     * notification call. If any. Returns null for insecure subcriptions
+     *
+     * @return map of security properties.
+     */
+    public ClientSecurityDescriptor getSecurityProperties();
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/Topic.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/Topic.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/Topic.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,126 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+
+import java.util.List;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.oasis.wsn.TopicExpressionType;
+
+/**
+ * Interface for representing a topic. A topic is either a child of a parent
+ * topic or in the case of root topics a member of a topic list. Non-root 
+ * topics have names without a namespace component.
+ *
+ * @see TopicList
+ */
+public interface Topic extends TopicListenerList
+{
+    /**
+     * Add a sub-topic.
+     *
+     * @param topic The sub-topic to add
+     * @throws Exception
+     */
+    void addTopic(Topic topic) throws Exception;
+
+    /**
+     * Remove a sub-topic
+     *
+     * @param topic The sub-topic to remove
+     */
+    void removeTopic(Topic topic);
+
+    /**
+     * Get the sub-topic with the given topic name
+     *
+     * @param topicName The topic name of the sub topic
+     * @return The sub-topic
+     */
+    Topic getTopic(QName topicName);
+
+    /**
+     * Set the topic expression that resolves to a set of topics that this topic
+     * references. Only used for reference topics.
+     *
+     * @param topicPath The topic expression to set.
+     */
+    void setTopicReference(TopicExpressionType topicPath);
+
+    /**
+     * Get the topic expression for the topic(s) that this topic references.
+     *
+     * @return The topic expression that this topic reference or null if this
+     *         topic is not a reference.
+     */
+    TopicExpressionType getTopicReference();
+
+    /**
+     * Set the topic path. The topic path is represented as a ordered list of
+     * topic names
+     *
+     * @param topicPath The topic path to associate with this topic
+     */
+    void setTopicPath(List topicPath);
+
+    /**
+     * Get the topic path. The topic path is represented as a ordered list of
+     * topic names
+     *
+     * @return The topic path of this topic
+     */
+    List getTopicPath();
+
+    /**
+     * Get the name of the topic. Only root topics should actually be qualified
+     * names, other topic should be non-qualified
+     *
+     * @return The name of the topic
+     */
+    QName getName();
+
+    /**
+     * Get the current notification message if there is any
+     *
+     * @return A object containing the current message, may be null
+     */
+    Object getCurrentMessage();
+
+    /**
+     * Send out a notification on this topic
+     *
+     * @param obj Object representation of the message to send
+     * @throws Exception
+     */
+    void notify(Object obj) throws Exception;
+
+    /**
+     * Is this a topic reference?
+     *
+     * @return true if this topic is a reference to another topic false if not
+     */
+    boolean isReference();
+
+    /**
+     * Iterator for the set of child topics
+     *
+     * @return The iterator
+     */
+    Iterator topicIterator();
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicList.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicList.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicList.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,90 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Iterator;
+
+import org.globus.wsrf.topicexpression.UnsupportedTopicExpressionDialectException;
+import org.globus.wsrf.topicexpression.TopicExpressionResolutionException;
+import org.globus.wsrf.topicexpression.InvalidTopicExpressionException;
+import org.globus.wsrf.topicexpression.TopicExpressionException;
+import org.oasis.wsn.TopicExpressionType;
+
+/**
+ * Interface for managing and performing queries on a set of root topics.
+ */
+public interface TopicList extends TopicListenerList
+{
+    /**
+     * Add a root topic
+     *
+     * @param topic The topic to add
+     */
+    void addTopic(Topic topic);
+
+    /**
+     * Remove the root topic
+     *
+     * @param topic The topic to remove
+     */
+    void removeTopic(Topic topic);
+
+    /**
+     * Get the set of topics the given topic expression resolves to
+     *
+     * @param topicExpression The topic expression to resolve to a set of
+     *                        topics
+     * @return The resulting set of topics
+     * @throws UnsupportedTopicExpressionDialectException
+     *                                  if the topic expression dialect is not
+     *                                  supported
+     * @throws TopicExpressionResolutionException
+     *                                  if the expression could not be
+     *                                  evaluated
+     * @throws InvalidTopicExpressionException
+     *                                  if the topic expression is invalid
+     * @throws TopicExpressionException if any other error occurs
+     */
+    Collection getTopics(TopicExpressionType topicExpression)
+        throws UnsupportedTopicExpressionDialectException,
+               TopicExpressionResolutionException,
+               InvalidTopicExpressionException,
+               TopicExpressionException;
+
+    /**
+     * Get the topic for the given topic path.
+     *
+     * @param topicPath The topic path (list of topic names)
+     * @return The topic corresponding to the given topic path
+     */
+    Topic getTopic(List topicPath);
+
+    /**
+     * Returns meta data associated with this topic list.
+     *
+     * @return meta data of this topic list.
+     */
+    TopicListMetaData getTopicListMetaData();
+
+    /**
+     * Iterator for the set of root topics
+     *
+     * @return The iterator
+     */
+    Iterator topicIterator();
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListAccessor.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListAccessor.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListAccessor.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,34 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+/**
+ * Interface implemented by entities (e.g. resources) that have associated 
+ * topic spaces. Primarly exists to abstract different <code>TopicList</code>
+ * implementations.
+ *
+ * @see TopicList
+ */
+public interface TopicListAccessor
+{
+    /**
+     * Get the topic list
+     *
+     * @return The topic list
+     * @see TopicList
+     */
+    TopicList getTopicList();
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListMetaData.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListMetaData.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListMetaData.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,30 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+/**
+ * Interface for TopicList meta data.
+ */
+public interface TopicListMetaData {
+
+    /**
+     * Is the topic set fixed?
+     *
+     * @return Boolean indicating whether the topic set is fixed or not
+     */
+    boolean isTopicSetFixed();
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListener.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListener.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListener.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,48 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+
+/**
+ * Interface that should be implemented by parties interested in changes in
+ * topics and the list of root topics. It is currently used to send
+ * notifications when the situation represented by a topic changes and for
+ * tracking the list of currently supported topics (exposed as a resource
+ * property)
+ */
+public interface TopicListener
+{
+    /**
+     * Called when the value of the topic changes
+     *
+     * @param topic The topic that changed
+     */
+    void topicChanged(Topic topic);
+
+    /**
+     * Called when a topic is added
+     *
+     * @param topic The topic being added
+     */
+    void topicAdded(Topic topic);
+
+    /**
+     * Called when a topic is removed
+     *
+     * @param topic The topic being removed
+     */
+    void topicRemoved(Topic topic);
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListenerList.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListenerList.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/TopicListenerList.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,53 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import java.util.Iterator;
+
+/**
+ * Interface used for managing a list of topic listeners. Currently inherited
+ * by the <code>TopicList</code> and <code>Topic</code> interfaces.
+ *
+ * @see TopicListener
+ * @see TopicList
+ * @see Topic
+ */
+public interface TopicListenerList
+{
+    /**
+     * Add a topic listener
+     *
+     * @param listener The topic listener to add
+     * @see TopicListener
+     */
+    void addTopicListener(TopicListener listener);
+
+    /**
+     * Remove a topic listener
+     *
+     * @param listener The topic listener to remove.
+     * @see TopicListener
+     */
+    void removeTopicListener(TopicListener listener);
+
+    /**
+     * Get a iterator for the list of TopicListeners
+     *
+     * @return The iterator
+     * @see TopicListener
+     */
+    Iterator topicListenerIterator();
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/WSNConstants.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/WSNConstants.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/WSNConstants.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,116 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Generic constants of WSN family of specifications.
+ */
+public class WSNConstants
+{
+
+    /**
+     * Prefix used when constructing QNames for the WS-BaseNotification
+     * namespace
+     */
+    public static final String BASEN_PREFIX = "wsnt";
+
+    /**
+     * WS-BaseNotification namespace
+     */
+    public static final String BASEN_NS =
+        "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
+
+    /**
+     * Simple topic dialect URI
+     */
+    public static final String SIMPLE_TOPIC_DIALECT =
+        "http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Simple";
+
+    /**
+     * Concrete topic dialect URI
+     */
+    public static final String CONCRETE_TOPIC_DIALECT =
+        "http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Concrete";
+
+    /**
+     * Full topic dialect URI
+     */
+    public static final String FULL_TOPIC_DIALECT =
+        "http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Full";
+
+    /**
+     * Creation time resource property QName
+     */
+    public static final QName CREATION_TIME =
+        new QName(BASEN_NS, "CreationTime");
+
+    /**
+     * Consumer reference resource property QName
+     */
+    public static final QName CONSUMER_REFERENCE =
+        new QName(BASEN_NS, "ConsumerReference");
+
+    /**
+     * Topic expression resource property QName
+     */
+    public static final QName TOPIC_EXPRESSION =
+        new QName(BASEN_NS, "TopicExpression");
+
+    /**
+     * Use notify resource property QName
+     */
+    public static final QName USE_NOTIFY =
+        new QName(BASEN_NS, "UseNotify");
+
+    /**
+     * Precondition resource property QName
+     */
+    public static final QName PRECONDITION =
+        new QName(BASEN_NS, "Precondition");
+
+    /**
+     * Selector resource property QName
+     */
+    public static final QName SELECTOR =
+        new QName(BASEN_NS, "Selector");
+
+    /**
+     * Subscription policy resource property QName
+     */
+    public static final QName SUBSCRIPTION_POLICY =
+        new QName(BASEN_NS, "SubscriptionPolicy");
+
+    /**
+     * Topic resource property QName
+     */
+    public static final QName TOPIC =
+        new QName(BASEN_NS, "Topics");
+
+    /**
+     * Fixed topic set resource property QName
+     */
+    public static final QName FIXED_TOPIC_SET =
+        new QName(BASEN_NS, "FixedTopicSet");
+
+    /**
+     * Topic expression dialects resource property QName
+     */
+    public static final QName TOPIC_EXPRESSION_DIALECTS =
+        new QName(BASEN_NS, "TopicExpressionDialects");
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/WSRFConstants.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/WSRFConstants.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/WSRFConstants.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,115 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Generic constants defined by WSRF family of specifications.
+ */
+public class WSRFConstants
+{
+    /**
+     * Prefix used when constructing QNames for the WS-ResourceLifetime
+     * namespace
+     */
+    public static final String LIFETIME_PREFIX = "wsrl";
+
+    /**
+     * WS-ResourceLifetime namespace
+     */
+    public static final String LIFETIME_NS =
+        "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd";
+
+    /**
+     * Termination time resource property QName
+     */
+    public static final QName TERMINATION_TIME =
+        new QName(LIFETIME_NS, "TerminationTime");
+
+    /**
+     * Current time resource property QName
+     */
+    public static final QName CURRENT_TIME =
+        new QName(LIFETIME_NS, "CurrentTime");
+
+    /**
+     * Prefix used when constructing QNames for the WS-ResourceProperties
+     * namespace
+     */
+    public static final String PROPERTIES_PREFIX = "wsrp";
+
+    /**
+     * WS-ResourceProperties namespace
+     */
+    public static final String PROPERTIES_NS =
+        "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
+
+    /**
+     * Prefix used when constructing QNames for the WS-ServiceGroup
+     * namespace
+     */
+    public static final String SERVICEGROUP_PREFIX = "wssg";
+
+    /**
+     * WS-ServiceGroup namespace
+     */
+    public static final String SERVICEGROUP_NS =
+        "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.xsd";
+
+    /**
+     * Entry resource property QName
+     */
+    public static final QName ENTRY =
+        new QName(SERVICEGROUP_NS, "Entry");
+
+    /**
+     * MembershipContentRule resource property QName
+     */
+    public static final QName MEMBERSHIP_CONTENT_RULE =
+        new QName(SERVICEGROUP_NS, "MembershipContentRule");
+
+    /**
+     * MemberEPR resource property QName
+     */
+    public static final QName MEMBER_EPR =
+        new QName(SERVICEGROUP_NS, "MemberEPR");
+
+    /**
+     * ServiceGroupEPR resource property QName
+     */
+    public static final QName SERVICEGROUP_EPR =
+        new QName(SERVICEGROUP_NS, "ServiceGroupEPR");
+
+    /**
+     * Content resource property QName
+     */
+    public static final QName CONTENT =
+        new QName(SERVICEGROUP_NS, "Content");
+
+    /**
+     * Termination topic QName
+     */
+    public static final QName TERMINATION_TOPIC =
+        new QName(LIFETIME_NS, "ResourceTermination");
+
+    /**
+     * Identifies the XPath 1.0 language.
+     */
+    public static final String XPATH_1_DIALECT =
+        "http://www.w3.org/TR/1999/REC-xpath-19991116";
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/BaseClient.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/BaseClient.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/BaseClient.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,495 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.client;
+
+import java.io.FileInputStream;
+import java.security.cert.X509Certificate;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.security.auth.Subject;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.Stub;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.cli.PosixParser;
+
+import org.apache.axis.message.addressing.Address;
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.axis.message.addressing.ReferencePropertiesType;
+
+import org.xml.sax.InputSource;
+
+import org.globus.axis.gsi.GSIConstants;
+import org.globus.axis.util.Util;
+import org.globus.gsi.CertUtil;
+import org.globus.gsi.gssapi.auth.Authorization;
+import org.globus.wsrf.encoding.ObjectDeserializer;
+import org.globus.wsrf.impl.SimpleResourceKey;
+import org.globus.wsrf.impl.security.authentication.Constants;
+import org.globus.wsrf.impl.security.authentication.encryption.EncryptionCredentials;
+import org.globus.wsrf.impl.security.authorization.HostAuthorization;
+import org.globus.wsrf.impl.security.authorization.IdentityAuthorization;
+import org.globus.wsrf.impl.security.authorization.NoAuthorization;
+import org.globus.wsrf.impl.security.authorization.SelfAuthorization;
+
+public abstract class BaseClient {
+
+    protected EndpointReferenceType endpoint;
+    protected boolean debugMode;
+    protected String customUsage;
+    protected String helpFooter;
+    protected String helpHeader;
+    protected Options options = new Options();
+
+    protected String mechanism;
+    protected Object protection = Constants.SIGNATURE;
+    protected Object delegation;
+    protected Object authorization;
+    protected Authorization gsiAuthorization;
+    protected Object anonymous;
+    protected Integer contextLifetime;
+    protected String msgActor;
+    protected String convActor;
+    protected String publicKeyFilename;
+    protected String descriptorFile;
+
+    static final String AUTHZ_DESC =
+        "Sets authorization, can be 'self', 'host' or 'none'";
+
+    static final String MECHANISM_DESC =
+        "Sets authentication mechanism: 'msg' (for GSI Secure Message), or"
+        + " 'conv' (for GSI Secure Conversation)";
+
+    static final String PROTECTION_DESC =
+        "Sets protection level, can be 'sig' (for signature) "
+        + " can be 'enc' (for encryption)";
+
+    static final String ANON_DESC =
+        "Use anonymous authentication (requires either -m 'conv' or"
+        + " transport (https) security)";
+
+    static final String FILENAME_DESC =
+        "A file with server's certificate used for encryption. "
+        + "Used in the case of GSI Secure Message encryption";
+
+    static final String CONTEXT_DESC =
+        "Lifetime of context created for GSI Secure " +
+        "Conversation (requires -m 'conv')";
+
+    static final String MSG_ACTOR_DESC =
+        "Sets actor name for GSI Secure Message";
+
+    static final String CONV_ACTOR_DESC =
+        "Sets actor name for GSI Secure Conversation";
+
+    static final String DELEG_DESC =
+        "Performs delegation. Can be 'limited' or 'full'. "
+        + "(requires -m 'conv')";
+
+    static final String DESCRIPTOR_DESC =
+        "Sets client security descriptor. Overrides all other security " +
+        "settings";
+
+    private static final Option HELP =
+        OptionBuilder.withDescription("Displays help")
+        .withLongOpt("help")
+        .create("h");
+
+    public static final Option EPR_FILE =
+        OptionBuilder.withArgName( "file" )
+        .hasArg()
+        .withDescription("Loads EPR from file")
+        .withLongOpt("eprFile")
+        .create("e");
+
+    public static final Option SERVICE_URL =
+        OptionBuilder.withArgName( "url" )
+        .hasArg()
+        .withDescription("Service URL")
+        .withLongOpt("service")
+        .create("s");
+
+    public static final Option RESOURCE_KEY =
+        OptionBuilder.withArgName( "name value" )
+        .hasArgs(2)
+        .withDescription("Resource Key")
+        .withLongOpt("key")
+        .create("k");
+
+    public static final Option DEBUG =
+        OptionBuilder.withDescription("Enables debug mode")
+        .withLongOpt("debug")
+        .create("d");
+
+    public static final Option AUTHZ =
+        OptionBuilder.withArgName("type").hasArg()
+        .withDescription(AUTHZ_DESC)
+        .withLongOpt("authorization").create("z");
+
+    public static final Option MECHANISM =
+        OptionBuilder.withArgName("type").hasArg()
+        .withDescription(MECHANISM_DESC)
+        .withLongOpt("securityMech").create("m");
+
+    public static final Option ANON =
+        OptionBuilder.withDescription(ANON_DESC).withLongOpt("anonymous")
+        .create("a");
+
+    public static final Option PROTECTION =
+        OptionBuilder.withArgName("type")
+        .hasArg()
+        .withDescription(PROTECTION_DESC)
+        .withLongOpt("protection").create("p");
+
+    public static final Option PUB_KEY_FILE =
+        OptionBuilder.withArgName("file")
+        .hasArg()
+        .withDescription(FILENAME_DESC)
+        .withLongOpt("serverCertificate").hasOptionalArg().create("c");
+
+    public static final Option CONTEXT =
+        OptionBuilder.withArgName("value").hasArg()
+        .withDescription(CONTEXT_DESC)
+        .withLongOpt("contextLifetime").create("l");
+
+    public static final Option MSG_ACTOR =
+        OptionBuilder.withArgName("actor").hasArg()
+        .withDescription(MSG_ACTOR_DESC)
+        .withLongOpt("gsiSecMsgActor").create("x");
+
+    public static final Option CONV_ACTOR =
+        OptionBuilder.withArgName("actor").hasArg()
+        .withDescription(CONV_ACTOR_DESC)
+        .withLongOpt("gsiSecConvActor").create("y");
+
+    public static final Option DELEG =
+        OptionBuilder.withArgName("mode").hasArg()
+        .withDescription(DELEG_DESC)
+        .withLongOpt("delegation").create("g");
+
+    public static final Option DESCRIPTOR =
+        OptionBuilder.withDescription(DESCRIPTOR_DESC).hasArg()
+        .withArgName("file")
+        .withLongOpt("descriptor").create("f");
+
+    static {
+        Util.registerTransport();
+    }
+
+    protected BaseClient() {
+
+        options.addOption(HELP);
+        options.addOption(EPR_FILE);
+        options.addOption(SERVICE_URL);
+        options.addOption(RESOURCE_KEY);
+        options.addOption(DEBUG);
+
+        // security options
+        options.addOption(DESCRIPTOR);
+        options.addOption(MECHANISM);
+        options.addOption(ANON);
+        options.addOption(PROTECTION);
+        options.addOption(AUTHZ);
+        options.addOption(CONTEXT);
+        /*
+        options.addOption(MSG_ACTOR);
+        options.addOption(CONV_ACTOR);
+        */
+        options.addOption(DELEG);
+        options.addOption(PUB_KEY_FILE);
+    }
+
+    public void setCustomUsage(String customUsage) {
+        this.customUsage = customUsage;
+    }
+
+    public void setHelpFooter(String msg) {
+        this.helpFooter = msg;
+    }
+
+    public void setHelpHeader(String msg) {
+        this.helpHeader = msg;
+    }
+
+    public void displayUsage() {
+        String usage = "java " + getClass().getName() +
+                       " [-h] [-s url [-k name value] | -e file] ";
+
+        usage = (this.customUsage == null) ? usage : usage + this.customUsage;
+
+        String header = (this.helpHeader == null) ?
+                        "Options:" : this.helpHeader;
+        HelpFormatter formatter = new HelpFormatter();
+        formatter.printHelp(usage, header, options, null, false);
+        if (this.helpFooter != null) {
+            System.out.println(this.helpFooter);
+        }
+    }
+
+    protected CommandLine parse(String [] args) throws Exception {
+        return parse(args, null);
+    }
+
+    protected CommandLine parse(String [] args, Properties defaultOptions)
+        throws Exception {
+        CommandLineParser parser = new PosixParser();
+        CommandLine line = parser.parse(options, args, defaultOptions);
+
+        if (defaultOptions != null) {
+            Iterator iter = defaultOptions.entrySet().iterator();
+            while(iter.hasNext()) {
+                Map.Entry entry = (Map.Entry)iter.next();
+                Option opt = options.getOption((String)entry.getKey());
+                if (opt != null) {
+                    String desc = opt.getDescription();
+                    desc += " (Default '" + entry.getValue() + "')";
+                    opt.setDescription(desc);
+                }
+            }
+        }
+
+        if (line.hasOption("h")) {
+            displayUsage();
+            System.exit(0);
+        }
+
+        if (line.hasOption("e")) {
+            if (line.hasOption("k")) {
+                throw new ParseException("-e and -k arguments are exclusive");
+            }
+            if (line.hasOption("s")) {
+                throw new ParseException("-e and -s arguments are exclusive");
+            }
+
+            FileInputStream in = null;
+            try {
+                in = new FileInputStream(line.getOptionValue("e"));
+                this.endpoint =
+                (EndpointReferenceType)ObjectDeserializer.deserialize(
+                    new InputSource(in),
+                    EndpointReferenceType.class);
+            } finally {
+                if (in != null) {
+                    try { in.close(); } catch (Exception e) {}
+                }
+            }
+        } else if (line.hasOption("s")) {
+            this.endpoint = new EndpointReferenceType();
+            this.endpoint.setAddress(new Address(line.getOptionValue("s")));
+        } else {
+            throw new ParseException("-s or -e argument is required");
+        }
+
+        if (line.hasOption("k")) {
+            String [] values = line.getOptionValues("k");
+            if (values.length != 2) {
+                throw new ParseException("-k requires two arguments");
+            }
+            QName keyName = QName.valueOf(values[0]);
+            ReferencePropertiesType props = new ReferencePropertiesType();
+            SimpleResourceKey key = new SimpleResourceKey(keyName, values[1]);
+            props.add(key.toSOAPElement());
+            this.endpoint.setProperties(props);
+        }
+
+        this.debugMode = line.hasOption("d");
+
+        // Security mechanism
+        if (line.hasOption("m")) {
+            String value = line.getOptionValue("m");
+            if (value != null) {
+                if (value.equals("msg")) {
+                    this.mechanism = Constants.GSI_SEC_MSG;
+                } else if (value.equals("conv")) {
+                    this.mechanism = Constants.GSI_SEC_CONV;
+                } else {
+                    throw new ParseException(
+                        "Unsupported security mechanism: " +  value);
+                }
+            }
+        }
+
+        // Protection
+        if (line.hasOption("p")) {
+            String value = line.getOptionValue("p");
+            if (value != null) {
+                if (value.equals("sig")) {
+                    this.protection = Constants.SIGNATURE;
+                } else if (value.equals("enc")) {
+                    this.protection = Constants.ENCRYPTION;
+                } else {
+                    throw new ParseException("Unsupported protection mode: " +
+                                             value);
+                }
+            }
+        }
+
+
+        // Delegation
+        if (line.hasOption("g")) {
+            String value = line.getOptionValue("g");
+            if (value != null) {
+                if (value.equals("limited")) {
+                    this.delegation = GSIConstants.GSI_MODE_LIMITED_DELEG;
+                } else if (value.equals("full")) {
+                    this.delegation = GSIConstants.GSI_MODE_FULL_DELEG;
+                } else {
+                    throw new ParseException("Unsupported delegation mode: " +
+                                             value);
+                }
+            }
+        }
+
+        // Authz
+        if (line.hasOption("z")) {
+            String value = line.getOptionValue("z");
+            if (value != null) {
+                if (value.equals("self")) {
+                    this.authorization = SelfAuthorization.getInstance();
+                    this.gsiAuthorization = org.globus.gsi.gssapi.auth
+                        .SelfAuthorization.getInstance();
+                } else if (value.equals("host")) {
+                    this.authorization = HostAuthorization.getInstance();
+                    this.gsiAuthorization = org.globus.gsi.gssapi.auth
+                        .HostAuthorization.getInstance();
+                } else if (value.equals("none")) {
+                    this.authorization = NoAuthorization.getInstance();
+                    this.gsiAuthorization = org.globus.gsi.gssapi.auth
+                        .NoAuthorization.getInstance();
+                } else if (authorization == null) {
+                    this.authorization = new IdentityAuthorization(value);
+                    this.gsiAuthorization = new org.globus.gsi.gssapi.auth
+                        .IdentityAuthorization(value);
+                }
+            }
+        }
+
+        // Anonymous
+        if (line.hasOption("a")) {
+            this.anonymous = Boolean.TRUE;
+        }
+
+        // context lifetime
+        if (line.hasOption("l")) {
+            String value = line.getOptionValue("l");
+            if (value != null)
+                this.contextLifetime = new Integer(value);
+        }
+
+        // msg actor
+        if (line.hasOption("x")) {
+            String value = line.getOptionValue("x");
+            this.msgActor = value;
+        }
+
+        // conv actor
+        if (line.hasOption("y")) {
+            String value = line.getOptionValue("y");
+            this.convActor = value;
+        }
+
+        // Server's public key
+        if (line.hasOption("c")) {
+            String value = line.getOptionValue("c");
+            this.publicKeyFilename = value;
+        }
+
+
+        if (line.hasOption("f")) {
+            String value = line.getOptionValue("f");
+            this.descriptorFile = value;
+        }
+
+        return line;
+    }
+
+    public void setOptions(Stub stub) throws Exception {
+
+        if (this.descriptorFile != null) {
+            stub._setProperty(Constants.CLIENT_DESCRIPTOR_FILE,
+                              this.descriptorFile);
+            return;
+        }
+
+        if (this.protection != null) {
+            // this means if both transport security and message security
+            // are enabled both will get the same protection
+            if (this.endpoint.getAddress().getScheme().equals("https")) {
+                stub._setProperty(GSIConstants.GSI_TRANSPORT,
+                                  this.protection);
+            }
+            if (this.mechanism != null) {
+                stub._setProperty(this.mechanism,
+                                  this.protection);
+            }
+        }
+
+        if (this.convActor != null) {
+            stub._setProperty("gssActor", this.convActor);
+        }
+
+        if (this.delegation != null) {
+            stub._setProperty(GSIConstants.GSI_MODE, this.delegation);
+        }
+
+        if (this.authorization != null) {
+            stub._setProperty(Constants.AUTHORIZATION, this.authorization);
+            stub._setProperty(GSIConstants.GSI_AUTHORIZATION,
+                              this.gsiAuthorization);
+        }
+
+        if (this.anonymous != null) {
+            stub._setProperty(Constants.GSI_ANONYMOUS, this.anonymous);
+        }
+
+        if (this.msgActor != null) {
+            stub._setProperty("x509Actor", this.msgActor);
+        }
+
+        if ((Constants.GSI_SEC_MSG.equals(this.mechanism))  &&
+            (Constants.ENCRYPTION.equals(this.protection))) {
+            Subject subject = new Subject();
+            X509Certificate serverCert =
+                CertUtil.loadCertificate(publicKeyFilename);
+            EncryptionCredentials encryptionCreds =
+                new EncryptionCredentials(new X509Certificate[]
+                    { serverCert });
+            subject.getPublicCredentials().add(encryptionCreds);
+            stub._setProperty(Constants.PEER_SUBJECT, subject);
+        }
+
+        if (this.contextLifetime != null) {
+            stub._setProperty(Constants.CONTEXT_LIFETIME,
+                              this.contextLifetime);
+        }
+    }
+
+    public EndpointReferenceType getEPR() {
+        return this.endpoint;
+    }
+
+    public boolean isDebugMode() {
+        return this.debugMode;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/DeleteProperty.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/DeleteProperty.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/DeleteProperty.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Destroy.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Destroy.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Destroy.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/GetCurrentMessage.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/GetCurrentMessage.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/GetCurrentMessage.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/GetProperties.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/GetProperties.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/GetProperties.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/GetProperty.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/GetProperty.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/GetProperty.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/InsertProperty.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/InsertProperty.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/InsertProperty.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Pause.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Pause.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Pause.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Query.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Query.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Query.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Resume.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Resume.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Resume.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/ServiceURL.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/ServiceURL.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/ServiceURL.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/SetTerminationTime.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/SetTerminationTime.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/SetTerminationTime.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Subscribe.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Subscribe.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/Subscribe.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/client/UpdateProperty.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/client/UpdateProperty.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/client/UpdateProperty.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/config/ConfigException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/config/ConfigException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/config/ConfigException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,34 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.config;
+
+import org.globus.common.ChainedException;
+
+public class ConfigException extends ChainedException {
+    
+    public ConfigException(String message) {
+        super(message);
+    }
+    
+    public ConfigException(Exception e) {
+        super("", e);
+    }
+    
+    public ConfigException(String message, Exception e) {
+        super(message, e);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/config/ContainerConfig.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/config/ContainerConfig.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/config/ContainerConfig.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,272 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.config;
+
+import java.util.Hashtable;
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.AxisEngine;
+import org.apache.axis.EngineConfiguration;
+import org.apache.axis.WSDDEngineConfiguration;
+import org.apache.axis.MessageContext;
+import org.apache.axis.client.AxisClient;
+import org.apache.axis.configuration.FileProvider;
+import org.apache.axis.deployment.wsdd.WSDDDeployment;
+import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
+import org.apache.axis.server.AxisServer;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.container.ServiceHost;
+import org.globus.wsrf.utils.Resources;
+
+/**
+ * This class makes global container configuration variables available to 
+ * the application.
+ */
+public class ContainerConfig {
+
+    static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public static final String WSRF_LOCATION = "wsrfLocation";
+    public static final String CONTAINER_THREADS = "containerThreads";
+    public static final String CONTAINER_THREADS_MAX = "containerThreadsMax";
+    public static final String CONTAINER_THREADS_WATERMARK =
+        "containerThreadsHighWaterMark";
+    public static final String LOGICAL_HOST = "logicalHost";
+    public static final String PUBLISH_HOST_NAME = "publishHostName";
+    public static final String DOMAIN_NAME = "domainName";
+    public static final String DISABLE_DNS = "disableDNS";
+
+    public static final String WEB_CONTEXT = 
+        "webContext";
+
+    /**
+     * Config property used to specify external web root location published
+     * in wsdl files.
+     */
+    public static final String EXTERNAL_WEB_ROOT = 
+        "webroot.external";
+
+    /**
+     * System property used to specify external web root location published
+     * in wsdl files.
+     */
+    public static final String EXTERNAL_WEB_ROOT_PROPERTY = 
+        Constants.CONTAINER_PROPERTY + "." + EXTERNAL_WEB_ROOT;
+    
+    /**
+     * Config property used to specify internal web root location.
+     */
+    public static final String INTERNAL_WEB_ROOT = 
+        "webroot.internal";
+
+    /**
+     * System property used to specify internal web root location.
+     */
+    public static final String INTERNAL_WEB_ROOT_PROPERTY = 
+        Constants.CONTAINER_PROPERTY + "." + INTERNAL_WEB_ROOT;
+
+    /**
+     * Enables WebStart support in standalone container. Must be set to 
+     * <code>enable</code> to enable the support.
+     * <i>Standalone container only.</i>
+     */
+    public static final String WEB_START_PROPERTY = 
+        Constants.CONTAINER_PROPERTY + ".webstart";
+
+    public static final String CONFIG_PROFILE =
+        "config.profile";
+
+    private static AxisEngine axisClientEngine = null;
+
+    // XXX: this is not cleared - maybe use SoftReferences?
+    private static Hashtable serverEngines = new Hashtable();
+
+    public static final String DEFAULT_SERVER_CONFIG = 
+        "server-config.wsdd";
+
+    private static ContainerConfig config;
+
+    private AxisEngine engine;
+    private WSDDGlobalConfiguration globalConfig;
+    
+    static Log logger = 
+        LogFactory.getLog(ContainerConfig.class.getName());
+
+    protected ContainerConfig(AxisEngine engine) {
+        if (engine == null) {
+            throw new IllegalArgumentException();
+        }
+        EngineConfiguration config = engine.getConfig();
+        if (!(config instanceof WSDDEngineConfiguration)) {
+            throw new IllegalArgumentException(
+              i18n.getMessage("expectedType", WSDDEngineConfiguration.class));
+        }
+        WSDDDeployment deployment =
+            ((WSDDEngineConfiguration)config).getDeployment();
+        
+        this.globalConfig = deployment.getGlobalConfiguration();
+        this.engine = engine;
+    }
+    
+    /**
+     * Gets a default <code>ContainerConfig</code> instance initialized with
+     * a default AxisServer engine.
+     */
+    public synchronized static ContainerConfig getConfig() {
+        if (config == null) {
+            config = new ContainerConfig(getEngine());
+        }
+        return config;
+    }
+
+    public static ContainerConfig getConfig(AxisEngine engine) {
+        return new ContainerConfig(engine);
+    }
+
+    public String getOption(String name) {
+        return getOption(name, null);
+    }
+    
+    /**
+     * Gets an option (a global parameter). 
+     */
+    public String getOption(String name, String defaultValue) {
+        if (this.globalConfig == null) {
+            return null;
+        } else {
+            String value = this.globalConfig.getParameter(name);
+            return (value != null) ? value : defaultValue;
+        }
+    }
+    
+    /**
+     * Sets an option (a global parameter). The value is stored in
+     * memory only. It will not be persisted. 
+     */
+    public void setOption(String name, String value) {
+        if (this.globalConfig == null) {
+            this.globalConfig = new WSDDGlobalConfiguration();
+        }
+        this.globalConfig.setParameter(name, value);
+    }
+
+    public String getWSRFLocation() {
+        return getOption(ContainerConfig.WSRF_LOCATION,
+                         Constants.DEFAULT_WSRF_LOCATION);
+    }
+
+    /**
+     * Returns external web root location. The external web root location
+     * the published and virtual base location from which schema files, etc.
+     * are resolved from. 
+     * The wsdl import location attribute value (if it is a file) in the 
+     * service wsdl will be prepended with this location.
+     */
+    public static String getExternalWebRoot(MessageContext ctx) 
+        throws IOException {
+        String webRoot = System.getProperty(EXTERNAL_WEB_ROOT_PROPERTY);
+        if (webRoot == null) {
+            ContainerConfig config = new ContainerConfig(ctx.getAxisEngine());
+            webRoot = config.getOption(EXTERNAL_WEB_ROOT);
+            if (webRoot == null) {
+                String webContext = config.getOption(WEB_CONTEXT);
+                if (webContext == null) {
+                    webContext = "/";
+                } else {
+                    webContext = "/" + webContext + "/";
+                }
+                URL webRootUrl = 
+                    new URL(ServiceHost.getProtocol(ctx),
+                            ServiceHost.getHost(ctx),
+                            ServiceHost.getPort(ctx),
+                            webContext);
+                webRoot = webRootUrl.toExternalForm();
+            }
+        }
+        return webRoot;
+    }
+    
+    /**
+     * Returns internal web root location. The internal web root location
+     * is a path to a directory on a file system. Schema files, etc. are
+     * loaded from this location.
+     */
+    public String getInternalWebRoot() {
+        String webRoot = System.getProperty(INTERNAL_WEB_ROOT_PROPERTY);
+        if (webRoot == null) {
+            webRoot = getOption(INTERNAL_WEB_ROOT);
+            if (webRoot == null) {
+                webRoot = getGlobusLocation();
+            }
+        }
+        return webRoot;
+    }
+
+    public static String getGlobusLocation() {
+        String value = System.getProperty("GLOBUS_LOCATION");
+        return (value == null) ? "." : value;
+    }
+    
+    /**
+     * Get the default Axis client engine.
+     */
+    public static synchronized AxisEngine getClientEngine() {
+        if (axisClientEngine == null) {
+            axisClientEngine = new AxisClient();
+        }
+        return axisClientEngine;
+    }
+
+    /**
+     * Get the default Axis server engine.
+     */
+    public static AxisServer getEngine() {
+        return getServerEngine(null);
+    }
+    
+    public synchronized static AxisServer getServerEngine(String config) {
+        config = (config == null) ? DEFAULT_SERVER_CONFIG : config;
+        AxisServer engine = (AxisServer)serverEngines.get(config);
+        if (engine == null) {
+            engine = new AxisServer(new FileProvider(config));
+            serverEngines.put(config, engine);
+        }
+        return engine;
+    }
+    
+    /**
+     * Gets MessageContext associated with the current thread. If 
+     * MessageContext is not associated with the current thread a new
+     * one is created, initialized with client AxisEngine.
+     */
+    public static MessageContext getContext() {
+        MessageContext ctx = MessageContext.getCurrentContext();
+        if (ctx == null) {
+            ctx = new MessageContext(getClientEngine());
+            ctx.setEncodingStyle("");
+            ctx.setProperty(AxisClient.PROP_DOMULTIREFS,
+                            Boolean.FALSE);
+        }
+        return ctx;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/AxisServlet.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/AxisServlet.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/AxisServlet.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,108 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import java.io.File;
+
+import javax.servlet.ServletException;
+import javax.servlet.ServletContext;
+
+import org.apache.axis.configuration.EngineConfigurationFactoryFinder;
+import org.apache.axis.EngineConfigurationFactory;
+import org.apache.axis.AxisProperties;
+import org.apache.axis.server.AxisServer;
+import org.apache.axis.AxisFault;
+import org.apache.axis.MessageContext;
+import org.apache.axis.Constants;
+
+import org.globus.wsrf.config.ContainerConfig;
+import org.globus.axis.util.Util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class AxisServlet extends org.apache.axis.transport.http.AxisServlet {
+    
+    private static Log logger =
+        LogFactory.getLog(AxisServlet.class.getName());
+
+    static {
+        // a hack - forces the class to load and initialize the AxisProperties
+        Class c = EngineConfigurationFactoryFinder.class;
+        // this then overwires the properties with our own cfg class
+        AxisProperties.setClassDefaults(
+           EngineConfigurationFactory.class,
+           new String[] {
+            "org.globus.axis.configuration.EngineConfigurationFactoryServlet",
+            "org.apache.axis.configuration.EngineConfigurationFactoryServlet",
+            "org.apache.axis.configuration.EngineConfigurationFactoryDefault"}
+        );
+
+        Util.registerTransport();
+    }
+
+    public void init() throws ServletException {
+        super.init();
+
+        AxisServer server = null;
+        try {
+            server = getEngine();
+        } catch (AxisFault e) {
+            throw new ServletException(e);
+        }
+
+        ContainerConfig config = ContainerConfig.getConfig(server);
+        ServletContext context = getServletConfig().getServletContext();
+
+        // XXX: always overwrite web context
+        File rootFile = new File(context.getRealPath ("/"));
+        String rootContext = rootFile.getName();
+            
+        config.setOption(ContainerConfig.WEB_CONTEXT, rootContext);
+
+        // set basic msg properties
+        MessageContext msgContext = new MessageContext(server);
+        msgContext.setProperty(Constants.MC_HOME_DIR, getHomeDir());
+        msgContext.setProperty(Constants.MC_CONFIGPATH, getWebInfPath());
+
+        // set config profile info
+        String configProfile = 
+            context.getInitParameter(ContainerConfig.CONFIG_PROFILE);
+        if (configProfile != null) {
+            msgContext.setProperty(ContainerConfig.CONFIG_PROFILE,
+                                   configProfile);
+        }
+
+        try {
+            ServiceManager.getServiceManager(server).start(msgContext);
+        } catch (Exception e) {
+            throw new ServletException(e);
+        }
+    }
+
+    public void destroy() {
+        AxisServer server = null;
+        try {
+            server = getEngine();
+        } catch (AxisFault e) {
+            logger.warn("", e);
+            return;
+        }
+        ServiceManager.getServiceManager(server).stop();
+        super.destroy();
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ContainerException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ContainerException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ContainerException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,43 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import org.globus.common.ChainedException;
+
+public class ContainerException extends ChainedException
+{
+
+    public ContainerException()
+    {
+        super();
+    }
+
+    public ContainerException(String s)
+    {
+        super(s);
+    }
+
+    public ContainerException(String s, Throwable exception)
+    {
+        super(s, exception);
+    }
+
+    public ContainerException(Throwable exception)
+    {
+        super("", exception);
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/GSIServiceContainer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/GSIServiceContainer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/GSIServiceContainer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,117 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import java.net.ServerSocket;
+import java.net.URL;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.AxisEngine;
+
+import org.ietf.jgss.GSSCredential;
+
+import org.globus.axis.util.Util;
+import org.globus.gsi.jaas.JaasGssUtil;
+import org.globus.net.ServerSocketFactory;
+import org.globus.util.I18n;
+import org.globus.wsrf.config.ContainerConfig;
+import org.globus.wsrf.impl.security.descriptor.ContainerSecurityConfig;
+import org.globus.wsrf.utils.Resources;
+
+public class GSIServiceContainer extends ServiceContainer {
+
+    private static Log logger =
+        LogFactory.getLog(GSIServiceContainer.class.getName());
+
+    static {
+        Util.registerTransport();
+    }
+
+    public GSIServiceContainer(Map properties) throws ContainerException {
+        super(properties);
+    }
+
+    protected void start(boolean isMainThread, int port, int threads)
+        throws Exception {
+
+        this.dispatcher = new GSIServiceDispatcher(this.properties);
+
+        ServerSocketFactory factory = ServerSocketFactory.getDefault();
+        ServerSocket socket = factory.createServerSocket(port);
+
+        this.dispatcher.setThreads(threads);
+        this.dispatcher.setServerSocket(socket);
+        this.dispatcher.start(!isMainThread);
+
+        ServiceHost.setDefaults("https", socket.getLocalPort());
+
+        ContainerConfig engConfig =
+            ContainerConfig.getConfig(this.dispatcher.getAxisEngine());
+        this.url =
+            new URL("https",
+                    ServiceHost.getHost(this.dispatcher.getAxisEngine()),
+                    socket.getLocalPort(),
+                    "/" + engConfig.getWSRFLocation());
+
+        logger.debug("Starting secure server: " + this.url);
+
+        ServiceContainerCollection.register(getURLString(), this);
+        containers.put(properties, this);
+    }
+}
+
+
+class GSIServiceDispatcher extends ServiceDispatcher {
+    private GSSCredential credentials;
+
+    public GSIServiceDispatcher(Map properties) throws Exception {
+        super(properties);
+    }
+
+    protected void setupThreadPool() throws Exception {
+        Subject subject = ContainerSecurityConfig.getConfig().getSubject();
+        if (subject == null) {
+            System.err.println(i18n.getMessage("noValidCreds"));
+            System.exit(1);
+        }
+        this.credentials = JaasGssUtil.getCredential(subject);
+        this.threadPool = new GSIServiceThreadPool(this.queue, this.engine,
+                                                   this.credentials);
+    }
+}
+
+
+class GSIServiceThreadPool extends ServiceThreadPool {
+    private GSSCredential credentials;
+
+    public GSIServiceThreadPool(
+        ServiceRequestQueue queue,
+        AxisEngine engine,
+        GSSCredential credentials) {
+        super(queue, engine);
+        this.credentials = credentials;
+    }
+
+    protected ServiceThread createThread() {
+        return new GSIServiceThread(
+            this.queue, this, this.engine, this.credentials);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/GSIServiceThread.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/GSIServiceThread.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/GSIServiceThread.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,146 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import java.io.OutputStream;
+
+import javax.security.auth.Subject;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.AxisEngine;
+
+import org.gridforum.jgss.ExtendedGSSContext;
+import org.gridforum.jgss.ExtendedGSSManager;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSManager;
+
+import org.globus.axis.gsi.GSIConstants;
+import org.globus.gsi.gssapi.GSSConstants;
+import org.globus.gsi.gssapi.net.GssSocket;
+import org.globus.gsi.gssapi.net.GssSocketFactory;
+import org.globus.gsi.jaas.GlobusPrincipal;
+import org.globus.wsrf.impl.security.authentication.Constants;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+
+class GSIServiceThread extends ServiceThread {
+    static Log logger = LogFactory.getLog(GSIServiceThread.class.getName());
+    private GSSCredential credentials;
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+
+    public GSIServiceThread(
+        ServiceRequestQueue queue,
+        ServiceThreadPool pool,
+        AxisEngine engine,
+        GSSCredential credentials
+    ) {
+        super(queue, pool, engine);
+        setCredentials(credentials);
+        logger.debug(getName() + ": Thread created");
+    }
+
+    public void setCredentials(GSSCredential credentials) {
+        this.credentials = credentials;
+    }
+
+    protected String getProtocol() {
+        return "https";
+    }
+
+    protected void process(ServiceRequest request) {
+        logger.debug(getName() + ": processing requests");
+
+        GSSManager manager = ExtendedGSSManager.getInstance();
+
+        GssSocket gsiSocket = null;
+        OutputStream out = null;
+
+        try {
+            ExtendedGSSContext context =
+                (ExtendedGSSContext) manager.createContext(this.credentials);
+
+            context.setOption(GSSConstants.GSS_MODE, GSIConstants.MODE_SSL);
+
+            context.setOption(GSSConstants.ACCEPT_NO_CLIENT_CERTS,
+                              Boolean.TRUE);
+
+            GssSocketFactory factory = GssSocketFactory.getDefault();
+
+            gsiSocket =
+                (GssSocket) factory.createSocket(
+                    request.getSocket(), null, 0, context
+                );
+
+            // server socket
+            gsiSocket.setUseClientMode(false);
+            gsiSocket.setAuthorization(null);
+
+            // forces handshake
+            out = gsiSocket.getOutputStream();
+
+            String globusID = context.getSrcName().toString();
+
+            logger.debug(getName() + ": Authenticated globus user: " + globusID);
+
+            Subject subject = getSubject();
+            subject.getPrincipals().add(new GlobusPrincipal(globusID));
+
+            // Don't set the context since it interferes with secure conversation
+            //this.msgContext.setProperty(Constants.CONTEXT, context);
+
+            if (context.getConfState()) {
+                this.msgContext.setProperty(Constants.GSI_TRANSPORT,
+                                            Constants.ENCRYPTION);
+            } else if (context.getIntegState()) {
+                this.msgContext.setProperty(Constants.GSI_TRANSPORT,
+                                            Constants.SIGNATURE);
+            } else {
+                this.msgContext.setProperty(Constants.GSI_TRANSPORT,
+                                            Constants.NONE);
+            }
+        } catch (Exception e) {
+            if (gsiSocket != null) {
+                try {
+                    gsiSocket.close();
+                } catch (Exception ee) {
+                }
+            }
+            logger.error(i18n.getMessage("requestFailed"), e);
+
+            return;
+        }
+
+        ServiceRequest req =
+            new ServiceRequest(gsiSocket, request.getServerSocket());
+        super.process(req);
+    }
+
+    protected Subject getSubject() {
+        Subject subject =
+            (Subject) msgContext.getProperty(Constants.PEER_SUBJECT);
+
+        if (subject == null) {
+            subject = new Subject();
+            msgContext.setProperty(Constants.PEER_SUBJECT, subject);
+        }
+
+        return subject;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/Lock.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/Lock.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/Lock.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import EDU.oswego.cs.dl.util.concurrent.ReentrantLock;
+
+/**
+ * This class is a simple reentrant lock implementation.
+ */
+public class Lock extends ReentrantLock {
+
+    private LockManager lockManager;
+    private Object key;
+    
+    public Lock(LockManager lockManager, Object key) {
+        this.lockManager = lockManager;
+        this.key = key;
+    }
+
+    public synchronized void release() {
+        super.release();
+        if (this.holds_ == 0 && this.lockManager != null) {
+            this.lockManager.removeLock(this.key);
+        }
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/LockManager.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/LockManager.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/LockManager.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,45 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Manages a set of locks.
+ */
+public class LockManager {
+    
+    private Map locks;
+    
+    public LockManager() {
+        this.locks = new HashMap();
+    }
+    
+    public synchronized Lock getLock(Object key) {
+        Lock lock = (Lock)this.locks.get(key);
+        if (lock == null) {
+            lock = new Lock(this, key);
+            this.locks.put(key, lock);
+        }
+        return lock;
+    }
+    
+    public synchronized Lock removeLock(Object key) {
+        return (Lock)this.locks.remove(key);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/SecureContainerException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/SecureContainerException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/SecureContainerException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,39 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+public class SecureContainerException extends ContainerException
+{
+    public SecureContainerException()
+    {
+        super();
+    }
+
+    public SecureContainerException(String s)
+    {
+        super(s);
+    }
+
+    public SecureContainerException(String s, Throwable exception)
+    {
+        super(s, exception);
+    }
+
+    public SecureContainerException(Throwable exception)
+    {
+        super(exception);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/Semaphore.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/Semaphore.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/Semaphore.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,60 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+
+/**
+ * This class implements a simple semaphore for thread synchronization.
+ */
+public class Semaphore {
+
+    private int semaphore;
+    
+    public Semaphore() {
+        this(0);
+    }
+    
+    public Semaphore(int initialValue) {
+        this.semaphore = initialValue;
+    }
+
+    public void acquire() throws InterruptedException {
+        waitForSignal();
+    }
+
+    public synchronized void waitForSignal() throws InterruptedException {
+        if (this.semaphore > 0) {
+            this.semaphore--;
+            return;
+        }
+        
+        while (semaphore < 1) {
+            wait();
+        }
+
+        this.semaphore--;
+    }
+
+    public void release() {
+        sendSignal();
+    }
+    
+    public synchronized void sendSignal() {
+        this.semaphore++;
+        notify();
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceContainer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceContainer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceContainer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,468 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.net.ServerSocket;
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.rpc.Stub;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.AxisEngine;
+
+import org.oasis.wsrf.properties.GetResourceProperty;
+import org.oasis.wsrf.properties.WSResourcePropertiesServiceLocator;
+import org.oasis.wsrf.properties.GetResourcePropertyResponse;
+import org.oasis.wsrf.servicegroup.EntryType;
+
+import org.globus.axis.gsi.GSIConstants;
+import org.globus.gsi.gssapi.auth.NoAuthorization;
+import org.globus.net.ServerSocketFactory;
+import org.globus.util.I18n;
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.config.ContainerConfig;
+import org.globus.wsrf.encoding.ObjectDeserializer;
+import org.globus.wsrf.utils.FaultHelper;
+import org.globus.wsrf.utils.Resources;
+
+import org.globus.gsi.jaas.JaasGssUtil;
+
+import javax.security.auth.Subject;
+
+import org.globus.wsrf.impl.security.descriptor.ContainerSecurityConfig;
+
+import org.ietf.jgss.GSSCredential;
+
+/**
+ * Http Server that can be used in embedded or standalone mode to host
+ * Axis services.
+ */
+public class ServiceContainer {
+
+    static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public static final String HARD_SHUTDOWN = "hardShutdown";
+
+    public static final int DEFAULT_PORT = 8080; //default port
+    public static final int DEFAULT_SECURE_PORT = 8443; //default secure port
+
+    public static final String PORT = "container.port";
+    public static final String CLASS = "container.class";
+    public static final String MAIN_THREAD = "container.mainThread";
+    public static final String THREADS = "container.threads";
+    public static final String SERVER_CONFIG = "container.server.config";
+    public static final String SECURITY_DESCRIPTOR_FILE =
+        "container.securityDesc.file";
+
+    protected URL url;
+    protected ServiceDispatcher dispatcher;
+    protected Map properties;
+    private int references = 0;
+
+    protected static Hashtable containers = new Hashtable();
+
+    private static Log logger =
+        LogFactory.getLog(ServiceContainer.class.getName());
+
+    public static ServiceContainer createContainer(boolean isMainThread)
+        throws ContainerException {
+        Properties props = new Properties();
+        props.put(MAIN_THREAD, (isMainThread) ? Boolean.TRUE : Boolean.FALSE);
+        return ServiceContainer.createContainer(props);
+    }
+
+    public static ServiceContainer createContainer(boolean isMainThread,
+                                                   int port)
+        throws ContainerException {
+        Properties props = new Properties();
+        props.put(MAIN_THREAD, (isMainThread) ? Boolean.TRUE : Boolean.FALSE);
+        props.put(PORT, new Integer(port));
+        return ServiceContainer.createContainer(props);
+    }
+
+    public static synchronized ServiceContainer createContainer(Map properties)
+        throws ContainerException {
+        if (properties == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("containerPropertiesNotSpecified")
+            );
+        }
+
+        ServiceContainer container =
+            (ServiceContainer) containers.get(properties);
+
+        if (container == null) {
+            Class containerClass = null;
+            String prop = (String) properties.get(CLASS);
+            if (prop == null) {
+                containerClass = ServiceContainer.class;
+            } else {
+                try {
+                    containerClass = Class.forName(prop);
+                } catch (Exception e) {
+                    throw new ContainerException(e);
+                }
+
+                if (!ServiceContainer.class.isAssignableFrom(containerClass)) {
+                    throw new ContainerException(
+                        ServiceContainer.i18n.getMessage(
+                            "containerClassError", prop));
+                }
+            }
+
+            try {
+                Constructor con =
+                    containerClass.getConstructor(new Class[] { Map.class });
+
+                container = (ServiceContainer)
+                    con.newInstance(new Object[] { properties });
+            } catch (InvocationTargetException e) {
+                Throwable ex = e.getTargetException();
+                if (ex instanceof SecureContainerException) {
+                    throw (SecureContainerException)ex;
+                } else if (ex instanceof ContainerException) {
+                    throw (ContainerException)ex;
+                } else if (ex instanceof Exception) {
+                    throw new ContainerException((Exception)ex);
+                } else {
+                    throw new ContainerException(e);
+                }
+            } catch (Exception e) {
+                throw new ContainerException(e);
+            }
+        }
+
+        synchronized (container) {
+            container.references++;
+        }
+
+        return container;
+    }
+
+    /* Used by subclasses only */
+    protected ServiceContainer() {
+    }
+
+    public ServiceContainer(Map properties) throws ContainerException {
+        if (properties == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("containerPropertiesNotSpecified")
+            );
+        }
+
+        this.properties = properties;
+
+        // get port
+        int port = 0;
+        Integer portProp = (Integer) properties.get(PORT);
+
+        if (portProp != null) {
+            port = portProp.intValue();
+        }
+
+        // get main thread
+        boolean isMainThread = false;
+        Boolean threadProp = (Boolean) properties.get(MAIN_THREAD);
+
+        if (threadProp != null) {
+            isMainThread = threadProp.booleanValue();
+        }
+
+        // get num of threads
+        int threads = -1;
+        Integer threadsProp = (Integer) properties.get(THREADS);
+
+        if (threadsProp != null) {
+            threads = threadsProp.intValue();
+        }
+
+        try {
+            start(isMainThread, port, threads);
+        } catch (ContainerException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new ContainerException(
+                i18n.getMessage("containerInitError"), e);
+        }
+    }
+
+    protected void start(boolean isMainThread, int port, int threads)
+        throws Exception {
+
+        this.dispatcher = new ServiceDispatcher(this.properties);
+
+        ServerSocketFactory factory = ServerSocketFactory.getDefault();
+        ServerSocket socket = factory.createServerSocket(port);
+
+        this.dispatcher.setThreads(threads);
+        this.dispatcher.setServerSocket(socket);
+        this.dispatcher.start(!isMainThread);
+
+        ServiceHost.setDefaults("http", socket.getLocalPort());
+
+        ContainerConfig engConfig =
+            ContainerConfig.getConfig(this.dispatcher.getAxisEngine());
+        this.url =
+            new URL("http",
+                    ServiceHost.getHost(this.dispatcher.getAxisEngine()),
+                    socket.getLocalPort(),
+                    "/" + engConfig.getWSRFLocation());
+
+        logger.debug("Starting server: " + this.url);
+
+        ServiceContainerCollection.register(getURLString(), this);
+        containers.put(properties, this);
+    }
+
+    public synchronized void stop() throws ContainerException {
+        if (this.references > 0) {
+            this.references--;
+        }
+        if (this.references == 0) {
+            try {
+                close();
+            } catch (IOException e) {
+                throw new ContainerException(
+                    i18n.getMessage("containerStopError"), e);
+            }
+        }
+    }
+
+    protected synchronized void close() throws IOException {
+        logger.debug("Stopping server: " + getURLString());
+        dispatcher.stop();
+        ServiceContainerCollection.unregister(getURLString());
+        containers.remove(properties);
+    }
+
+    public boolean isRunning() {
+        return !this.dispatcher.isStopped();
+    }
+
+    public int getPort() {
+        return this.url.getPort();
+    }
+
+    public String getHost() {
+        return this.url.getHost();
+    }
+
+    public String getURLString() {
+        return this.url.toString();
+    }
+
+    public URL getURL() {
+        return this.url;
+    }
+
+    public void waitForInit() throws InterruptedException {
+        dispatcher.waitForInit();
+    }
+
+    public void waitForStop() throws InterruptedException {
+        dispatcher.waitForStop();
+    }
+
+    public AxisEngine getEngine() {
+        return dispatcher.getAxisEngine();
+    }
+
+
+    public static void main(String[] args) {
+        //TODO: i18n?
+        String usageMsg =
+            "Usage: ServiceContainer [options]\n" +
+            "Where [options] are:\n" +
+            " -help                    Displays this message\n" +
+            " -p <port>                Sets container port number\n" +
+            " -quiet                   Does not show list of services at startup\n" +
+            " -nosec                   Start a non secure (http) container\n" +
+            " -containerDesc <file>    Sets container security descriptor file\n" +
+            " -profile <name>          Specifies different configuration profile\n" +
+            "";
+
+        int port = -1;
+        boolean secure = true;
+        boolean quiet = false;
+        boolean debug = false;
+        String containerDescFile = null;
+        String profile = null;
+
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].equals("-p")) {
+                if ((i + 1) == args.length) {
+                    exit("Error: -p requires an argument.");
+                }
+                port = Integer.parseInt(args[++i]);
+            } else if (args[i].equalsIgnoreCase("-nosec")) {
+                secure = false;
+            } else if (args[i].equalsIgnoreCase("-debug")) {
+                debug = true;
+            } else if (args[i].equalsIgnoreCase("-help")) {
+                exit(usageMsg);
+            } else if (args[i].equalsIgnoreCase("-containerDesc")) {
+                if ((i + 1) == args.length) {
+                    exit("Error: -containerDesc requires an argument.");
+                }
+                containerDescFile = args[++i];
+            } else if (args[i].equalsIgnoreCase("-quiet")) {
+                quiet = true;
+            } else if (args[i].equalsIgnoreCase("-profile")) {
+                if ((i + 1) == args.length) {
+                    exit("Error: -profile requires an argument.");
+                }
+                profile = args[++i];
+            } else {
+                exit("Error: argument not recognized: " + args[i]);
+            }
+        }
+
+        if (port == -1) {
+            port = (secure) ? DEFAULT_SECURE_PORT : DEFAULT_PORT;
+        }
+
+        Map properties = new Hashtable();
+        properties.put(MAIN_THREAD, Boolean.FALSE);
+        properties.put(PORT, new Integer(port));
+
+        // Put security descriptor if its not null
+        if (containerDescFile != null) {
+            properties.put(SECURITY_DESCRIPTOR_FILE, containerDescFile);
+        }
+
+        try {
+
+            if (profile != null) {
+                properties.put(ContainerConfig.CONFIG_PROFILE, profile);
+            }
+
+
+            // start the container
+            ServiceContainer container;
+            if (secure) {
+                container =
+                    ServiceContainer.startSecurityContainer(properties);
+            } else {
+                container = ServiceContainer.createContainer(properties);
+            }
+
+            // enable hard shutdown
+            System.setProperty(ServiceContainer.HARD_SHUTDOWN, "true");
+
+            // list services if needed
+            if (!quiet) {
+                listServices(container, secure, debug);
+            }
+
+            container.waitForInit();
+            container.waitForStop();
+
+            if (!quiet) {
+                System.out.println(
+                    ServiceContainer.i18n.getMessage("stopServer",
+                                                     container.getURLString()));
+            }
+
+        } catch (Exception e) {
+            logger.debug("Failed to start container", e);
+            if (debug) {
+                 e.printStackTrace();
+                 System.exit(1);
+            } else {
+                exit("Failed to start container: " + e.getMessage());
+            }
+        }
+    }
+
+    public static ServiceContainer startSecurityContainer(Map properties)
+        throws ContainerException {
+        properties.put(ServiceContainer.CLASS,
+                       "org.globus.wsrf.container.GSIServiceContainer");
+
+        ServiceContainer container =
+            ServiceContainer.createContainer(properties);
+
+        ContainerConfig config =
+            ContainerConfig.getConfig(container.getEngine());
+        config.setOption("httpsPort", String.valueOf(container.getPort()));
+
+        return container;
+    }
+
+    private static void exit(String msg) {
+        System.err.println(msg);
+        System.exit(1);
+    }
+
+    private static void listServices(ServiceContainer container,
+                                     boolean secure,
+                                     boolean debug) {
+        WSResourcePropertiesServiceLocator locator =
+            new WSResourcePropertiesServiceLocator();
+
+        String registryService =
+            container.getURLString() + "ContainerRegistryService";
+
+        try {
+            GetResourceProperty port =
+                locator.getGetResourcePropertyPort(new URL(registryService));
+
+            if (secure) {
+                ((Stub) port)._setProperty(GSIConstants.GSI_AUTHORIZATION,
+                                           NoAuthorization.getInstance());
+                Subject subject =
+                    ContainerSecurityConfig.getConfig().getSubject();
+                GSSCredential cred = JaasGssUtil.getCredential(subject);
+                if (cred != null) {
+                    ((Stub) port)._setProperty(GSIConstants.GSI_CREDENTIALS,
+                                               cred);
+                }
+            }
+
+            GetResourcePropertyResponse response =
+                port.getResourceProperty(WSRFConstants.ENTRY);
+
+            Object[] entries =
+                ObjectDeserializer.toObject(response, EntryType.class);
+
+            System.out.println(
+                ServiceContainer.i18n.getMessage("startServer",
+                                                 container.getURLString()));
+
+            for (int i=0;i<entries.length;i++) {
+                EntryType entry = (EntryType)entries[i];
+                System.out.println("[" + (i+1) + "]: " +
+                                   entry.getMemberServiceEPR().getAddress());
+            }
+        } catch (Exception e) {
+            if (debug) {
+                FaultHelper.printStackTrace(e);
+            }
+            exit("Failed to obtain a list of services from '" +
+                 registryService + "' service: " + FaultHelper.getMessage(e));
+        }
+    }
+
+}
+

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceContainerCollection.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceContainerCollection.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceContainerCollection.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,63 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.io.IOException;
+
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+public class ServiceContainerCollection {
+    private static Hashtable containers = new Hashtable();
+
+    static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    static Log logger =
+        LogFactory.getLog(ServiceContainerCollection.class.getName());
+
+    public static void register(String name, ServiceContainer container) {
+        containers.put(name, container);
+    }
+
+    public static void unregister(String name) {
+        containers.remove(name);
+    }
+
+    public static ServiceContainer get(String name) {
+        return (ServiceContainer) containers.get(name);
+    }
+
+    public static void stopAll(boolean force) throws ContainerException {
+        for (Enumeration e = containers.elements(); e.hasMoreElements();) {
+            ServiceContainer container = (ServiceContainer) e.nextElement();
+            if (force) {
+                try {
+                    container.close();
+                } catch (IOException ex) {
+                    throw new ContainerException(
+                        i18n.getMessage("containerStopError"), ex);
+                }
+            } else {
+                container.stop();
+            }
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceDispatcher.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceDispatcher.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceDispatcher.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,285 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.AxisEngine;
+import org.apache.axis.Constants;
+import org.apache.axis.MessageContext;
+import org.apache.axis.server.AxisServer;
+import org.apache.axis.configuration.DirProvider;
+
+import org.globus.tools.DeployConstants;
+import org.globus.util.I18n;
+import org.globus.wsrf.config.ContainerConfig;
+import org.globus.wsrf.utils.Resources;
+
+import org.globus.wsrf.impl.security.descriptor.ContainerSecurityConfig;
+
+/**
+ * Dispatcher reading requests off the socket and putting them into a
+ * request queue.
+ */
+public class ServiceDispatcher implements Runnable {
+
+    static Log logger =
+        LogFactory.getLog(ServiceDispatcher.class.getName());
+
+    static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private ServerSocket serverSocket;
+    private volatile Thread worker = null;
+    private volatile boolean stopped = false;
+    private Semaphore semaphore = new Semaphore();
+    protected ServiceRequestQueue queue;
+    protected ServiceThreadPool threadPool;
+    protected int numThreads;
+    protected int maxThreads;
+    protected int highWaterMark;
+    protected AxisServer engine;
+
+    protected ServiceDispatcher() {}
+
+    public ServiceDispatcher(Map properties) throws Exception {
+        // single file configuration
+        // this.engine = new AxisServer(new FileProvider(config));
+
+        String configFile =
+            (String)properties.get(ServiceContainer.SERVER_CONFIG);
+        configFile = (configFile == null) ?
+            ContainerConfig.DEFAULT_SERVER_CONFIG : configFile;
+
+        String configProfile =
+            (String)properties.get(ContainerConfig.CONFIG_PROFILE);
+        if (configProfile != null) {
+            configFile = configProfile + "-" + configFile;
+        }
+
+        String baseDir = ContainerConfig.getGlobusLocation() +
+            File.separator + DeployConstants.CONFIG_BASE_DIR;
+
+        // Initialize engine and message context
+        this.engine = new AxisServer(new DirProvider(baseDir, configFile));
+        MessageContext msgContext = new MessageContext(this.engine);
+        msgContext.setProperty(Constants.MC_HOME_DIR,
+                               ServiceThread.getWebRootPath(this.engine));
+        msgContext.setProperty(Constants.MC_CONFIGPATH,
+                               ServiceThread.getConfigRootPath(this.engine));
+        if (configProfile != null) {
+            msgContext.setProperty(ContainerConfig.CONFIG_PROFILE,
+                                   configProfile);
+        }
+
+        // Initialize container security config, if file is confgiured
+        // off command line
+        String containerSecDesc = 
+            (String)properties.get(ServiceContainer.SECURITY_DESCRIPTOR_FILE);
+        ContainerSecurityConfig config = null;
+        if (containerSecDesc != null) {
+            config = ContainerSecurityConfig.getConfig(containerSecDesc);
+        }
+        
+        // if container config is not initialized off command line,
+        // this will do it.
+        ServiceManager.getServiceManager(this.engine).start(msgContext);
+
+        this.queue = new ServiceRequestQueue();
+        setupThreadPool();
+        this.numThreads = -1;
+    }
+
+    protected void setupThreadPool() throws Exception {
+        this.threadPool = new ServiceThreadPool(this.queue, this.engine);
+    }
+
+    public AxisEngine getAxisEngine() {
+        return this.engine;
+    }
+
+    public void setServerSocket(ServerSocket serverSocket) {
+        this.serverSocket = serverSocket;
+    }
+
+    public ServerSocket getServerSocket() {
+        return this.serverSocket;
+    }
+
+    public void setThreads(int numThreads) {
+        this.numThreads = numThreads;
+    }
+
+    public void run() {
+        ContainerConfig config = ContainerConfig.getConfig(this.engine);
+        if (numThreads <= 0) {
+            try {
+                String containerThreads =
+                    config.getOption(ContainerConfig.CONTAINER_THREADS);
+
+                if (containerThreads != null) {
+                    numThreads = Integer.parseInt(containerThreads);
+                }
+
+                String containerMaxThreads =
+                    config.getOption(ContainerConfig.CONTAINER_THREADS_MAX);
+
+                if (containerMaxThreads != null) {
+                    maxThreads = Integer.parseInt(containerMaxThreads);
+                }
+
+                String containerWaterMarkThreads =
+                    config.getOption(ContainerConfig.CONTAINER_THREADS_WATERMARK);
+
+                if (containerWaterMarkThreads != null) {
+                    highWaterMark = Integer.parseInt(containerWaterMarkThreads);
+                }
+            } catch (Exception e) {
+                logger.error(i18n.getMessage("configError",
+                                             "containerThreads"), e);
+            }
+        }
+
+        if (numThreads < 2) {
+            numThreads = 2;
+        }
+
+        if (maxThreads == 0) {
+            maxThreads = numThreads * 4;
+        }
+
+        if (highWaterMark == 0) {
+            highWaterMark = numThreads * 2;
+        }
+
+        logger.debug("Starting up Container with " + numThreads + " threads");
+        this.threadPool.startThreads(numThreads);
+        this.semaphore.sendSignal();
+
+        int addedThreads = 0;
+
+        while (!isStopped()) {
+            Socket socket = null;
+
+            try {
+                socket = serverSocket.accept();
+            } catch (IOException ioe) {
+                break;
+            }
+
+            int waitingThreads =
+                this.queue.enqueue(new ServiceRequest(socket, serverSocket));
+
+            if (logger.isDebugEnabled()) {
+                logger.debug("waiting threads: " + waitingThreads);
+            }
+
+            if ((waitingThreads == 0) &&
+                (this.threadPool.getThreads() < maxThreads)) {
+                addedThreads += startThreads(1);
+                logger.debug("added threads " + addedThreads);
+            } else if (waitingThreads > highWaterMark) {
+                int stoppingThreads = waitingThreads - numThreads;
+                logger.debug(
+                    "requesting " + stoppingThreads +
+                    " threads to be stopped - water mark: " + highWaterMark
+                );
+
+                if (addedThreads >= stoppingThreads) {
+                    this.threadPool.stopThreads(stoppingThreads);
+                    addedThreads -= stoppingThreads;
+                }
+            }
+        }
+    }
+
+    public void waitForInit() throws InterruptedException {
+        this.semaphore.waitForSignal();
+    }
+
+    public void waitForStop() throws InterruptedException {
+        this.threadPool.waitForThreads();
+        logger.debug("Stopping dispatcher");
+    }
+
+    private synchronized int startThreads(int num) {
+        if (this.stopped) {
+            return 0;
+        }
+        this.threadPool.startThreads(num);
+        return num;
+    }
+
+    public synchronized void stop() throws IOException {
+        if (this.stopped) {
+            return;
+        }
+
+        this.stopped = true;
+
+        logger.debug("Stopping threads");
+
+        // close server socket first
+        // so that no more connection can be made
+        try {
+            this.serverSocket.close();
+        } finally {
+            // and then stop all running threads
+            if (threadPool != null) {
+                this.threadPool.stopThreads();
+            }
+
+            logger.debug("threads stopped interrupting worker");
+
+            if (worker != null) {
+                worker.interrupt();
+            }
+
+            ServiceManager.getServiceManager(this.engine).stop();
+
+            // TODO: should wait for all threads
+            // to actaully finish?
+            if (this.engine != null) {
+                this.engine.cleanup();
+            }
+
+            logger.debug("Stopped threads");
+        }
+    }
+
+    public synchronized boolean isStopped() {
+        return this.stopped;
+    }
+
+    /**
+     * Start this dispatcher.
+     *
+     * Spawns a worker thread to listen for HTTP requests.
+     *
+     * @param daemon a boolean indicating if the thread should be a daemon.
+     */
+    public void start(boolean daemon) {
+        this.worker = new Thread(this);
+        this.worker.setDaemon(daemon);
+        this.worker.start();
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceHost.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceHost.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceHost.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,247 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import org.globus.common.CoGProperties;
+import org.globus.wsrf.config.ContainerConfig;
+import org.globus.axis.util.Util;
+
+import org.apache.axis.MessageContext;
+import org.apache.axis.AxisEngine;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+/**
+* Host lookup used to support multi-homed host configurations
+*/
+public class ServiceHost {
+
+    public static final String PROXY_PORT_PROPERTY = 
+        "org.globus.wsrf.proxy.port";
+
+    private static final Log logger =
+        LogFactory.getLog(ServiceHost.class.getName());
+
+    private static boolean defaultsSet = false;
+    private static int defaultPort = 8443;
+    private static String defaultProtocol = "https";
+    private static String hostCache;
+
+    static {
+        Util.registerTransport();
+    }
+
+    protected static synchronized void setDefaults(String protocol, int port) {
+        if (!defaultsSet) {
+            defaultProtocol = protocol;
+            defaultPort = port;
+            defaultsSet = true;
+        }
+    }
+
+    private static URL getEndpoint(MessageContext messageContext) 
+        throws MalformedURLException {
+        String address =
+            (String) messageContext.getProperty(MessageContext.TRANS_URL);
+        return (address == null) ? null : new URL(address);
+    }
+    
+    public static URL getDefaultBaseURL() throws IOException {
+        return getBaseURL(null);
+    }
+    
+    public static URL getBaseURL() 
+        throws IOException {
+        return getBaseURL(MessageContext.getCurrentContext());
+    }
+
+    public static URL getBaseURL(MessageContext context) 
+        throws IOException {
+        ContainerConfig config = null;
+        String protocol;
+        int port;
+        String host;
+        if (context == null) {
+            config = ContainerConfig.getConfig();
+            protocol = defaultProtocol;
+            port = defaultPort;
+            host = getDefaultHost();
+        } else {
+            config = ContainerConfig.getConfig(context.getAxisEngine());
+            URL address = getEndpoint(context);
+            if (address == null) {
+                protocol = defaultProtocol;
+                port = defaultPort;
+            } else {
+                protocol = address.getProtocol();
+                port = address.getPort();
+            }
+            host = ServiceHost.getHost(config);
+        }
+        
+        String proxyPort = System.getProperty(PROXY_PORT_PROPERTY);
+        if (proxyPort != null) {
+            port = Integer.parseInt(proxyPort);
+        }
+
+        return new URL(protocol, host, port, 
+                       "/" + config.getWSRFLocation());
+    }
+
+    public static int getDefaultPort() {
+        return getPort(null);
+    }
+
+    public static int getPort(MessageContext context) {
+        if (context == null) {
+            return defaultPort;
+        }
+        URL url = null;
+        try {
+            url = getEndpoint(context);
+        } catch (IOException e) {
+            logger.debug("", e);
+            return defaultPort;
+        }
+        if (url == null) {
+            return defaultPort;
+        }
+        int port = url.getPort();
+        if (port == -1) {
+            String protocol = url.getProtocol();
+            if (protocol.equalsIgnoreCase("http")) {
+                port = 80;
+            } else if (protocol.equalsIgnoreCase("https")) {
+                port = 443;
+            } else {
+                // unknown protocol
+                port = defaultPort;
+            }
+        }
+        return port;
+    }
+    
+    public static String getDefaultProtocol() {
+        return getProtocol(null);
+    }
+
+    public static String getProtocol(MessageContext context) {
+        if (context == null) {
+            return defaultProtocol;
+        }
+        URL url = null;
+        try {
+            url = getEndpoint(context);
+        } catch (IOException e) {
+            logger.debug("", e);
+            return defaultProtocol;
+        }
+        return (url == null) ? defaultProtocol : url.getProtocol();
+    }
+    
+    public static String getDefaultHost() 
+        throws IOException {
+        if (ServiceHost.hostCache == null) {
+            synchronized(ServiceHost.class) {
+                if (ServiceHost.hostCache == null) {
+                    ServiceHost.hostCache = 
+                        getHost(ContainerConfig.getConfig());
+                }
+            }
+        }
+        return ServiceHost.hostCache;
+    }
+
+    public static String getHost(MessageContext context) 
+        throws IOException {
+        if (context == null) {
+            return getDefaultHost();
+        } else {
+            return getHost(context.getAxisEngine());
+        }
+    }
+
+    public static String getHost(AxisEngine engine)
+        throws IOException {
+        if (engine == null) {
+            return getDefaultHost();
+        } else {
+            return getHost(ContainerConfig.getConfig(engine));
+        }
+    }
+
+    public static String getHost(ContainerConfig config)
+        throws IOException {
+        InetAddress localHost = null;
+        
+        String disableDNSConfig = 
+            config.getOption(ContainerConfig.DISABLE_DNS);
+        
+        boolean disableDNS = 
+            (disableDNSConfig == null) ? 
+                false
+                : disableDNSConfig.equalsIgnoreCase("true");
+        
+        String logicalHostName = 
+            config.getOption(ContainerConfig.LOGICAL_HOST);
+        if (logicalHostName == null) {
+            logicalHostName = CoGProperties.getDefault().getHostName();
+        }
+        
+        String host = null;
+        
+        if (!disableDNS) {
+            if (logicalHostName != null) {
+                localHost = InetAddress.getByName(logicalHostName);
+            } else {
+                localHost = InetAddress.getLocalHost();
+            }
+            
+            // Determine whether we should publish IP or hostname
+            String publishHost =
+                config.getOption(ContainerConfig.PUBLISH_HOST_NAME);
+            
+            boolean publishHostName = (publishHost != null &&
+                publishHost.equalsIgnoreCase("true"));
+            
+            if (publishHostName) {
+                host = localHost.getHostName();
+            } else {
+                host = localHost.getHostAddress();
+            }
+        } else if (logicalHostName != null) {
+            host = logicalHostName;
+        }
+        
+        if (host == null) {
+            host = "localhost";
+        } else if (host.indexOf(".") == -1) {
+            String domainName = config.getOption(ContainerConfig.DOMAIN_NAME);
+            
+            if (domainName != null) {
+                host = host + "." + domainName;
+            }
+        }
+        
+        return host;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceInitHandler.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceInitHandler.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceInitHandler.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,35 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.MessageContext;
+import org.apache.axis.handlers.BasicHandler;
+
+public class ServiceInitHandler extends BasicHandler {
+
+    public void invoke(MessageContext messageContext) throws AxisFault {
+        try {
+            ServiceManager.initializeService(messageContext);
+        } catch (AxisFault e) {
+            throw e;
+        } catch (Exception e) {
+            throw AxisFault.makeFault(e);
+        }
+    }
+    
+}
+

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceManager.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceManager.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceManager.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,255 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+
+import javax.security.auth.Subject;
+
+import org.apache.axis.server.AxisServer;
+import org.apache.axis.MessageContext;
+import org.apache.axis.EngineConfiguration;
+import org.apache.axis.WSDDEngineConfiguration;
+import org.apache.axis.AxisEngine;
+import org.apache.axis.deployment.wsdd.WSDDDeployment;
+import org.apache.axis.deployment.wsdd.WSDDService;
+import org.apache.axis.handlers.soap.SOAPService;
+import org.apache.axis.description.ServiceDesc;
+
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.NoResourceHomeException;
+import org.globus.wsrf.jndi.JNDIUtils;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.security.SecurityManager;
+import org.globus.wsrf.impl.security.descriptor.ServiceSecurityConfig;
+import org.globus.axis.description.ServiceDescUtil;
+import org.globus.gsi.jaas.JaasSubject;
+import org.globus.util.I18n;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * This class manages a set of services. It it used to startup, intialize
+ * deploy and undeploy services.
+ */
+public class ServiceManager {
+    
+    public static final String LOAD_STARTUP_PARAM = 
+        "loadOnStartup";
+
+    private static I18n i18n = 
+        I18n.getI18n(Resources.class.getName());
+
+    private static Log logger =
+        LogFactory.getLog(ServiceManager.class.getName());
+
+    private static Hashtable managers = new Hashtable();
+
+    private AxisServer engine;
+    private WSDDDeployment deployment;
+    private MessageContext ctx;
+    
+    private static final String INITIALIZED =
+        "org.globus.wsrf.container.service.initialized";
+
+    public ServiceManager(AxisServer engine) {
+        if (engine == null) {
+            throw new IllegalArgumentException();
+        }
+        this.engine = engine;
+        EngineConfiguration config = this.engine.getConfig();
+        if (!(config instanceof WSDDEngineConfiguration)) {
+            throw new IllegalArgumentException();
+        }
+        this.deployment =
+            ((WSDDEngineConfiguration)config).getDeployment();
+    }
+    
+    public static synchronized ServiceManager 
+        getServiceManager(AxisServer engine) {
+        ServiceManager manager = (ServiceManager)managers.get(engine);
+        if (manager == null) {
+            manager = new ServiceManager(engine);
+            managers.put(engine, manager);
+        }
+        return manager;
+    }
+
+    /**
+     * Called when a container is starting up.
+     */
+    public void start(MessageContext msgCtx) throws Exception {
+        logger.debug("Starting engine: " + this.engine);
+
+        this.ctx = msgCtx;
+
+        // step 1: initialize the entire JNDI tree
+        //         this does not initialize the resource homes
+        JNDIUtils.initializeDir(msgCtx);
+
+        // step 2: find and initialize service with
+        //         load on start up option
+        WSDDService[] services = this.deployment.getServices();
+
+        MessageContext oldCtx = HelperAxisEngine.getCurrentMessageContext();
+        HelperAxisEngine.setCurrentMessageContext(msgCtx);
+        try {
+            for (int i=0;i<services.length;i++) {
+                if ("true".equalsIgnoreCase(
+                         services[i].getParameter(LOAD_STARTUP_PARAM))) {
+                    String serviceName = 
+                        services[i].getQName().getLocalPart();
+                    msgCtx.setTargetService(serviceName);
+                    try {
+                        initializeService(msgCtx);
+                    } catch (Exception e) {
+                        throw new ContainerException(
+                           i18n.getMessage("failedInitService", serviceName), 
+                           e);
+                    }
+                }
+            }
+        } finally {
+            HelperAxisEngine.setCurrentMessageContext(oldCtx);
+        }
+    }
+
+    public MessageContext createMessageContext(String serviceName) 
+        throws Exception {
+        MessageContext newCtx = new MessageContext(this.engine);
+        Iterator iter = this.ctx.getAllPropertyNames();
+        while(iter.hasNext()) {
+            String propName = (String)iter.next();
+            Object propValue = this.ctx.getProperty(propName);
+            newCtx.setProperty(propName, propValue);
+        }
+        newCtx.setTargetService(serviceName);
+        return newCtx;
+    }
+
+    /**
+     * Initializes service description and resource home of the 
+     * service currently associated with the givem MessageContext.
+     */
+    public static void initializeService(MessageContext ctx)
+        throws Exception {
+        String serviceName = ctx.getTargetService();
+        SOAPService service = ctx.getService();
+
+        // check if target service is non null and
+        // actual service is set
+        if (serviceName == null || service == null) {
+            return;
+        }
+
+        ServiceDesc serviceDesc =
+            service.getInitializedServiceDesc(ctx);
+
+        // check if already initalized
+        if (serviceDesc.getProperty(INITIALIZED) != null) {
+            return;
+        }
+
+        synchronized (serviceDesc) {
+            if (serviceDesc.getProperty(INITIALIZED) != null) {
+                return;
+            }
+            logger.debug("Activating service: " + serviceName);
+            
+            // forces the service security to be initialized
+            ServiceSecurityConfig.initialize(ctx);
+            
+            Subject subject = 
+                SecurityManager.getManager().getServiceSubject(serviceName);
+
+            if (subject == null) {
+                InitPrivilegedAction.initialize(ctx);
+            } else {
+                try {
+                    JaasSubject.doAs(subject, new InitPrivilegedAction(ctx));
+                } catch (PrivilegedActionException e) {
+                    throw e.getException();
+                }
+            }
+
+            logger.debug("Activated service: " + serviceName);
+            serviceDesc.setProperty(INITIALIZED, Boolean.TRUE);
+        }
+    }
+    
+    /**
+     * Called when container is being shut down.
+     */
+    public void stop() {
+        logger.debug("Stopping engine: " + this.engine);
+        managers.remove(this.engine);
+    }
+    
+    private static class InitPrivilegedAction 
+        implements PrivilegedExceptionAction {
+
+        private MessageContext ctx = null;
+
+        public InitPrivilegedAction(MessageContext ctx) {
+            this.ctx = ctx;
+        }
+
+        public static void initialize(MessageContext ctx) 
+            throws Exception {
+            // forces the service description to be updated
+            ServiceDescUtil.initializeService(ctx);
+            
+            // forces the resource home to be initialized
+            ResourceContext rctx = ResourceContext.getResourceContext(ctx);
+            try {
+                rctx.getResourceHome();
+            } catch (NoResourceHomeException e) {
+                // that's acceptible
+            }
+        }
+
+        public Object run() throws Exception {
+            initialize(this.ctx);
+            return null;
+        }
+    }
+
+    public static class HelperAxisEngine extends AxisEngine {
+
+        public HelperAxisEngine() {
+            super(null);
+        }
+
+        public void init() {
+        }
+
+        public AxisEngine getClientEngine() {
+            return null;
+        }
+
+        public void invoke(MessageContext ctx) {
+        }
+
+        public static void setCurrentMessageContext(MessageContext mc) {
+            AxisEngine.setCurrentMessageContext(mc);
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceRequest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceRequest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceRequest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,47 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import java.net.ServerSocket;
+import java.net.Socket;
+
+
+/**
+ * Requests constructed by dispatcher and put on queue to be read by
+ * worker threads.
+ * @see ServiceRequestQueue
+ * @see ServiceThread
+ */
+public class ServiceRequest {
+    private Socket socket;
+    private ServerSocket serverSocket;
+
+    public ServiceRequest(
+        Socket socket,
+        ServerSocket serverSocket
+    ) {
+        this.socket = socket;
+        this.serverSocket = serverSocket;
+    }
+
+    public Socket getSocket() {
+        return this.socket;
+    }
+
+    public ServerSocket getServerSocket() {
+        return this.serverSocket;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceRequestQueue.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceRequestQueue.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceRequestQueue.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,82 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import java.util.LinkedList;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * queue managing multithreaded request enqueuing and dequeueing
+ */
+public class ServiceRequestQueue {
+    LinkedList requests = new LinkedList();
+    int waitingThreads = 0;
+    static Log logger = LogFactory.getLog(ServiceRequestQueue.class.getName());
+    private Semaphore semaphore = new Semaphore();
+
+    public ServiceRequest dequeue()
+        throws NoSuchElementException, InterruptedException {
+        addWaitingThread();
+        semaphore.waitForSignal();
+        removeWaitingThread();
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("Getting request from queue");
+        }
+
+        Object request = null;
+
+        synchronized (this) {
+            request = this.requests.removeFirst();
+
+            if (!(request instanceof ServiceRequest)) {
+                throw new NoSuchElementException();
+            }
+        }
+
+        return (ServiceRequest) request;
+    }
+
+    private synchronized void addWaitingThread() {
+        this.waitingThreads++;
+    }
+
+    private synchronized void removeWaitingThread() {
+        this.waitingThreads--;
+    }
+
+    public synchronized int enqueue(ServiceRequest request) {
+        if (logger.isDebugEnabled()) {
+            logger.debug("Putting request in queue");
+        }
+
+        this.requests.addLast(request);
+        semaphore.sendSignal();
+
+        return this.waitingThreads;
+    }
+
+    public synchronized void stopThreads(int threads) {
+        for (int i = 0; i < threads; i++) {
+            this.requests.addFirst(new Object());
+            semaphore.sendSignal();
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceThread.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceThread.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceThread.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,901 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import org.globus.wsrf.utils.PerformanceLog;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.config.ContainerConfig;
+import org.globus.util.I18n;
+
+import org.apache.axis.AxisEngine;
+import org.apache.axis.AxisFault;
+import org.apache.axis.Constants;
+import org.apache.axis.Message;
+import org.apache.axis.MessageContext;
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.axis.message.SOAPFault;
+import org.apache.axis.transport.http.HTTPConstants;
+import org.apache.axis.transport.http.NonBlockingBufferedInputStream;
+import org.apache.axis.transport.http.ChunkedInputStream;
+import org.apache.axis.transport.http.ChunkedOutputStream;
+import org.apache.axis.utils.XMLUtils;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.w3c.dom.Document;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InterruptedIOException;
+import java.io.OutputStream;
+import java.io.FileNotFoundException;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketException;
+
+import java.util.NoSuchElementException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This class is responsible for reading the request from the request queue,
+ * format it, and pass it through the Axis engine.
+ */
+public class ServiceThread extends Thread {
+
+    private static Log logger =
+        LogFactory.getLog(ServiceThread.class.getName());
+
+    private static I18n i18n =
+        I18n.getI18n(Resources.class.getName());
+
+    private ServiceRequestQueue queue;
+    private ServiceThreadPool threadPool;
+    private AxisEngine engine;
+    protected MessageContext msgContext;
+    private NonBlockingBufferedInputStream is;
+    private Message responseMsg;
+
+    private StringBuffer soapAction;
+    private StringBuffer fileName;
+    private int httpRequest;
+    private boolean sendContentLength = true;
+    protected boolean http11;
+    private boolean chunked;
+
+    static PerformanceLog performanceLogger =
+        new PerformanceLog(ServiceThread.class.getName() + ".performance");
+
+    static PerformanceLog performanceProcessLogger =
+        new PerformanceLog(
+            ServiceThread.class.getName() + ".performance.process"
+        );
+
+    public static final String SEND_CONTENT_LENGTH =
+        "org.globus.wsrf.container.sendContentLength";
+
+    // HTTP prefix
+    protected static final byte[] HTTP_10 = "HTTP/1.0 ".getBytes();
+    protected static final byte[] HTTP_11 = "HTTP/1.1 ".getBytes();
+
+    // HTTP status codes
+    private static final byte[] OK =
+        "200 OK".getBytes();
+
+    protected static final byte[] UNAUTH =
+        "401 Unauthorized".getBytes();
+
+    private static final byte[] ISE =
+        "500 Internal server error".getBytes();
+
+    private static final String FILE_NOT_FOUND = "404 ";
+    private static final byte[] FILE_NOT_FOUND_MSG =
+        ("<html><body>File not found</body></html>").getBytes();
+
+    // Standard MIME headers for XML payload
+    protected static final byte[] XML_MIME_STUFF =
+        ("\r\nContent-Type: text/xml; charset=utf-8").getBytes();
+
+    // Standard MIME headers for HTML payload
+    protected static final byte[] HTML_MIME_STUFF =
+        ("\r\nContent-Type: text/html; charset=utf-8").getBytes();
+    protected static final byte[] JNLP_MIME_STUFF =
+        ("\r\nContent-Type: application/x-java-jnlp-file").getBytes();
+    protected static final byte[] JAR_MIME_STUFF =
+        ("\r\nContent-Type: application/java-archive").getBytes();
+
+    protected static final String CONTENT_TYPE =
+        "\r\n" + HTTPConstants.HEADER_CONTENT_TYPE + ": ";
+
+    protected static final byte[] CONTENT_LENGTH =
+        ("\r\n" + HTTPConstants.HEADER_CONTENT_LENGTH + ": ").getBytes();
+
+    private static final byte[] CONNECTION_CLOSE =
+        "\r\nConnection: close".getBytes();
+
+    private static final byte[] TRANSFER_ENCODING_CHUNKED =
+        "\r\nTransfer-Encoding: chunked".getBytes();
+
+    // Mime/Content separator
+    protected static final byte[] SEPARATOR = "\r\n\r\n".getBytes();
+
+    // ASCII character mapping to lower case
+    private static final byte[] toLower = new byte[256];
+
+    static {
+        for (int i = 0; i < 256; i++) {
+            toLower[i] = (byte) i;
+        }
+
+        for (int lc = 'a'; lc <= 'z'; lc++) {
+            toLower[(lc + 'A') - 'a'] = (byte) lc;
+        }
+    }
+
+    // mime header for content length
+    private static final byte[] LENGTH_HEADER = "content-length: ".getBytes();
+
+    // mime header for soap action
+    private static final byte[] ACTION_HEADER = "soapaction: ".getBytes();
+
+    // mime header for GET
+    private static final byte[] GET_HEADER = "GET".getBytes();
+
+    // mime header for HEAD
+    private static final byte[] HEAD_HEADER = "HEAD".getBytes();
+
+    // mime header for POST
+    private static final byte[] POST_HEADER = "POST".getBytes();
+
+    // header ender
+    private static final byte[] HEADER_ENDER = ": ".getBytes();
+
+    // transfer-encoding type
+    private static final byte[] ENCODING_HEADER =
+        "transfer-encoding: ".getBytes();
+
+    // transfer-encoding type chunked
+    private static final byte[] CHUNKED =
+        "chunked".getBytes();
+
+    private static final byte[] HTTP_BASE_VERSION =
+        "http/".getBytes();
+
+    private static final int HTTP_GET = 1;
+    private static final int HTTP_HEAD = 2;
+    private static final int HTTP_POST = 3;
+
+    // buffer for IO
+    private static final int BUFSIZ = 4096;
+    private byte[] buf = new byte[BUFSIZ];
+    private String webRootPath;
+    private boolean webStartEnabled = false;
+    private String configRootPath;
+    private String baseURL;
+
+    public ServiceThread(ServiceRequestQueue queue,
+                         ServiceThreadPool pool,
+                         AxisEngine engine) {
+        logger.debug("Starting up thread");
+        this.queue = queue;
+        this.threadPool = pool;
+
+        String webStart =
+            System.getProperty(ContainerConfig.WEB_START_PROPERTY);
+        this.webStartEnabled = (webStart != null) &&
+            (webStart.equalsIgnoreCase("enable"));
+
+        try {
+            this.webRootPath = getWebRootPath(engine);
+        } catch (Exception e) {
+            throw new RuntimeException(i18n.getMessage("invalidWebRoot"));
+        }
+
+        this.configRootPath = getConfigRootPath(engine);
+
+        // create an Axis server
+        this.engine = engine;
+
+        // Reusuable, buffered, content length controlled, InputStream
+        this.is = new NonBlockingBufferedInputStream();
+
+        // buffers for the headers we care about
+        this.soapAction = new StringBuffer();
+        this.fileName = new StringBuffer();
+
+        String prop = System.getProperty(SEND_CONTENT_LENGTH);
+        if (prop != null && prop.equalsIgnoreCase("false")) {
+            this.sendContentLength = false;
+        }
+
+        String host = "localhost";
+        try {
+            host = ServiceHost.getHost(engine);
+        } catch (Exception e) {
+            logger.warn(i18n.getMessage("noHostname"), e);
+        }
+        this.baseURL = getProtocol() + "://" + host + ":";
+    }
+
+    public static String getWebRootPath(AxisEngine engine)
+        throws IOException {
+        ContainerConfig config = ContainerConfig.getConfig(engine);
+        String webRoot = config.getInternalWebRoot();
+
+        if (webRoot == null) {
+            webRoot = "." + File.separator;
+        } else if (!webRoot.equals("")  &&
+                   !webRoot.endsWith(File.separator)) {
+            webRoot = webRoot + File.separator;
+        }
+        return new File(webRoot).getCanonicalPath();
+    }
+
+    public static String getConfigRootPath(AxisEngine engine) {
+        return ContainerConfig.getGlobusLocation();
+    }
+
+    public void run() {
+        try {
+            while (true) {
+                // create and initialize a message context
+                this.msgContext = new MessageContext(engine);
+                this.responseMsg = null;
+
+                if (logger.isDebugEnabled()) {
+                    logger.debug(
+                        "Thread " + getName() + " listening for requests"
+                    );
+                }
+
+                ServiceRequest request = this.queue.dequeue();
+                performanceProcessLogger.start();
+                process(request);
+                performanceProcessLogger.stop("process");
+                yield();
+            }
+        } catch (NoSuchElementException nse) {
+            logger.debug("Stopping thread " + getName());
+        } catch (Exception e) {
+            logger.error("Thread failed", e);
+        } finally {
+            this.threadPool.removeThread(this);
+        }
+    }
+
+    protected String getProtocol() {
+        return "http";
+    }
+
+    protected void process(ServiceRequest request) {
+
+        Socket socket = request.getSocket();
+        OutputStream out = null;
+        InputStream in = null;
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("Thread " + getName() + " processing requests");
+        }
+
+        try {
+            out = socket.getOutputStream();
+            in = socket.getInputStream();
+
+            // assume the best
+            byte[] status = OK;
+
+            // assume we're not getting WSDL
+            boolean doWsdl = false;
+            String filePart = "";
+
+            is.setInputStream(in);
+            try {
+                // parse all headers into hashtable
+                int contentLength =
+                    parseHeaders(is, soapAction, fileName);
+
+                if (contentLength >= 0) {
+                    is.setContentLength(contentLength);
+                }
+
+                int paramIdx = fileName.toString().indexOf('?');
+
+                if (paramIdx != -1) {
+                    // Got params
+                    String params = fileName.substring(paramIdx + 1);
+                    fileName.setLength(paramIdx);
+
+                    if (logger.isDebugEnabled()) {
+                        logger.debug(i18n.getMessage("filename00",
+                                                     fileName.toString()));
+                        logger.debug(i18n.getMessage("params00",
+                                                     params));
+                    }
+
+                    if ("wsdl".equalsIgnoreCase(params)) {
+                        doWsdl = true;
+                    }
+                }
+
+                filePart = fileName.toString();
+
+                msgContext.setProperty(Constants.MC_REALPATH,
+                                       filePart);
+                msgContext.setProperty(Constants.MC_CONFIGPATH,
+                                       this.configRootPath);
+                msgContext.setProperty(Constants.MC_HOME_DIR,
+                                       this.webRootPath);
+                msgContext.setProperty(Constants.MC_REMOTE_ADDR,
+                                       socket.getInetAddress().getHostAddress());
+                // !!! Fix string concatenation
+                ServerSocket serverSocket = request.getServerSocket();
+                String url = this.baseURL + serverSocket.getLocalPort() +
+                    "/" + filePart;
+                msgContext.setProperty(MessageContext.TRANS_URL,
+                                       url);
+
+                // if get, then return simpleton document as response
+                if (this.httpRequest == HTTP_GET) {
+                    if (doWsdl) {
+                        doWSDL(engine, msgContext, out, filePart);
+                    } else {
+                        doGet(engine, msgContext, out, filePart, true);
+                    }
+                    return;
+                } else if (this.httpRequest == HTTP_HEAD) {
+                    doGet(engine, msgContext, out, filePart, false);
+                    return;
+                }
+
+                doPost(engine, msgContext);
+            } catch (Exception e) {
+                status = doFault(e, msgContext, filePart);
+            }
+
+            // if responseMsg is null let's assume
+            // it is a one-way operation.
+            // we can add better checking for one-way operations
+            // later on
+            if (this.responseMsg == null) {
+                out.write(createHeaderReply(OK,
+                                            XML_MIME_STUFF,
+                                            0));
+            } else {
+                String contentType =
+                    CONTENT_TYPE +
+                    responseMsg.getContentType(msgContext.getSOAPConstants());
+
+                if (this.chunked) {
+                    out.write(createHeaderReply(status,
+                                                contentType.getBytes(),
+                                                -1));
+                    out = new ChunkedOutputStream(out);
+                } else {
+                    out.write(createHeaderReply(status,
+                                                contentType.getBytes(),
+                                                responseMsg.getContentLength()));
+                }
+                this.responseMsg.writeTo(out);
+            }
+            out.flush();
+        } catch (InterruptedIOException iie) {
+            return;
+        } catch (SocketException se) {
+            // socket write error can be delivered if client shuts down
+            // connection improperly
+            logger.debug("Socket exception", se);
+        } catch (Exception e) {
+            logger.error(i18n.getMessage("general"), e);
+        } finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+            } catch (Exception e) {
+                logger.error(i18n.getMessage("errorClosingOutputStream"), e);
+            }
+            try {
+                if (in != null) {
+                    in.close();
+                }
+            } catch (Exception e) {
+                logger.error(i18n.getMessage("errorClosingInputStream"), e);
+            }
+            try {
+                if (socket != null) {
+                    socket.close();
+                }
+            } catch (Exception e) {
+                logger.error(i18n.getMessage("errorClosingSocket"), e);
+            }
+        }
+    }
+
+    private byte[] createHeaderReply(byte[] code,
+                                     byte[] contentType,
+                                     long length)
+        throws IOException {
+        ByteArrayOutputStream out =
+            new ByteArrayOutputStream();
+        out.write( (this.http11) ? HTTP_11 : HTTP_10 );
+        out.write(code);
+        if (contentType != null) {
+            out.write(contentType);
+        }
+        if (length < 0) {
+            out.write(TRANSFER_ENCODING_CHUNKED);
+        } else {
+            if (this.sendContentLength) {
+                out.write(CONTENT_LENGTH);
+                out.write(String.valueOf(length).getBytes());
+            }
+        }
+        if (this.http11) {
+            out.write(CONNECTION_CLOSE);
+        }
+        out.write(SEPARATOR);
+        return out.toByteArray();
+    }
+
+    protected void doWSDL(AxisEngine engine,
+                          MessageContext msgContext,
+                          OutputStream out,
+                          String filePart)
+        throws IOException {
+
+        try {
+            engine.generateWSDL(msgContext);
+        } catch (Exception e) {
+            byte [] status = ISE;
+            byte [] msg = null;
+            if (e instanceof AxisFault) {
+                AxisFault fault = (AxisFault)e;
+                if (fault.getFaultCode().equals(
+                       Constants.QNAME_NO_SERVICE_FAULT_CODE)) {
+                    status = (FILE_NOT_FOUND + filePart).getBytes();
+                    msg = FILE_NOT_FOUND_MSG;
+                }
+            }
+            if (msg == null) {
+                logger.debug("Get wsdl error", e);
+                StringWriter sWriter = new StringWriter();
+                PrintWriter pWriter = new PrintWriter(sWriter);
+                pWriter.println("<html><body>");
+                pWriter.println("<h2>Error getting wsdl:</h2><pre>");
+                e.printStackTrace(pWriter);
+                pWriter.println("</pre></body></html>");
+                pWriter.flush();
+                msg = sWriter.toString().getBytes();
+            }
+            out.write(createHeaderReply(status,
+                                        HTML_MIME_STUFF,
+                                        msg.length));
+            out.write(msg);
+            out.flush();
+
+            return;
+        }
+
+        Document doc = (Document) msgContext.getProperty("WSDL");
+
+        if (doc != null) {
+            String response = XMLUtils.DocumentToString(doc);
+            byte[] respBytes = response.getBytes();
+            out.write(createHeaderReply(OK,
+                                        XML_MIME_STUFF,
+                                        respBytes.length));
+            out.write(respBytes);
+            out.flush();
+        }
+    }
+
+    protected void doGet(AxisEngine engine,
+                         MessageContext msgContext,
+                         OutputStream out,
+                         String filePart,
+                         boolean returnContent) {
+        try {
+            doGetSub(engine, msgContext, out, filePart, returnContent);
+        } catch (FileNotFoundException e) {
+            try {
+                byte [] status = (FILE_NOT_FOUND + filePart).getBytes();
+                out.write(createHeaderReply(status,
+                                            HTML_MIME_STUFF,
+                                            FILE_NOT_FOUND_MSG.length));
+                out.write(FILE_NOT_FOUND_MSG);
+                out.flush();
+            } catch (IOException ee) {
+                logger.error(i18n.getMessage("errorWritingResponse"), e);
+            }
+        } catch (SocketException e) {
+            // ignore - client probably closed too early
+        } catch (IOException e) {
+            try {
+                out.write(createHeaderReply(ISE,
+                                            HTML_MIME_STUFF,
+                                            0));
+                out.flush();
+            } catch (IOException ee) {
+                logger.error(i18n.getMessage("errorWritingResponse"), e);
+            }
+        }
+    }
+
+    protected void doGetSub(AxisEngine engine,
+                            MessageContext msgContext,
+                            OutputStream out,
+                            String filePart,
+                            boolean returnContent)
+        throws IOException {
+
+        File getFile = new File(this.webRootPath, filePart);
+
+        // read local file
+        if (logger.isDebugEnabled()) {
+            logger.debug("Trying to retrieve file from:" + getFile);
+        }
+
+        if (!getFile.getCanonicalPath().startsWith(this.webRootPath)) {
+            throw new FileNotFoundException(filePart);
+        }
+
+        boolean xmlContent = filePart.endsWith(".xsd") ||
+                             filePart.endsWith(".wsdl") ||
+                             filePart.endsWith(".gwsdl");
+
+        boolean jnlpContent = filePart.endsWith(".jnlp");
+        boolean jarContent = filePart.endsWith(".jar");
+
+        if ((!xmlContent && !jnlpContent && !jarContent) ||
+            ((jnlpContent || jarContent) && !this.webStartEnabled)) {
+            throw new FileNotFoundException(filePart);
+        }
+
+        FileInputStream getFileStream = new FileInputStream(getFile);
+
+        try {
+            byte [] type = null;
+            if (xmlContent) {
+                type = XML_MIME_STUFF;
+            } else if (jnlpContent) {
+                type = JNLP_MIME_STUFF;
+            } else if (jarContent) {
+                type = JAR_MIME_STUFF;
+            }
+
+            out.write(createHeaderReply(OK,
+                                        type,
+                                        getFile.length()));
+
+            if (!returnContent) {
+                return;
+            }
+
+            byte[] fileBuffer = new byte[4096];
+            int bytesRead;
+
+            while ((bytesRead = getFileStream.read(fileBuffer, 0, 4096)) > 0) {
+                out.write(fileBuffer, 0, bytesRead);
+            }
+        } finally {
+            getFileStream.close();
+        }
+    }
+
+    protected void doPost(AxisEngine engine,
+                          MessageContext msgContext)
+        throws AxisFault {
+        // this may be "" if either SOAPAction: "" or if no SOAPAction at all.
+        // for now, do not complain if no SOAPAction at all
+        String soapActionString = soapAction.toString();
+
+        if (soapActionString != null) {
+            msgContext.setUseSOAPAction(true);
+            msgContext.setSOAPActionURI(soapActionString);
+        }
+
+        InputStream in = this.is;
+        if (this.chunked) {
+            in = new ChunkedInputStream(this.is);
+        }
+
+        Message requestMsg = new Message(in);
+        msgContext.setRequestMessage(requestMsg);
+
+        // invoke the Axis engine
+        performanceLogger.start();
+        engine.invoke(msgContext);
+        performanceLogger.stop("Post: Engine Invoke");
+
+        // Retrieve the response from Axis
+        this.responseMsg = msgContext.getResponseMessage();
+    }
+
+    protected byte[] doFault(Exception e,
+                             MessageContext msgContext,
+                             String filepart) {
+        AxisFault af;
+        byte[] status = OK;
+
+        if (e instanceof AxisFault) {
+            af = (AxisFault) e;
+            logger.debug(i18n.getMessage("serverFault00"), af);
+            QName faultCode = af.getFaultCode();
+            if (faultCode != null &&
+                "Server.Unauthorized".equals(faultCode.getLocalPart())) {
+                status = UNAUTH; // SC_UNAUTHORIZED
+            } else {
+                status = ISE; // SC_INTERNAL_SERVER_ERROR
+            }
+        } else {
+            if (e instanceof IOException) {
+                status = (FILE_NOT_FOUND + filepart).getBytes();
+            } else {
+                status = ISE; // SC_INTERNAL_SERVER_ERROR
+            }
+
+            af = AxisFault.makeFault(e);
+        }
+
+        // There may be headers we want to preserve in the
+        // response message - so if it's there, just add the
+        // FaultElement to it.  Otherwise, make a new one.
+        this.responseMsg = msgContext.getResponseMessage();
+
+        if (this.responseMsg == null) {
+            this.responseMsg = new Message(af);
+        } else {
+            try {
+                SOAPEnvelope env = this.responseMsg.getSOAPEnvelope();
+                env.clearBody();
+                env.addBodyElement(new SOAPFault(af));
+            } catch (AxisFault fault) {
+                // Should never reach here!
+                logger.error(i18n.getMessage("unexpectedError"), e);
+            }
+        }
+
+        return status;
+    }
+
+    /**
+    * Read a single line from the input stream
+    * @param is        inputstream to read from
+    * @param b         byte array to read into
+    * @param off       starting offset into the byte array
+    * @param len       maximum number of bytes to read
+    */
+    private int readLine(InputStream is,
+                         byte[] b,
+                         int off,
+                         int len)
+        throws IOException {
+        int count = 0;
+        int c;
+
+        while ((c = is.read()) != -1) {
+            b[off++] = (byte) c;
+            count++;
+
+            if ((c == '\n') || (count == len)) {
+                break;
+            }
+        }
+
+        return (count > 0) ? count : (-1);
+    }
+
+    private void parseRequest(StringBuffer fileName,
+                              byte [] buf,
+                              int n,
+                              int offset)
+        throws IOException {
+        fileName.delete(0, fileName.length());
+        int i;
+        for (i = 0; i < (n - offset); i++) {
+            char c = (char) (buf[i + offset] & 0x7f);
+
+            if (c == ' ') {
+                break;
+            }
+
+            fileName.append(c);
+        }
+        if (logger.isDebugEnabled()) {
+            logger.debug(i18n.getMessage("filename01",
+                                         new String[] {"ServiceThread",
+                                                       fileName.toString()}));
+        }
+
+        if (matches(buf, i+offset+1, HTTP_BASE_VERSION)) {
+            int j = i+offset+1+HTTP_BASE_VERSION.length;
+            if (j+3 > n) { // 3 is for <major digit>.<minor digit>
+                throw new IOException(i18n.getMessage("malformedHTTPVersion"));
+            }
+            if (buf[j] != '1') {
+                throw new IOException(i18n.getMessage("unsupportedHTTPMajor"));
+            }
+            if (buf[j+2] == '0') {
+                this.http11 = false;
+            } else if (buf[j+2] == '1') {
+                this.http11 = true;
+            } else {
+                throw new IOException(i18n.getMessage("unsupportedHTTMinor"));
+            }
+        } else {
+            throw new IOException(i18n.getMessage("malformedHTTPVersion"));
+        }
+    }
+
+    /**
+    * Read all mime headers, returning the value of Content-Length and
+    * SOAPAction.
+    * @param is         InputStream to read from
+    * @param soapAction StringBuffer to return the soapAction into
+    * @return Content-Length
+    */
+    private int parseHeaders(InputStream is,
+                             StringBuffer soapAction,
+                             StringBuffer fileName)
+        throws IOException {
+
+        // parse first line as GET or POST
+        int n = readLine(is, buf, 0, buf.length);
+
+        if (n < 0) {
+            // nothing!
+            throw new IOException(i18n.getMessage("unexpectedEOS00"));
+        }
+
+        soapAction.delete(0, soapAction.length());
+        this.httpRequest = -1;
+        this.chunked = false;
+
+        if (buf[0] == GET_HEADER[0]) {
+            this.httpRequest = HTTP_GET;
+            parseRequest(fileName, buf, n, 5);
+            return 0;
+        } else if (buf[0] == HEAD_HEADER[0]) {
+            this.httpRequest = HTTP_HEAD;
+            parseRequest(fileName, buf, n, 5);
+            return 0;
+        } else if (buf[0] == POST_HEADER[0]) {
+            this.httpRequest = HTTP_POST;
+            parseRequest(fileName, buf, n, 6);
+        } else {
+            throw new IOException(i18n.getMessage("badRequest00"));
+        }
+
+        int len = -1;
+
+        while ((n = readLine(is, buf, 0, buf.length)) > 0) {
+            // if we are at the separator blank line, bail right now
+            if ((n <= 2) && ((buf[0] == '\n') || (buf[0] == '\r'))) {
+                break;
+            }
+
+            // RobJ gutted the previous logic; it was too hard to extend for more headers.
+            // Now, all it does is search forwards for ": " in the buf,
+            // then do a length / byte compare.
+            // Hopefully this is still somewhat efficient (Sam is watching!).
+            // First, search forwards for ": "
+            int endHeaderIndex = 0;
+
+            while (
+                (endHeaderIndex < n) &&
+                    (toLower[buf[endHeaderIndex]] != HEADER_ENDER[0])
+            ) {
+                endHeaderIndex++;
+            }
+
+            endHeaderIndex += 2;
+
+            // endHeaderIndex now points _just past_ the ": ", and is
+            // comparable to the various lenLen, actionLen, etc. values
+            // convenience; i gets pre-incremented, so initialize it to one less
+            int i = endHeaderIndex - 1;
+
+            // which header did we find?
+            if ((endHeaderIndex == LENGTH_HEADER.length) &&
+                matches(buf, LENGTH_HEADER)) {
+                len = 0;
+                // parse content length
+                while ((++i < n) && (buf[i] >= '0') && (buf[i] <= '9')) {
+                    len = (len * 10) + (buf[i] - '0');
+                }
+            } else if ((endHeaderIndex == ACTION_HEADER.length) &&
+                       matches(buf, ACTION_HEADER)) {
+                // skip initial '"'
+                i++;
+
+                while ((++i < n) && (buf[i] != '"')) {
+                    soapAction.append((char) (buf[i] & 0x7f));
+                }
+            } else if ((endHeaderIndex == ENCODING_HEADER.length) &&
+                       matches(buf, ENCODING_HEADER)) {
+                this.chunked = matches(buf, i+1, CHUNKED) && this.http11;
+            }
+        }
+
+        return len;
+    }
+
+    /**
+    * does tolower[buf] match the target byte array, up to the target's length?
+    */
+    public boolean matches(byte[] buf, byte[] target) {
+        for (int i = 0; i < target.length; i++) {
+            if (toLower[buf[i]] != target[i]) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+    * Case-insensitive match of a target byte [] to a source byte [],
+    * starting from a particular offset into the source.
+    */
+    public boolean matches(byte[] buf, int bufIdx, byte[] target) {
+        for (int i = 0; i < target.length; i++) {
+            if (toLower[buf[bufIdx + i]] != target[i]) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+    * output an integer into the output stream
+    * @param out       OutputStream to be written to
+    * @param value     Integer value to be written.
+    */
+    private void putInt(OutputStream out, int value)
+        throws IOException {
+        int len = 0;
+        int offset = buf.length;
+
+        // negative numbers
+        if (value < 0) {
+            buf[--offset] = (byte) '-';
+            value = -value;
+            len++;
+        }
+
+        // zero
+        if (value == 0) {
+            buf[--offset] = (byte) '0';
+            len++;
+        }
+
+        // positive numbers
+        while (value > 0) {
+            buf[--offset] = (byte) ((value % 10) + '0');
+            value = value / 10;
+            len++;
+        }
+
+        // write the result
+        out.write(buf, offset, len);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceThreadPool.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceThreadPool.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ServiceThreadPool.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,82 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import org.apache.axis.AxisEngine;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Vector;
+
+/**
+ * This class is responsible for managing a set of threads.
+ * New threads can be added to the pool at any given time.
+ */
+public class ServiceThreadPool {
+    
+    private Vector serviceThreads = new Vector();
+    protected ServiceRequestQueue queue;
+    protected AxisEngine engine;
+
+    static Log logger = 
+        LogFactory.getLog(ServiceThreadPool.class.getName());
+
+    public ServiceThreadPool(ServiceRequestQueue queue, AxisEngine engine) {
+        this.queue = queue;
+        this.engine = engine;
+    }
+
+    public void startThreads(int threads) {
+        for (int i = 0; i < threads; i++) {
+            ServiceThread serviceThread = createThread();
+            this.serviceThreads.addElement(serviceThread);
+            serviceThread.start();
+        }
+    }
+
+    public int getThreads() {
+        return this.serviceThreads.size();
+    }
+
+    protected ServiceThread createThread() {
+        return new ServiceThread(this.queue, this, this.engine);
+    }
+
+    public void stopThreads(int numThreads) {
+        this.queue.stopThreads(numThreads);
+        logger.debug("Stopping " + numThreads + " threads");
+    }
+
+    public void stopThreads() {
+        logger.debug("waitingForThreads");
+        this.queue.stopThreads(this.serviceThreads.size());
+    }
+
+    public void removeThread(ServiceThread thread) {
+        this.serviceThreads.removeElement(thread);
+        synchronized (this) {
+            notify();
+        }
+    }
+
+    public synchronized void waitForThreads() throws InterruptedException {
+        logger.debug("waitingForThreads");
+
+        while (serviceThreads.size() != 0) {
+            wait();
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ShutdownClient.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ShutdownClient.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ShutdownClient.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,100 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import java.util.List;
+import java.util.Properties;
+
+import javax.xml.rpc.Stub;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.ParseException;
+
+import org.globus.wsrf.client.BaseClient;
+import org.globus.wsrf.core.shutdown.ShutdownPortType;
+import org.globus.wsrf.core.shutdown.service.ShutdownServiceAddressingLocator;
+import org.globus.wsrf.utils.FaultHelper;
+
+/**
+ * Client for shutdown service implementation.
+ */
+public class ShutdownClient extends BaseClient {
+
+    private static final String FOOTER =
+        "Where:\n" +
+        "  'soft' - lets threads die naturally (default)\n" +
+        "  'hard' - forces JVM shutdown\n";
+
+    public static void main(String [] args) throws Exception {
+        Properties defaultOptions = new Properties();
+        // default service address
+        defaultOptions.put(BaseClient.SERVICE_URL.getOpt(),
+                           "https://localhost:8443/wsrf/services/ShutdownService");
+        // GSI Secure Msg (signature)
+        defaultOptions.put(BaseClient.PROTECTION.getOpt(), "sig");
+
+        // no authorization
+        defaultOptions.put(BaseClient.AUTHZ.getOpt(),
+                           "none");
+
+        ShutdownClient client = new ShutdownClient();
+        client.setCustomUsage("[soft | hard]");
+        client.setHelpFooter(FOOTER);
+
+        boolean hard = false;
+
+        try {
+            CommandLine line = client.parse(args, defaultOptions);
+            List options = line.getArgList();
+            if (options == null || options.isEmpty()) {
+                // do nothing assume defaults
+            } else if (options.size() == 1) {
+                String arg = (String)options.get(0);
+                if (arg.equalsIgnoreCase("soft")) {
+                    hard = false;
+                } else if (arg.equalsIgnoreCase("hard")) {
+                    hard = true;
+                } else {
+                    throw new Exception("Invalid argument: " + arg);
+                }
+            }
+        } catch(ParseException e) {
+            System.err.println("Error: " + e.getMessage());
+            System.exit(1);
+        } catch (Exception e) {
+            System.err.println("Error: " + e.getMessage());
+            System.exit(1);
+        }
+
+        ShutdownServiceAddressingLocator locator =
+            new ShutdownServiceAddressingLocator();
+
+        try {
+            ShutdownPortType port =
+                locator.getShutdownPortTypePort(client.getEPR());
+            client.setOptions((Stub)port);
+
+            port.shutdown(hard);
+        } catch(Exception e) {
+            if (client.isDebugMode()) {
+                FaultHelper.printStackTrace(e);
+            } else {
+                System.err.println("Error: " + FaultHelper.getMessage(e));
+            }
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ShutdownService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ShutdownService.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/container/ShutdownService.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,62 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import java.rmi.RemoteException;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.utils.Resources;
+
+/**
+ * Shutdown service implementation.
+ */
+public class ShutdownService {
+
+    private static final I18n i18n =
+        I18n.getI18n(Resources.class.getName());
+
+    public void shutdown(boolean hard) throws RemoteException {
+        /* if hard shutdown supported schedule
+         * System.exit thread in 10 secs
+         * otherwise error out
+         */
+        if (hard) {
+            if (Boolean.getBoolean(ServiceContainer.HARD_SHUTDOWN)) {
+                Thread t = (new Thread() {
+                        public void run() {
+                            try {
+                                Thread.sleep(1000 * 10);
+                            } catch (Exception e) {}
+                            System.exit(0);
+                        }
+                    });
+                t.setDaemon(true);
+                t.start();
+            } else {
+                throw new RemoteException(
+                    i18n.getMessage("hardShutdownNotSupported"));
+            }
+        }
+
+        // always kill all the containers even if hard shutdown
+        try {
+            ServiceContainerCollection.stopAll(true);
+        } catch (Exception e) {
+            throw new RemoteException(i18n.getMessage("shutdownFailure"), e);
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyDeserializer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyDeserializer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyDeserializer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,61 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.apache.axis.MessageContext;
+import org.apache.axis.encoding.DeserializationContext;
+import org.apache.axis.encoding.DeserializerImpl;
+import org.apache.axis.message.MessageElement;
+
+import org.xml.sax.SAXException;
+
+import java.util.List;
+
+/**
+ * Deserializer for MessageElements
+ */
+public class AnyDeserializer extends DeserializerImpl {
+
+   public static final String DESERIALIZE_CURRENT_ELEMENT = 
+       "DeserializeCurrentElement";
+
+    public final void onEndElement(String namespace, 
+                                   String localName,
+                                   DeserializationContext context)
+        throws SAXException {
+        try {
+            MessageElement msgElem = context.getCurElement();
+            if (msgElem != null) {
+                MessageContext messageContext = context.getMessageContext();
+                Boolean currentElement = (Boolean) messageContext.getProperty(DESERIALIZE_CURRENT_ELEMENT);
+                if (currentElement != null && currentElement.booleanValue()) {
+                    value = msgElem;
+                    messageContext.setProperty(DESERIALIZE_CURRENT_ELEMENT, Boolean.FALSE);
+                    return;
+                }
+                List children = msgElem.getChildren();
+                if (children != null) {
+                    msgElem = (MessageElement) children.get(0);
+                    if (msgElem != null) {
+                        value = msgElem;
+                    }
+                }
+            }
+        } catch(Exception exp) {
+            throw new SAXException(exp);
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyDeserializerFactory.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyDeserializerFactory.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyDeserializerFactory.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,30 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.apache.axis.encoding.ser.BaseDeserializerFactory;
+
+/**
+ * DeserializerFactory for MessageElement.
+ *
+ */
+public class AnyDeserializerFactory extends BaseDeserializerFactory {
+
+    public AnyDeserializerFactory() {
+        super(AnyDeserializer.class);
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListDeserializer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListDeserializer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListDeserializer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,122 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.oasis.AnyListType;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.encoding.DeserializationContext;
+import org.apache.axis.encoding.Deserializer;
+import org.apache.axis.encoding.DeserializerImpl;
+import org.apache.axis.encoding.TypeMapping;
+import org.apache.axis.encoding.Target;
+import org.apache.axis.description.TypeDesc;
+import org.apache.axis.message.SOAPHandler;
+import org.apache.axis.utils.Messages;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class AnyListDeserializer extends DeserializerImpl {
+
+    static Log logger =
+        LogFactory.getLog(AnyListDeserializer.class.getName());
+
+    private QName xmlType;
+    private Class javaType;
+
+    public AnyListDeserializer(Class javaType, QName xmlType) {
+        this(javaType, xmlType, null);
+    }
+
+    public AnyListDeserializer(Class javaType, QName xmlType, TypeDesc desc) {
+        this.xmlType = xmlType;
+        this.javaType = javaType;
+    }
+
+    public void onStartElement(String namespace, String localName,
+                               String prefix, Attributes attributes,
+                               DeserializationContext context)
+        throws SAXException {
+        try {
+            this.value = (AnyListType)javaType.newInstance();
+        } catch (Throwable e) {
+            throw new SAXException(Messages.getMessage("cantCreateBean00", 
+                                                       javaType.getName(), 
+                                                       e.toString()));
+        }
+    }
+
+    public SOAPHandler onStartChild(String namespace,
+                                    String localName,
+                                    String prefix,
+                                    Attributes attributes,
+                                    DeserializationContext context)
+        throws SAXException {
+     
+        QName elemQName = new QName(namespace, localName);
+
+        Class childClass = ((AnyListType)value).getType(elemQName);
+        if (childClass == null) {
+            // TODO: fix exception msg
+            throw new SAXException("");
+        }
+        
+        QName childXMLType = context.getTypeFromAttributes(namespace, 
+                                                           localName,
+                                                           attributes);
+
+        if (childXMLType == null) {
+            TypeDesc desc =  TypeDesc.getTypeDescForClass(childClass);
+            childXMLType = (desc != null) ? desc.getXmlType() : null;
+        }
+
+        Deserializer dSer = null;
+        
+        if (childXMLType == null) {
+            TypeMapping tm = context.getTypeMapping();
+            QName defaultXMLType = tm.getTypeQName(childClass);
+            dSer = context.getDeserializer(childClass, defaultXMLType);
+        } else {
+            dSer = context.getDeserializerForType(childXMLType);
+        }
+
+        if (dSer == null) {
+            dSer = context.getDeserializerForClass(childClass);
+        }   
+
+        if (dSer == null) {
+            throw new SAXException(Messages.getMessage("noDeser00",
+                                                       childXMLType.toString()));
+        }
+
+        dSer.registerValueTarget(new AnyListTarget());
+        addChildDeserializer(dSer);
+        
+        return (SOAPHandler)dSer;
+    }
+
+    private class AnyListTarget implements Target {
+        public void set(Object obj) throws SAXException {
+            ((AnyListType)value).add(obj);
+        }
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListDeserializerFactory.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListDeserializerFactory.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListDeserializerFactory.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,35 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import javax.xml.namespace.QName;
+
+import javax.xml.rpc.encoding.Deserializer;
+import javax.xml.rpc.JAXRPCException;
+
+import org.apache.axis.encoding.ser.BaseDeserializerFactory;
+
+public class AnyListDeserializerFactory extends BaseDeserializerFactory {
+
+    public AnyListDeserializerFactory(Class javaType, QName xmlType) {
+        super(AnyListDeserializer.class, xmlType, javaType);
+    }
+
+    public Deserializer getDeserializerAs(String mechanismType)
+        throws JAXRPCException {
+        return new AnyListDeserializer(javaType, xmlType);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListSerializer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListSerializer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListSerializer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,90 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.oasis.AnyListType;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.Constants;
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.encoding.Serializer;
+import org.apache.axis.utils.Messages;
+import org.apache.axis.wsdl.fromJava.Types;
+import org.apache.axis.description.TypeDesc;
+
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+
+public class AnyListSerializer implements Serializer {
+
+    static Log logger =
+        LogFactory.getLog(AnyListSerializer.class.getName());
+
+    public AnyListSerializer() {}
+
+    public void serialize(QName name, 
+                          Attributes attributes,
+                          Object obj,
+                          SerializationContext context) 
+        throws IOException {
+        if (!(obj instanceof AnyListType)) {
+            throw new IOException(Messages.getMessage("cantSerialize01"));
+        }
+        
+        AnyListType any = (AnyListType)obj;
+        
+        context.startElement(name, attributes);
+        
+        Object value = null;
+        QName xmlName = null;
+        QName xmlType = null;
+        TypeDesc typeDesc = null;
+        Class clazz = null;
+
+        Iterator iter = any.iterator();
+        while(iter.hasNext()) {
+            value = iter.next();
+
+            clazz = value.getClass();
+            xmlName = any.getElementName(clazz);
+
+            // XXX: not really helps anything now
+            typeDesc = TypeDesc.getTypeDescForClass(clazz);
+            xmlType = (typeDesc != null) ? typeDesc.getXmlType() : null;
+            
+            context.serialize(xmlName, null, value, 
+                              xmlType, Boolean.TRUE, null);
+        }
+        
+        context.endElement();
+    }
+    
+    public Element writeSchema(Class aClass, Types types) throws Exception {
+        return null;
+    }
+
+    public String getMechanismType() {
+        return Constants.AXIS_SAX;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListSerializerFactory.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListSerializerFactory.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnyListSerializerFactory.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,33 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.encoding.ser.BaseSerializerFactory;
+import org.apache.axis.encoding.Serializer;
+
+public class AnyListSerializerFactory extends BaseSerializerFactory {
+
+    public AnyListSerializerFactory() {
+        super(AnyListSerializer.class); 
+    }
+    
+    protected Serializer getSpecialized(String mechanismType) {
+        return new AnyListSerializer();
+    }   
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnySerializer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnySerializer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnySerializer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,78 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.xml.sax.Attributes;
+
+import org.apache.axis.Constants;
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.encoding.Serializer;
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.utils.Messages;
+import org.apache.axis.wsdl.fromJava.Types;
+
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+
+import java.io.IOException;
+
+/**
+ * Serializer for Any MessageElements.
+ */
+public class AnySerializer implements Serializer {
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public void serialize(QName name,
+                          Attributes attributes,
+                          Object value,
+                          SerializationContext context)
+        throws IOException {
+        if (!(value instanceof MessageElement)) {
+            throw new IOException(
+                i18n.getMessage("expectedType",
+                                MessageElement.class.toString()));
+        }
+
+        context.startElement(name, attributes);
+
+        if (value != null) {
+            try {
+                ((MessageElement) value).output(context);
+            } catch (Exception e) {
+                throw new IOException(
+                             i18n.getMessage("genericSerializationError") + 
+                             " " + e.getMessage());
+            }
+        }
+
+        context.endElement();
+    }
+
+    public String getMechanismType() {
+        return Constants.AXIS_SAX;
+    }
+
+    public Element writeSchema(Class javaclass,
+                               Types types) 
+        throws Exception {
+        return null;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnySerializerFactory.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnySerializerFactory.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/AnySerializerFactory.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,35 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.apache.axis.encoding.ser.BaseSerializerFactory;
+import org.apache.axis.encoding.Serializer;
+
+/**
+ * SerializerFactory for Any MessageElements
+ *
+ */
+public class AnySerializerFactory extends BaseSerializerFactory {
+
+    public AnySerializerFactory() {
+        super(AnySerializer.class); // Share AnySerializer instance
+    }
+
+    protected Serializer getSpecialized(String mechanismType) {
+        return new AnySerializer();
+    }  
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/DeserializationException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/DeserializationException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/DeserializationException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,61 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.globus.common.ChainedException;
+
+/**
+ * This exception is raised if the deserialization to an object failed.
+ */
+public class DeserializationException extends ChainedException {
+    
+    /**
+     * Creates a DeserializationException without error message.
+     */
+    public DeserializationException() {
+    }
+    
+    /**
+     * Creates a DeserializationException with a given error message.
+     *
+     * @param message error message
+     */
+    public DeserializationException(String message) {
+        super(message);
+    }
+    
+    /**
+     * Creates a DeserializationException with a given error message and nested
+     * exception.
+     *
+     * @param message error message
+     * @param exception nested exception/
+     */
+    public DeserializationException(String message,
+                                    Throwable exception) {
+        super(message, exception);
+    }
+    
+    /**
+     * Creates a DeserializationException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public DeserializationException(Throwable exception) {
+        super("", exception);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/DialectDependentDeserializer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/DialectDependentDeserializer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/DialectDependentDeserializer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,131 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.Constants;
+import org.apache.axis.encoding.DeserializationContext;
+import org.apache.axis.encoding.Deserializer;
+import org.apache.axis.encoding.DeserializerFactory;
+import org.apache.axis.encoding.DeserializerImpl;
+import org.apache.axis.encoding.Target;
+import org.apache.axis.message.SOAPHandler;
+import org.apache.axis.types.URI;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+import org.oasis.DialectDependentType;
+
+public abstract class DialectDependentDeserializer extends DeserializerImpl
+{
+    static Log logger =
+        LogFactory.getLog(DialectDependentDeserializer.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    protected Map deserializerFactories = new HashMap();
+    protected QName attributeName;
+    protected Class javaType;
+    protected boolean failOnError = true;
+
+    public void registerDeserializerFactory(
+        URI dialect, DeserializerFactory deserializerFactory)
+    {
+        this.deserializerFactories.put(dialect, deserializerFactory);
+    }
+
+    public void unregisterDeserializerFactory(URI dialect)
+    {
+        this.deserializerFactories.remove(dialect);
+    }
+
+    public void onStartElement(
+        String namespace, String localName, String prefix,
+        Attributes attributes, DeserializationContext context)
+        throws SAXException
+    {
+        URI dialect = null;
+        try
+        {
+            this.value = javaType.newInstance();
+            for(int i = 0; i < attributes.getLength(); i++)
+            {
+                if(attributes.getLocalName(i).equals(
+                    attributeName.getLocalPart()))
+                {
+                    //TODO: Fix this in axis
+                    if(attributes.getURI(i).equals("") ||
+                       attributes.getURI(i).equals(
+                           attributeName.getNamespaceURI()))
+                    {
+                        dialect = new URI(attributes.getValue(i));
+                        ((DialectDependentType) this.value).setDialect(dialect);
+                        break;
+                    }
+                }
+            }
+        }
+        catch(Exception e)
+        {
+            throw new SAXException(e);
+        }
+        DeserializerFactory factory = (DeserializerFactory)
+            this.deserializerFactories.get(dialect);
+
+        if (factory == null)
+        {
+            if (failOnError) 
+            {
+                throw new SAXException(
+                               i18n.getMessage("noDialectDeserializer", 
+                                               dialect));
+            } 
+        } 
+        else 
+        {
+            SOAPHandler dialectDeserializer =
+                (SOAPHandler) factory.getDeserializerAs(
+                                          Constants.AXIS_SAX);
+            ((Deserializer) dialectDeserializer).registerValueTarget(
+                                          new DialectTarget());
+            this.isEnded = true;
+            this.valueComplete();
+            context.replaceElementHandler(dialectDeserializer);
+            dialectDeserializer.startElement(namespace, localName, prefix,
+                                             attributes, context);
+        }
+    }
+
+    private class DialectTarget implements Target
+    {
+        public void set(Object obj) throws SAXException
+        {
+            ((DialectDependentType) DialectDependentDeserializer.this.value).
+                setValue(obj);
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/DialectDependentSerializer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/DialectDependentSerializer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/DialectDependentSerializer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,129 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.Constants;
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.encoding.Serializer;
+import org.apache.axis.encoding.SerializerFactory;
+import org.apache.axis.types.URI;
+import org.apache.axis.wsdl.fromJava.Types;
+
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.helpers.AttributesImpl;
+
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+import org.oasis.DialectDependentType;
+
+public abstract class DialectDependentSerializer implements Serializer
+{
+    static Log logger =
+        LogFactory.getLog(DialectDependentSerializer.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    protected Map serializerFactories = new HashMap();
+    protected QName attributeName;
+
+    public void registerSerializerFactory(
+        URI dialect, SerializerFactory serializerFactory)
+    {
+        this.serializerFactories.put(dialect, serializerFactory);
+    }
+
+    public void unregisterSerializerFactory(URI dialect)
+    {
+        this.serializerFactories.remove(dialect);
+    }
+
+    public void serialize(
+        QName name, Attributes attributes, Object obj,
+        SerializationContext context) throws IOException
+    {
+        DialectDependentType dialectExpression;
+        if(!(obj instanceof DialectDependentType))
+        {
+            throw new IOException(
+                i18n.getMessage("expectedType",
+                                DialectDependentType.class.toString()));
+        }
+        else
+        {
+            dialectExpression = (DialectDependentType) obj;
+        }
+
+        if(attributes == null)
+        {
+            attributes = new AttributesImpl();
+        }
+        else if(!(attributes instanceof AttributesImpl))
+        {
+            attributes = new AttributesImpl(attributes);
+        }
+
+        URI dialectURI = dialectExpression.getDialect();
+
+        if(dialectURI != null)
+        {
+            ((AttributesImpl) attributes).addAttribute(attributeName.getNamespaceURI(),
+                                                       attributeName.getLocalPart(),
+                                                       "",
+                                                       "CDATA",
+                                                       dialectURI.toString());
+        }
+        else
+        {
+            throw new IOException(i18n.getMessage("nullArgument", "dialect"));
+        }
+
+        SerializerFactory serializerFactory = (SerializerFactory)
+            serializerFactories.get(dialectURI);
+
+        if(serializerFactory == null)
+        {
+            throw new IOException(i18n.getMessage("noDialectSerializer", 
+                                                  dialectURI));
+        }
+
+        Serializer serializer =
+            (Serializer) serializerFactory.getSerializerAs(Constants.AXIS_SAX);
+        serializer.serialize(name, attributes,
+                             dialectExpression.getValue(),
+                             context);
+    }
+
+    public Element writeSchema(Class aClass, Types types) throws Exception
+    {
+        return null;
+    }
+
+    public String getMechanismType()
+    {
+        return Constants.AXIS_SAX;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/ObjectDeserializationContext.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/ObjectDeserializationContext.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/ObjectDeserializationContext.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,157 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import java.io.StringReader;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.Constants;
+import org.apache.axis.encoding.DeserializationContext;
+import org.apache.axis.encoding.Deserializer;
+import org.apache.axis.message.EnvelopeHandler;
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.message.SOAPHandler;
+import org.apache.axis.utils.XMLUtils;
+
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.config.ContainerConfig;
+
+public class ObjectDeserializationContext extends DeserializationContext {
+
+    static Log logger =
+        LogFactory.getLog(ObjectDeserializationContext.class.getName());
+
+    static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private Deserializer topDeserializer = null;
+
+    public ObjectDeserializationContext(MessageElement element)
+        throws DeserializationException {
+        this(element, null);
+    }
+
+    public ObjectDeserializationContext(MessageElement element,
+                                        Class javaClass)
+        throws DeserializationException {
+        super(ContainerConfig.getContext(), new SOAPHandler());
+
+        init(element.getType(), javaClass);
+
+        String inputString = element.toString();
+        logger.debug(inputString);
+        inputSource = new InputSource(new StringReader(inputString));
+    }
+
+    public ObjectDeserializationContext(Element element)
+        throws DeserializationException {
+        this(element, null);
+    }
+
+    public ObjectDeserializationContext(Element element, Class javaClass)
+        throws DeserializationException {
+        super(ContainerConfig.getContext(), new SOAPHandler());
+
+        String typeAttr =
+            element.getAttributeNS(Constants.URI_DEFAULT_SCHEMA_XSI, "type");
+
+        QName type = null;
+
+        if (typeAttr != null && typeAttr.length() > 0) {
+            type = XMLUtils.getQNameFromString(typeAttr,
+                                               element);
+        }
+
+        init(type, javaClass);
+
+        String inputString = XMLUtils.ElementToString(element);
+        logger.debug(inputString);
+        inputSource = new InputSource(new StringReader(inputString));
+    }
+
+    public ObjectDeserializationContext(InputSource input, Class javaClass)
+        throws DeserializationException {
+        super(ContainerConfig.getContext(), new SOAPHandler());
+        init(null, javaClass);
+        this.inputSource = input;
+    }
+
+    private void setDeserializer(QName type, Class javaClass) 
+        throws DeserializationException {
+        if (type == null && javaClass == null) {
+            throw new DeserializationException(
+                        i18n.getMessage("typeOrClassRequired"));
+        }
+
+        if (type != null) {
+            // Use the xmlType to get the deserializer.
+            this.topDeserializer = getDeserializerForType(type);
+        } else {
+            QName defaultXMLType = getTypeMapping().getTypeQName(javaClass);
+            this.topDeserializer = getDeserializer(javaClass, defaultXMLType);
+        }
+        
+        if (this.topDeserializer == null) {
+            this.topDeserializer = getDeserializerForClass(javaClass);
+        }
+    }
+
+    private void init(QName type, Class javaClass)
+        throws DeserializationException {
+        msgContext.setEncodingStyle("");
+        popElementHandler();
+
+        setDeserializer(type, javaClass);
+
+        if (topDeserializer == null) {
+            String arg = (type == null) ? 
+                javaClass.getName() : type.toString();
+            throw new DeserializationException(
+                i18n.getMessage("noDeserializer", arg));
+        }
+
+        pushElementHandler(
+              new EnvelopeHandler((SOAPHandler) this.topDeserializer)
+        );
+    }
+
+    public Object getValue() {
+        return (this.topDeserializer == null) ?
+            null :
+            this.topDeserializer.getValue();
+    }
+
+    public MessageElement getMessageElement() {
+        if (this.topDeserializer == null ||
+            !(this.topDeserializer instanceof SOAPHandler)) {
+            return null;
+        }
+        return ((SOAPHandler)this.topDeserializer).myElement;
+    }
+
+    public QName getQName() {
+        MessageElement element = getMessageElement();
+        return (element == null) ? null : element.getQName();
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/ObjectDeserializer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/ObjectDeserializer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/ObjectDeserializer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,248 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.apache.axis.encoding.AnyContentType;
+import org.apache.axis.description.TypeDesc;
+import org.apache.axis.message.MessageElement;
+
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+import org.xml.sax.InputSource;
+
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+/**
+ * Converts Java DOM Elements and SOAP Elements to Java objects.
+ * The objects must be compliant with the Axis Bean model, i.e. generated
+ * using the WSDL2Java tool from an XML Schema definition or must be of simple
+ * type.
+ */
+public class ObjectDeserializer {
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    /**
+     * Converts a DOM Element object into a Java object.
+     * The type of the Java object will be determined from the <i>xsi:type</i>
+     * attribute of the specified element.
+     * <br><b>Note:</b> This operation is slow as it converts the DOM Element
+     * into a string which then is deserialized into a Java object.
+     */
+    public static Object toObject(Element element)
+        throws DeserializationException {
+        return toObject(element, null);
+    }
+
+    /**
+     * Converts a DOM Element object into a Java object.
+     * <br><b>Note:</b> This operation is slow as it converts the DOM Element
+     * into a string which then is deserialized into a Java object.
+     */
+    public static Object toObject(Element element, Class javaClass)
+        throws DeserializationException {
+        ObjectDeserializationContext deserializer
+            = new ObjectDeserializationContext(element, javaClass);
+        try {
+            deserializer.parse();
+        } catch (Exception e) {
+            throw new DeserializationException(
+                i18n.getMessage("genericDeserializationError"), e);
+        }
+        return deserializer.getValue();
+    }
+
+    /**
+     * Converts a SOAPElement object into a Java object.
+     * The type of the Java object will be determined from the <i>xsi:type</i>
+     * attribute of the specified element.
+     *
+     * @see #toObject(SOAPElement, Class)
+     */
+    public static Object toObject(SOAPElement element)
+        throws DeserializationException {
+        return toObject(element, null);
+    }
+
+    /**
+     * Converts a SOAPElement object into a Java object of specified type.
+     * The class of the object must have been generated from an XML Schema, and
+     * thus contain the appropriate meta data to make deserialization possible.
+     *
+     * @param element SOAPElement to be converted
+     * @param javaClass Class containing meta data about how to deserialize
+     *        the object or can be of a simple type such as Integer.
+     * @return Java object that maps to the XML representation of the input
+     * @throws DeserializationException if the input could not be deserialized
+     *         into a Java type.
+     *
+     */
+    public static Object toObject(SOAPElement element, Class javaClass)
+        throws DeserializationException {
+        if (!(element instanceof MessageElement)) {
+            throw new DeserializationException(
+                i18n.getMessage("unsupportedType"));
+        }
+
+        MessageElement elem = (MessageElement)element;
+        if (elem.getDeserializationContext() != null && !elem.isDirty()) {
+            try {
+                return elem.getValueAsType(elem.getType(), javaClass);
+            } catch (Exception e) {
+                throw new DeserializationException(
+                   i18n.getMessage("genericDeserializationError"), e);
+            }
+        } else {
+            ObjectDeserializationContext deserializer =
+                new ObjectDeserializationContext(elem, javaClass);
+            try {
+                deserializer.parse();
+            } catch (Exception e) {
+                throw new DeserializationException(
+                   i18n.getMessage("genericDeserializationError"), e);
+            }
+
+            return deserializer.getValue();
+        }
+    }
+
+    /**
+     * Converts an array of SOAPElement objects into a set of Java objects.
+     * The type of the Java object will be determined from the <i>xsi:type</i>
+     * attribute of the specified element.
+     *
+     * @see #toObject(SOAPElement, Class)
+     */
+    public static Object[] toObject(SOAPElement [] elements)
+        throws DeserializationException {
+        return toObject(elements, null);
+    }
+
+    /**
+     * Converts an array of SOAPElement objects into a set of Java objects.
+     *
+     * @see #toObject(SOAPElement, Class)
+     */
+    public static Object[] toObject(SOAPElement [] elements, Class javaClass)
+        throws DeserializationException {
+        if (elements == null) {
+            return null;
+        }
+        Object [] objects = new Object[elements.length];
+        for (int i=0;i<elements.length;i++) {
+            objects[i] = toObject(elements[i], javaClass);
+        }
+        return objects;
+    }
+
+    /**
+     * Converts a AnyContentType object into a set of Java objects.
+     * The type of the Java object will be determined from the <i>xsi:type</i>
+     * attribute of the specified element.
+     *
+     * @see #toObject(SOAPElement, Class)
+     */
+    public static Object[] toObject(AnyContentType any)
+        throws DeserializationException {
+        return toObject(any, null);
+    }
+
+    /**
+     * Converts a AnyContentType object into a set of Java objects.
+     *
+     * @see #toObject(SOAPElement, Class)
+     */
+    public static Object[] toObject(AnyContentType any, Class javaClass)
+        throws DeserializationException {
+        if (any == null) {
+            return null;
+        }
+        return toObject(any.get_any(), javaClass);
+    }
+
+    /**
+     * Converts the first element of AnyContentType object into a Java object.
+     * The type of the Java object will be determined from the <i>xsi:type</i>
+     * attribute of the specified element.
+     *
+     * @see #toObject(SOAPElement, Class)
+     */
+    public static Object getFirstAsObject(AnyContentType any)
+        throws DeserializationException {
+        return getFirstAsObject(any, null);
+    }
+
+    /**
+     * Converts the first element of AnyContentType object into a Java object.
+     *
+     * @see #toObject(SOAPElement, Class)
+     */
+    public static Object getFirstAsObject(AnyContentType any, Class javaClass)
+        throws DeserializationException {
+        if (any == null ||
+            any.get_any() == null ||
+            any.get_any().length == 0) {
+            return null;
+        }
+        return toObject(any.get_any()[0], javaClass);
+    }
+
+    /**
+     * Checks to see whether the any element is of type javaClass.
+     * The javaClass must be generated from an XML Schema
+     * representation. This operation could be seen as the instanceof
+     * equivalent for xsd:any types
+     */
+    public static boolean contains(SOAPElement element, Class javaClass) {
+        if (element == null || javaClass == null) {
+            throw new IllegalArgumentException();
+        }
+        if (!(element instanceof MessageElement)) {
+            throw new IllegalArgumentException();
+        }
+        TypeDesc desc = TypeDesc.getTypeDescForClass(javaClass);
+        if (desc == null) {
+            return false;
+        }
+        QName qname = desc.getXmlType();
+        QName type = ((MessageElement)element).getType();
+        if (type == null) {
+            type = ((MessageElement)element).getQName();
+        }
+
+        return (type != null && qname != null && type.equals(qname));
+    }
+
+    /**
+     * Deserializes input with XML into a Java object of the given type.
+     */
+    public static Object deserialize(InputSource input, Class javaClass)
+        throws DeserializationException {
+        ObjectDeserializationContext deserializer
+            = new ObjectDeserializationContext(input, javaClass);
+        try {
+            deserializer.parse();
+        } catch (Exception e) {
+            throw new DeserializationException(
+                i18n.getMessage("genericDeserializationError"), e);
+        }
+        return deserializer.getValue();
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/ObjectSerializer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/ObjectSerializer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/ObjectSerializer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,197 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import java.io.Writer;
+
+import org.globus.wsrf.utils.AnyHelper;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+import org.apache.axis.Constants;
+import org.apache.axis.message.MessageElement;
+
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+/**
+ * Converts Java Objects to DOM Elements and SOAP Elements.
+ * The objects must be compliant with the Axis Bean model, i.e. generated using
+ * the WSDL2Java tool from an XML Schema definition or must be of simple type.
+ */
+public class ObjectSerializer {
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public static SOAPElement toSOAPElement(Object obj)
+        throws SerializationException {
+        return toSOAPElement(obj, null, false);
+    }
+
+    public static SOAPElement toSOAPElement(Object obj, QName name)
+        throws SerializationException {
+        return toSOAPElement(obj, name, false);
+    }
+
+    /**
+     * Populates a SOAPElement with an arbitrary
+     * object. The object will get wrapped inside of an element
+     * named after the qname parameter.
+     *
+     * @param obj object to be serialized in the any element
+     * @param name name of element the value should be wrapped inside
+     * @return content of any element as a SOAPElement
+     * @throws SerializationException if the object cannot be put
+     *                  in a MessageElement
+     */
+    public static SOAPElement toSOAPElement(Object obj,
+                                            QName name,
+                                            boolean nillable)
+        throws SerializationException {
+        if (obj instanceof MessageElement) {
+            MessageElement element = (MessageElement)obj;
+            if (name == null || name.equals(element.getQName())) {
+                return element;
+            } else {
+                throw new SerializationException(
+                    i18n.getMessage("notImplemented"));
+            }
+        } else if (obj instanceof Element) {
+            Element element = (Element)obj;
+            if (name == null ||
+                (name.getLocalPart().equals(element.getLocalName()) &&
+                 name.getNamespaceURI().equals(element.getNamespaceURI()))) {
+                return new MessageElement((Element)obj);
+            } else {
+                throw new SerializationException(
+                    i18n.getMessage("notImplemented"));
+            }
+        }
+
+        if (name == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "name"));
+        }
+
+        MessageElement messageElement = new MessageElement();
+        messageElement.setQName(name);
+        try {
+            messageElement.setObjectValue(obj);
+        } catch (Exception e) {
+            throw new SerializationException(
+                i18n.getMessage("genericSerializationError"), e);
+        }
+        if (obj == null && nillable) {
+            try {
+                messageElement.addAttribute(Constants.NS_PREFIX_SCHEMA_XSI,
+                                            Constants.URI_DEFAULT_SCHEMA_XSI,
+                                            "nil",
+                                            "true");
+            } catch (Exception e) {
+                throw new SerializationException(
+                    i18n.getMessage("genericSerializationError"), e);
+            }
+        }
+        return messageElement;
+    }
+
+    public static Element toElement(Object obj)
+        throws SerializationException {
+        return toElement(obj, null, false);
+    }
+
+    public static Element toElement(Object obj, QName name)
+        throws SerializationException {
+        return toElement(obj, name, false);
+    }
+
+    public static Element toElement(Object obj,
+                                    QName name,
+                                    boolean nillable)
+        throws SerializationException {
+        if (obj instanceof MessageElement) {
+            MessageElement messageElement = (MessageElement)obj;
+            if (name == null || name.equals(messageElement.getQName())) {
+                Element element = null;
+                try {
+                    element = AnyHelper.toElement(messageElement);
+                } catch (Exception e) {
+                    throw new SerializationException(
+                        i18n.getMessage("genericSerializationError"), e);
+                }
+                return element;
+            } else {
+                throw new SerializationException(
+                    i18n.getMessage("notImplemented"));
+            }
+        } else if (obj instanceof Element) {
+            Element element = (Element)obj;
+            if (name == null ||
+                (name.getLocalPart().equals(element.getLocalName()) &&
+                 name.getNamespaceURI().equals(element.getNamespaceURI()))) {
+                return element;
+            } else {
+                throw new SerializationException(
+                    i18n.getMessage("notImplemented"));
+            }
+        }
+
+        MessageElement messageElement =
+            (MessageElement)toSOAPElement(obj, name, nillable);
+        try {
+            return AnyHelper.toElement(messageElement);
+        } catch (Exception e) {
+            throw new SerializationException(
+                i18n.getMessage("genericSerializationError"), e);
+        }
+    }
+
+    public static String toString(Object obj)
+        throws SerializationException {
+        return toString(obj, null, false);
+    }
+
+    public static String toString(Object obj, QName name)
+        throws SerializationException {
+        return toString(obj, name, false);
+    }
+
+    public static String toString(Object obj, QName name, boolean nillable)
+        throws SerializationException {
+        MessageElement messageElement =
+            (MessageElement)toSOAPElement(obj, name, nillable);
+        try {
+            return AnyHelper.toString(messageElement);
+        } catch (Exception e) {
+            throw new SerializationException(
+                i18n.getMessage("genericSerializationError"), e);
+        }
+    }
+
+    public static void serialize(Writer writer, Object obj, QName name) 
+        throws SerializationException {
+        SOAPElement soapElement = ObjectSerializer.toSOAPElement(obj, name);
+        try {
+            AnyHelper.write(writer, (MessageElement)soapElement);
+        } catch (Exception e) {
+            throw new SerializationException(
+                i18n.getMessage("genericSerializationError"), e);
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionDeserializer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionDeserializer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionDeserializer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,53 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.apache.axis.Constants;
+import org.apache.axis.encoding.ser.SimpleDeserializerFactory;
+import org.apache.axis.types.URI;
+
+import org.globus.wsrf.WSRFConstants;
+import org.oasis.wsrf.properties.QueryExpressionType;
+
+import javax.xml.namespace.QName;
+
+public class QueryExpressionDeserializer extends DialectDependentDeserializer {
+
+    private static final QName ATTR = 
+        new QName(QueryExpressionType.NAMESPACE, 
+                  QueryExpressionType.DIALECT_ATTR);
+
+    private static final URI XPATH_1_DIALECT_URI;
+
+    static {
+        try {
+            XPATH_1_DIALECT_URI = new URI(WSRFConstants.XPATH_1_DIALECT);
+        } catch(Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+    
+    public QueryExpressionDeserializer() {
+        this.attributeName = ATTR;
+        this.javaType = QueryExpressionType.class;
+        this.failOnError = false;
+        registerDeserializerFactory(XPATH_1_DIALECT_URI,
+                                    new SimpleDeserializerFactory(
+                                           String.class,
+                                           Constants.XSD_STRING));
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionDeserializerFactory.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionDeserializerFactory.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionDeserializerFactory.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,38 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.apache.axis.encoding.ser.BaseDeserializerFactory;
+
+import javax.xml.rpc.encoding.Deserializer;
+import javax.xml.rpc.JAXRPCException;
+
+/**
+ * DeserializerFactory for QueryExpressionType
+ */
+public class QueryExpressionDeserializerFactory 
+    extends BaseDeserializerFactory {
+    
+    public QueryExpressionDeserializerFactory() {
+        super(QueryExpressionDeserializer.class);
+    }
+
+    public Deserializer getDeserializerAs(String mechanismType)
+        throws JAXRPCException {
+        return new QueryExpressionDeserializer();
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionSerializer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionSerializer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionSerializer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.apache.axis.Constants;
+import org.apache.axis.encoding.ser.SimpleSerializerFactory;
+import org.apache.axis.types.URI;
+
+import org.globus.wsrf.WSRFConstants;
+import org.oasis.wsrf.properties.QueryExpressionType;
+
+import javax.xml.namespace.QName;
+
+public class QueryExpressionSerializer extends DialectDependentSerializer {
+
+    private static final QName ATTR = 
+        new QName(QueryExpressionType.NAMESPACE, 
+                  QueryExpressionType.DIALECT_ATTR);
+
+    private static final URI XPATH_1_DIALECT_URI;
+    
+    static {
+        try {
+            XPATH_1_DIALECT_URI = new URI(WSRFConstants.XPATH_1_DIALECT);
+        } catch(Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+    public QueryExpressionSerializer() {
+        this.attributeName = ATTR;
+        registerSerializerFactory(XPATH_1_DIALECT_URI,
+                                  new SimpleSerializerFactory(
+                                         String.class,
+                                         Constants.XSD_STRING));
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionSerializerFactory.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionSerializerFactory.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/QueryExpressionSerializerFactory.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,35 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.apache.axis.encoding.ser.BaseSerializerFactory;
+import org.apache.axis.encoding.Serializer;
+
+/**
+ * SerializerFactory for QueryExpressionType
+ */
+public class QueryExpressionSerializerFactory 
+    extends BaseSerializerFactory {
+
+    public QueryExpressionSerializerFactory() {
+        super(QueryExpressionSerializer.class);
+    }
+
+    protected Serializer getSpecialized(String mechanismType) {
+        return new QueryExpressionSerializer();
+    } 
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/SerializationException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/SerializationException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/SerializationException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,61 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.globus.common.ChainedException;
+
+/**
+ * This exception is raised if the serialization from an object failed.
+ */
+public class SerializationException extends ChainedException {
+    
+    /**
+     * Creates a SerializationException without error message.
+     */
+    public SerializationException() {
+    }
+    
+    /**
+     * Creates a SerializationException with a given error message.
+     *
+     * @param message error message
+     */
+    public SerializationException(String message) {
+        super(message);
+    }
+    
+    /**
+     * Creates a SerializationException with a given error message and nested
+     * exception.
+     *
+     * @param message error message
+     * @param exception nested exception/
+     */
+    public SerializationException(String message,
+                                  Throwable exception) {
+        super(message, exception);
+    }
+    
+    /**
+     * Creates a SerializationException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public SerializationException(Throwable exception) {
+        super("", exception);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionDeserializer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionDeserializer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionDeserializer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,72 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.apache.axis.Constants;
+import org.apache.axis.encoding.ser.QNameDeserializerFactory;
+import org.apache.axis.types.URI;
+
+import org.globus.wsrf.WSNConstants;
+import org.oasis.wsn.TopicExpressionType;
+
+import javax.xml.namespace.QName;
+
+public class TopicExpressionDeserializer extends DialectDependentDeserializer
+{
+
+    private static final QName ATTR = 
+        new QName(TopicExpressionType.NAMESPACE, 
+                  TopicExpressionType.DIALECT_ATTR);
+    
+    private static final URI SIMPLE_TOPIC_DIALECT;
+    private static final URI CONCRETE_TOPIC_DIALECT;
+    private static final URI FULL_TOPIC_DIALECT;
+    
+    static
+    {
+        try
+        {
+            SIMPLE_TOPIC_DIALECT = 
+                new URI(WSNConstants.SIMPLE_TOPIC_DIALECT);
+            CONCRETE_TOPIC_DIALECT = 
+                new URI(WSNConstants.CONCRETE_TOPIC_DIALECT);
+            FULL_TOPIC_DIALECT =
+                new URI(WSNConstants.FULL_TOPIC_DIALECT);
+        }
+        catch(Exception e)
+        {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+    public TopicExpressionDeserializer()
+    {
+        this.attributeName = ATTR;
+        this.javaType = TopicExpressionType.class;
+        registerDeserializerFactory(SIMPLE_TOPIC_DIALECT,
+                                    new QNameDeserializerFactory(
+                                           QName.class,
+                                           Constants.XSD_QNAME));
+        registerDeserializerFactory(CONCRETE_TOPIC_DIALECT,
+                                    new QNameDeserializerFactory(
+                                           QName.class,
+                                           Constants.XSD_QNAME));
+        registerDeserializerFactory(FULL_TOPIC_DIALECT,
+                                    new QNameDeserializerFactory(
+                                           QName.class,
+                                           Constants.XSD_QNAME));
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionDeserializerFactory.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionDeserializerFactory.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionDeserializerFactory.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.apache.axis.encoding.ser.BaseDeserializerFactory;
+
+import javax.xml.rpc.encoding.Deserializer;
+import javax.xml.rpc.JAXRPCException;
+
+/**
+ * SerializerFactory for TopicExpression MessageElements
+ *
+ */
+public class TopicExpressionDeserializerFactory extends BaseDeserializerFactory
+{
+    public TopicExpressionDeserializerFactory()
+    {
+        // Share TopicExpressionSerializer instance
+        super(TopicExpressionDeserializer.class);
+    }
+
+    public Deserializer getDeserializerAs(String mechanismType)
+        throws JAXRPCException 
+    {
+        return new TopicExpressionDeserializer();
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionSerializer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionSerializer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionSerializer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,71 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.apache.axis.Constants;
+import org.apache.axis.encoding.ser.QNameSerializerFactory;
+import org.apache.axis.types.URI;
+
+import org.globus.wsrf.WSNConstants;
+import org.oasis.wsn.TopicExpressionType;
+
+import javax.xml.namespace.QName;
+
+public class TopicExpressionSerializer extends DialectDependentSerializer
+{
+
+    private static final QName ATTR = 
+        new QName(TopicExpressionType.NAMESPACE, 
+                  TopicExpressionType.DIALECT_ATTR);
+
+    private static final URI SIMPLE_TOPIC_DIALECT;
+    private static final URI CONCRETE_TOPIC_DIALECT;
+    private static final URI FULL_TOPIC_DIALECT;
+    
+    static
+    {
+        try
+        {
+            SIMPLE_TOPIC_DIALECT = 
+                new URI(WSNConstants.SIMPLE_TOPIC_DIALECT);
+            CONCRETE_TOPIC_DIALECT = 
+                new URI(WSNConstants.CONCRETE_TOPIC_DIALECT);
+            FULL_TOPIC_DIALECT =
+                new URI(WSNConstants.FULL_TOPIC_DIALECT);
+        }
+        catch(Exception e)
+        {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+    public TopicExpressionSerializer()
+    {
+        this.attributeName = ATTR;
+        registerSerializerFactory(SIMPLE_TOPIC_DIALECT,
+                                  new QNameSerializerFactory(
+                                         QName.class,
+                                         Constants.XSD_QNAME));
+        registerSerializerFactory(CONCRETE_TOPIC_DIALECT,
+                                  new QNameSerializerFactory(
+                                         QName.class,
+                                         Constants.XSD_QNAME));
+        registerSerializerFactory(FULL_TOPIC_DIALECT,
+                                  new QNameSerializerFactory(
+                                         QName.class,
+                                         Constants.XSD_QNAME));
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionSerializerFactory.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionSerializerFactory.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/encoding/TopicExpressionSerializerFactory.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,38 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.apache.axis.encoding.ser.BaseSerializerFactory;
+import org.apache.axis.encoding.Serializer;
+
+/**
+ * SerializerFactory for TopicExpression MessageElements
+ *
+ */
+public class TopicExpressionSerializerFactory extends BaseSerializerFactory
+{
+    public TopicExpressionSerializerFactory()
+    {
+        // Share TopicExpressionSerializer instance
+        super(TopicExpressionSerializer.class);
+    }
+
+    protected Serializer getSpecialized(String mechanismType) 
+    {
+        return new TopicExpressionSerializer();
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/AddressingHandler.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/AddressingHandler.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/AddressingHandler.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,249 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.handlers;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import org.globus.wsrf.config.ContainerConfig;
+
+import org.apache.axis.AxisEngine;
+import org.apache.axis.MessageContext;
+import org.apache.axis.AxisFault;
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.description.OperationDesc;
+import org.apache.axis.description.ServiceDesc;
+import org.apache.axis.handlers.soap.SOAPService;
+
+import org.apache.axis.message.addressing.Constants;
+import org.apache.axis.message.addressing.To;
+import org.apache.axis.message.addressing.AddressingHeaders;
+import org.apache.axis.message.addressing.Action;
+import org.apache.axis.message.addressing.ReferencePropertiesType;
+import org.apache.axis.message.addressing.util.AddressingUtils;
+import org.apache.axis.types.URI;
+
+import org.globus.axis.description.ServiceDescUtil;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Extends the Apache WS-Addressing AddressingHandler to customize how
+ * the target service is set.
+ */
+public class AddressingHandler
+    extends org.apache.axis.message.addressing.handler.AddressingHandler {
+    
+    private static final QName MESSAGE_ID_QNAME = 
+        new QName(Constants.NS_URI_ADDRESSING, Constants.MESSAGE_ID);
+
+    private static final QName TO_QNAME = 
+        new QName(Constants.NS_URI_ADDRESSING, Constants.TO);
+
+    private static final QName FROM_QNAME = 
+        new QName(Constants.NS_URI_ADDRESSING, Constants.FROM);
+    
+    private static final QName ACTION_QNAME = 
+        new QName(Constants.NS_URI_ADDRESSING, Constants.ACTION);
+
+    private static final QName REPLY_TO_QNAME = 
+        new QName(Constants.NS_URI_ADDRESSING, Constants.REPLY_TO);
+
+    private static final QName FAULT_TO_QNAME = 
+        new QName(Constants.NS_URI_ADDRESSING, Constants.FAULT_TO);
+
+    private static final QName RELATES_TO_QNAME = 
+        new QName(Constants.NS_URI_ADDRESSING, Constants.RELATES_TO);
+
+    protected void processClientRequest(MessageContext msgContext,
+                                        boolean setMustUnderstand)
+        throws Exception {
+        super.processClientRequest(msgContext, setMustUnderstand);
+        // pass wsa header list
+        setSignedHeaders(msgContext,
+                         Constants.ENV_ADDRESSING_REQUEST_HEADERS);
+    }
+
+    protected void processServerRequest(MessageContext msgContext)
+        throws Exception {
+        super.processServerRequest(msgContext);
+        setVerifiedHeaders(msgContext,
+                           Constants.ENV_ADDRESSING_REQUEST_HEADERS);
+    }
+
+    protected void processServerResponse(MessageContext msgContext,
+                                         boolean setMustUnderstand)
+        throws Exception {
+        OperationDesc operation = msgContext.getOperation();
+        if (operation != null) {
+            SOAPService service = msgContext.getService();
+            if (service != null) {
+                ServiceDesc serviceDesc = service.getServiceDescription();
+                if (serviceDesc != null) {
+                    Map actionMap = (Map)serviceDesc.getProperty(
+                                              ServiceDescUtil.ACTION_MAP);
+                    if (actionMap != null) {
+                        String action = (String)actionMap.get(operation);
+                        if (action != null) {
+                            setAction(msgContext, action);
+                        }
+                    }
+                }
+            }
+        }
+        super.processServerResponse(msgContext, setMustUnderstand);
+        // pass wsa header list
+        setSignedHeaders(msgContext,
+                         Constants.ENV_ADDRESSING_RESPONSE_HEADERS);
+    }
+
+    private void setAction(MessageContext msgContext, String newAction) 
+        throws Exception {
+        AddressingHeaders resHeaders = 
+            AddressingUtils.getResponseHeaders(msgContext);
+        Action action = resHeaders.getAction();
+        if (action == null) {
+            resHeaders.setAction(new Action(new URI(newAction)));
+        }
+    }
+
+    protected void setTargetService(MessageContext msgContext,
+                                    AddressingHeaders headers)
+        throws Exception {
+        To toURI = headers.getTo();
+        if (toURI == null) {
+            return;
+        }
+        String path = toURI.getPath();
+        if (path == null) {
+            return;
+        }
+
+        AxisEngine engine = msgContext.getAxisEngine();
+        ContainerConfig config = ContainerConfig.getConfig(engine);
+        String base = config.getWSRFLocation();
+        int len = base.length() + 1;
+
+        if (path.startsWith("/" + base) && path.length() > len) {
+            String service = path.substring(len);
+            msgContext.setTargetService(service);
+        }
+    }
+    
+    private void setVerifiedHeaders(MessageContext msgCtx,
+                                    String headerProperty) {
+        AddressingHeaders headers =
+            (AddressingHeaders)msgCtx.getProperty(headerProperty);
+        if (headers == null) {
+            return;
+        }
+        Map currentHeaders = (Map)msgCtx.getProperty(
+         org.globus.wsrf.impl.security.authentication.Constants.ENFORCED_SECURE_HEADERS);
+
+        Map verifiedHeaders = updateVerifiedHeaders(currentHeaders, headers);
+
+        msgCtx.setProperty(
+          org.globus.wsrf.impl.security.authentication.Constants.ENFORCED_SECURE_HEADERS,
+          verifiedHeaders);
+    }
+
+    /**
+     * This does not include the header that contains the key 
+     */
+    private Map updateVerifiedHeaders(Map map, AddressingHeaders headers) {
+        if (map == null) {
+            map = new HashMap();
+        }
+
+        // must be checked as we do dispatched on that
+        if (headers.getTo() != null) {
+            map.put(TO_QNAME, "");
+        }
+        // both must be checked as fault or reply
+        // can be returned to these if specified
+        if (headers.getReplyTo() != null) {
+            map.put(REPLY_TO_QNAME, "");
+        }
+        if (headers.getFaultTo() != null) {
+            map.put(FAULT_TO_QNAME, "");
+        }
+
+        return map;
+    }
+
+    private void setSignedHeaders(MessageContext msgCtx,
+                                  String headerProperty) {
+        AddressingHeaders headers =
+            (AddressingHeaders)msgCtx.getProperty(headerProperty);
+        if (headers == null) {
+            return;
+        }
+        Map currentHeaders = (Map)msgCtx.getProperty(
+         org.globus.wsrf.impl.security.authentication.Constants.SECURE_HEADERS);
+        
+        Map secureHeaders = updateSignedHeaders(currentHeaders, headers);
+        
+        msgCtx.setProperty(
+         org.globus.wsrf.impl.security.authentication.Constants.SECURE_HEADERS,
+         secureHeaders);
+    }
+
+    private Map updateSignedHeaders(Map map, AddressingHeaders headers) {
+        if (map == null) {
+            map = new HashMap();
+        }
+
+        if (headers.getMessageID() != null) {
+            map.put(MESSAGE_ID_QNAME, "");
+        }
+        if (headers.getTo() != null) {
+            map.put(TO_QNAME, "");
+        }
+        if (headers.getAction() != null) {
+            map.put(ACTION_QNAME, "");
+        }
+        if (headers.getFrom() != null) {
+            map.put(FROM_QNAME, "");
+        }
+        if (headers.getReplyTo() != null) {
+            map.put(REPLY_TO_QNAME, "");
+        }
+        if (headers.getFaultTo() != null) {
+            map.put(FAULT_TO_QNAME, "");
+        }
+        if ((headers.getRelatesTo() != null) && 
+            !headers.getRelatesTo().isEmpty()) {
+            map.put(RELATES_TO_QNAME, "");
+        }
+        ReferencePropertiesType props = headers.getReferenceProperties();
+        if (props != null) {
+            MessageElement [] elements = props.get_any();
+            if (elements != null) {
+                for (int i=0;i<elements.length;i++) {
+                    map.put(elements[i].getQName(), "");
+                }
+            }
+        }
+        
+        return map;
+    }
+
+    protected void resetOperations(MessageContext ctx) 
+        throws AxisFault {
+        ServiceDescUtil.resetOperations(ctx);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/FaultHandler.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/FaultHandler.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/FaultHandler.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,160 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.handlers;
+
+import java.util.Calendar;
+
+import javax.xml.soap.SOAPElement;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.Message;
+import org.apache.axis.MessageContext;
+import org.apache.axis.SOAPPart;
+import org.apache.axis.handlers.BasicHandler;
+import org.apache.axis.message.addressing.To;
+import org.apache.axis.message.addressing.Address;
+import org.apache.axis.message.addressing.AddressingHeaders;
+import org.apache.axis.message.addressing.Constants;
+import org.apache.axis.message.addressing.EndpointReference;
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.axis.message.addressing.ReferencePropertiesType;
+
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.impl.ResourceContextImpl;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+import org.oasis.wsrf.faults.BaseFaultType;
+
+// must be after the AddressingHandler
+public class FaultHandler extends BasicHandler {
+
+    private static Log logger =
+        LogFactory.getLog(FaultHandler.class.getName());
+
+    private static I18n i18n = 
+        I18n.getI18n(Resources.class.getName());
+
+    public void invoke(MessageContext msgContext)
+        throws AxisFault {
+        // set address
+        AddressingHeaders headers =
+            (AddressingHeaders)msgContext.getProperty(
+                  Constants.ENV_ADDRESSING_RESPONSE_HEADERS
+            );
+        if (headers == null) {
+            headers = new AddressingHeaders();
+            msgContext.setProperty(Constants.ENV_ADDRESSING_RESPONSE_HEADERS,
+                                   headers);
+        }
+        if (headers.getFrom() != null) {
+            return;
+        }
+        EndpointReference from = getFrom(msgContext);
+        if (from != null) {
+            headers.setFrom(from);
+        }
+    }
+
+    public void onFault(MessageContext msgContext) {
+        Message msg = msgContext.getCurrentMessage();
+        if (msg == null) {
+            return;
+        }
+        SOAPPart part =(SOAPPart) msg.getSOAPPart();
+        if (part == null) {
+            return;
+        }
+        Object obj = part.getCurrentMessage();
+        if (!(obj instanceof BaseFaultType)) {
+            return;
+        }
+        BaseFaultType fault = (BaseFaultType)obj;
+
+        // check timestamp
+        Calendar timestamp = fault.getTimestamp();
+        if (timestamp == null) {
+            fault.setTimestamp(Calendar.getInstance());
+        }
+
+        // check originator
+        EndpointReferenceType originator = fault.getOriginator();
+        if (originator == null) {
+            originator = getFrom(msgContext);
+            fault.setOriginator(originator);
+        }
+    }
+
+    private EndpointReference getFrom(MessageContext msgContext) {
+        // check if service set
+        if (msgContext.getService() == null) {
+            return null;
+        }
+        AddressingHeaders headers =
+            (AddressingHeaders)msgContext.getProperty(
+                  Constants.ENV_ADDRESSING_REQUEST_HEADERS
+            );
+        if (headers == null) {
+            return null;
+        }
+
+        To to = headers.getTo();
+        if (to == null) {
+            logger.warn(i18n.getMessage("noToHeader"));
+            return null;
+        }
+
+        Address address = new Address(to);
+        EndpointReference fromEPR = new EndpointReference(address);
+
+        // set resource properties
+        Message requestMsg = msgContext.getRequestMessage();
+        try {
+            ReferencePropertiesType props =
+                getReferenceProperties(msgContext, requestMsg);
+            if (props != null) {
+                fromEPR.setProperties(props);
+            }
+        } catch (Exception e) {
+            logger.debug("", e);
+        }
+
+        return fromEPR;
+    }
+
+    private ReferencePropertiesType getReferenceProperties(MessageContext ctx,
+                                                           Message msg)
+        throws Exception {
+        ReferencePropertiesType props = null;
+        ResourceContext resourceCtx =
+            new ResourceContextImpl(ctx, msg);
+        // XXX: it extracts the header element directly
+        // and inserts into the reference properties
+        // since it is a header it might have mustUnderstand
+        // actor attributes - these should be removed
+        // this is not done now. propably a clone of the
+        // header should be added
+        SOAPElement element = resourceCtx.getResourceKeyHeader();
+        if (element != null) {
+            props = new ReferencePropertiesType();
+            props.add(element);
+        }
+        return props;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/MessageLoggingHandler.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/MessageLoggingHandler.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/MessageLoggingHandler.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,56 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.handlers;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.Message;
+import org.apache.axis.MessageContext;
+import org.apache.axis.handlers.BasicHandler;
+import org.apache.axis.message.SOAPEnvelope;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.utils.Resources;
+
+/**
+ * This handler logs soap messages.
+ */
+public class MessageLoggingHandler extends BasicHandler {
+
+    private static Log logger =
+        LogFactory.getLog(MessageLoggingHandler.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public void invoke(MessageContext messageContext) throws AxisFault {
+        if (logger.isDebugEnabled()) {
+            Message message = messageContext.getCurrentMessage();
+            if (message == null) {
+                logger.debug("Empty SOAPEnvelope");
+            } else {
+                try {
+                    SOAPEnvelope soapEnvelope = message.getSOAPEnvelope();
+                    logger.debug("SOAPEnvelope: " + soapEnvelope);
+                } catch (AxisFault af) {
+                    logger.error(i18n.getMessage("messageLoggingError"), af);
+                }
+            }
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/URLMapper.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/URLMapper.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/URLMapper.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,80 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.handlers;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+
+import org.globus.wsrf.config.ContainerConfig;
+import org.globus.axis.description.ServiceDescUtil;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.AxisEngine;
+import org.apache.axis.handlers.BasicHandler;
+import org.apache.axis.Message;
+import org.apache.axis.MessageContext;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Sets the target service from <i>MessageContext.TRANS_URL</i> MessageContext
+ * property. Usually will be used when requesting wsdl for a service or when
+ * the WS-Addressing headers are missing.
+ */
+public class URLMapper extends BasicHandler {
+
+    public void invoke(MessageContext msgContext) throws AxisFault {
+
+        if (msgContext.getTargetService() == null &&
+            msgContext.getService() == null) {
+            setTargetService(msgContext, 
+                             (String)msgContext.getProperty(MessageContext.TRANS_URL));
+                        
+            if (msgContext.getService() != null) {
+                ServiceDescUtil.resetOperations(msgContext);
+            }
+        }
+    }
+    
+    public void generateWSDL(MessageContext msgContext) throws AxisFault {
+        invoke(msgContext);
+    }
+    
+    protected void setTargetService(MessageContext msgContext,
+                                    String url) 
+        throws AxisFault {
+        if (url == null) {
+            return;
+        }
+        String path = null;
+        try {
+            path = (new URL(url)).getFile();
+        } catch (MalformedURLException e) {
+            throw AxisFault.makeFault(e);
+        }
+
+        AxisEngine engine = msgContext.getAxisEngine();
+        ContainerConfig config = ContainerConfig.getConfig(engine);
+        String base = config.getWSRFLocation();
+        int len = base.length() + 1;
+
+        if (path.startsWith("/" + base) && path.length() > len) {
+            String service = path.substring(len);
+            msgContext.setTargetService(service);
+        }
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/WSDLHandler.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/WSDLHandler.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/handlers/WSDLHandler.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,37 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.handlers;
+
+import org.globus.axis.description.ServiceDescUtil;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.MessageContext;
+import org.apache.axis.handlers.BasicHandler;
+
+public class WSDLHandler extends BasicHandler {
+
+    public void invoke(MessageContext messageContext) throws AxisFault {
+    }
+    
+    public void generateWSDL(MessageContext msgContext) throws AxisFault {
+        try {
+            ServiceDescUtil.updateWSDL(msgContext);
+        } catch (Exception e) {
+            throw AxisFault.makeFault(e);
+        }
+    }
+}
+

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/BaseResourceProperty.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/BaseResourceProperty.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/BaseResourceProperty.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,151 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourcePropertyMetaData;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+import org.w3c.dom.Element;
+
+import org.globus.wsrf.encoding.ObjectDeserializer;
+import org.globus.wsrf.encoding.ObjectSerializer;
+
+import org.apache.axis.message.MessageElement;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public abstract class BaseResourceProperty implements ResourceProperty {
+
+    private static Log logger =
+        LogFactory.getLog(BaseResourceProperty.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    protected ResourcePropertyMetaData metaData;
+
+    public BaseResourceProperty(QName name) {
+        this(new SimpleResourcePropertyMetaData(name));
+    }
+
+    public BaseResourceProperty(ResourcePropertyMetaData metaData) {
+        if (metaData == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "metaData"));
+        }
+        this.metaData = metaData;
+    }
+
+    protected void setMetaData(ResourcePropertyMetaData metaData) {
+        this.metaData = metaData;
+    }
+
+    public ResourcePropertyMetaData getMetaData() {
+        return this.metaData;
+    }
+
+    protected Object convert(Object value) {
+        if (value == null) {
+            return null;
+        }
+        Class type = getMetaData().getType();
+        if (type == null || type == Object.class) {
+            return value;
+        }
+        try {
+            if (type.isPrimitive()) {
+                return convertPrimitive(type, value);
+            } else {
+                return convertObject(type, value);
+            }
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            String msg = i18n.getMessage("failedToConvert", e.getMessage());
+            logger.debug(msg, e);
+            throw new IllegalArgumentException(msg);
+        }
+    }
+
+    protected Object convertObject(Class type, Object value)
+        throws Exception {
+        QName name = getMetaData().getName();
+        return convert(value, type, name);
+    }
+
+    protected Object convertPrimitive(Class type, Object value)
+        throws Exception {
+        QName name = getMetaData().getName();
+        if (type == Boolean.TYPE) {
+            return convert(value, Boolean.class, name);
+        } else if (type == Character.TYPE) {
+            return convert(value, Character.class, name);
+        } else if (type == Byte.TYPE) {
+            return convert(value, Byte.class, name);
+        } else if (type == Short.TYPE) {
+            return convert(value, Short.class, name);
+        } else  if (type == Integer.TYPE) {
+            return convert(value, Integer.class, name);
+        } else if (type == Long.TYPE) {
+            return convert(value, Long.class, name);
+        } else if (type == Float.TYPE) {
+            return convert(value, Float.class, name);
+        } else if (type == Double.TYPE) {
+            return convert(value, Double.class, name);
+        } else {
+            throw new IllegalArgumentException(
+                i18n.getMessage(
+                    "cantConvertType",
+                    new Object[] {value.getClass(), type}));
+        }
+    }
+
+    private static Object convert(Object value, Class type, QName name)
+        throws Exception {
+        if (type.isAssignableFrom(value.getClass())) {
+            // special case
+            if (value instanceof MessageElement &&
+                Element.class.equals(type)) {
+                return ((MessageElement)value).getAsDOM();
+            }
+            return value;
+        } else if (value instanceof SOAPElement) {
+            return ObjectDeserializer.toObject((SOAPElement)value,
+                                               type);
+        } else if (value instanceof Element) {
+            if (SOAPElement.class.equals(type)) {
+                return new MessageElement((Element)value);
+            } else {
+                return ObjectDeserializer.toObject((Element)value, type);
+            }
+        } else if (type.equals(SOAPElement.class)) {
+            return ObjectSerializer.toSOAPElement(value, name);
+        } else if (type.equals(Element.class)) {
+            return ObjectSerializer.toElement(value, name);
+        } else {
+            throw new IllegalArgumentException(
+                i18n.getMessage(
+                    "cantConvertType",
+                    new Object[] {value.getClass(), type}));
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/DirtyFlagHolder.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/DirtyFlagHolder.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/DirtyFlagHolder.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,30 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+public interface DirtyFlagHolder {
+
+    /**
+     * Sets the dirty flag.
+     *
+     * @param dirty dirty flag.
+     */
+    public void setDirty(boolean dirty);
+    
+    public boolean getDirty();
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/NotificationConsumerCallbackManagerImpl.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/NotificationConsumerCallbackManagerImpl.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/NotificationConsumerCallbackManagerImpl.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,86 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.globus.wsrf.NotificationConsumerCallbackManager;
+import org.globus.wsrf.NotifyCallback;
+
+import org.globus.wsrf.security.SecureResource;
+import org.globus.wsrf.impl.security.descriptor.ResourceSecurityDescriptor;
+
+public class NotificationConsumerCallbackManagerImpl
+    implements NotificationConsumerCallbackManager, SecureResource
+{
+    ResourceSecurityDescriptor resDesc = null;
+    Map callbackTable = new HashMap();
+
+    public NotificationConsumerCallbackManagerImpl(
+				    ResourceSecurityDescriptor desc)
+    {
+        this.resDesc = desc;
+    }
+
+    public void registerCallback(
+        List topicPath,
+        NotifyCallback callback)
+    {
+        this.callbackTable.put(topicPathToString(topicPath), callback);
+    }
+
+    public NotifyCallback getCallback(List topicPath)
+    {
+        return (NotifyCallback) this.callbackTable.get(
+            topicPathToString(topicPath));
+    }
+
+    private static String topicPathToString(List topicPath)
+    {
+        if(topicPath == null)
+        {
+            return null;
+        }
+
+        Iterator nameIterator = topicPath.iterator();
+        if(nameIterator.hasNext())
+        {
+            StringBuffer result = 
+                new StringBuffer(((QName) nameIterator.next()).toString());
+
+            while(nameIterator.hasNext())
+            {
+                result.append("/");
+                result.append(((QName) nameIterator.next()).getLocalPart());
+            }
+            return result.toString();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public ResourceSecurityDescriptor getSecurityDescriptor()
+    {
+        return this.resDesc;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/PersistentReflectionResource.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/PersistentReflectionResource.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/PersistentReflectionResource.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,271 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.PersistenceCallback;
+import org.globus.wsrf.RemoveCallback;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.utils.XmlPersistenceHelper;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+/**
+ * A persistent specialization of
+ * {@link ReflectionResource ReflectionResource}. It persists itself by
+ * serializing the resource implementation JavaBean used in constructing an
+ * object as a ReflectionResource. The result of storing the resource is an XML
+ * file that corresponds exactly to the XML Schema Resource document defined
+ * for this resource. Future versions will offer alternative modes of
+ * persistence.<p>
+ * <p>
+ * This class can be very useful for rapid prototyping of persistent resources.
+ * In addition, it is possible to refine the persistence model by overriding
+ * the {@link #load(ResourceKey) load()} and {@link #store() store()} methods.
+ * <p>
+ * Usage:
+ * <ul>
+*  <li>extend this class by implementing the function
+ * {@link #getResourceBeanClass() getResourceBeanClass}.</li>
+ * <li>apply usage rules for extending
+ * {@link ReflectionResource ReflectionResource}:
+ *     <ul><li>override initialize() in order to add run-time-defined
+ *         resource properties and/or topics.</li>
+ *         <li>add specialized behavior, for instance domain-specific functions.
+ *         </li>
+ *     </ul>
+ * </li>
+ * <li>As a resource home, use a specialization of a PersistentResource-managing
+ * ResourceHome such as {@link ResourceHomeImpl ResourceHomeImpl}
+ * and follow its set of usage rules.</li>
+ * <li>initialize the objects by calling
+ *  {@link ReflectionResource#initialize(Object, QName, Object) initialize}.
+ * </li>
+ * <li>Call the store() method after initial creation of the resource (since
+ *     this is not triggered by {@link ResourceHomeImpl
+ *     ResourceHomeImpl}), and then whenever
+ *     adequate (for instance when a resource property value, or a set thereof,
+ *     is modified). Remember to set the dirty flag to true first.
+ *     (see {@link #setDirty(boolean) setDirty})
+ * </li>
+ * </ul>
+ * <p>
+ * Refining the persistence model:<p>
+ * The default persistence model implemented by this class may be sufficient in
+ * most simple cases, but refining it may sometimes make sense, for instance
+ * in cases where:
+ * <ul>
+ *   <li> when it is not necessary to persist every resource property.</li>
+ *   <li> when there is some implementation state that needs to be stored
+ *        that is not a resource property.</li>
+ * </ul>
+ * Note: The implementation of this class use the PerformanceLogger in order to log
+ * the duration of storing and loading the resource. The log subcategory is
+ * <code>performance</code>.
+ * <p>
+ * Dirty flag:<p>
+ * A dirty flag is set to true every time a resource property of the
+ * Schema-defined resource property set is set to a new value. This enables to
+ * optimize storing so the resource is not actually persisted each time it is
+ * passivated by ResourceHomeImpl. (note: maybe this is overkill and not
+ * necessary?)
+ * <p>
+
+ *
+ * @see ReflectionResource
+ * @see ResourceHomeImpl
+ * @see PersistenceCallback
+ * @see RemoveCallback
+ */
+public abstract class PersistentReflectionResource
+    extends ReflectionResource
+    implements RemoveCallback, PersistenceCallback, DirtyFlagHolder {
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private static Log logger =
+        LogFactory.getLog(PersistentReflectionResource.class.getName());
+
+    /**
+     * The dirty flag is set to true at instanciation time, so that the
+     * initial creator of the resource just needs to call {@link #store() store}
+     * in order to actually persist the new resource for the first time.
+     */
+    private boolean dirty = true; 
+
+    //The dirty flacreated clean since in most cases,
+    //creation will occur after a persisted version of the resource exists
+    //already in the persistence store.
+
+    private XmlPersistenceHelper persistenceHelper;
+    
+    protected synchronized XmlPersistenceHelper getPersistenceHelper() {
+        if (this.persistenceHelper == null) {
+            try {
+                this.persistenceHelper = 
+                    new XmlPersistenceHelper(getResourceBeanClass());
+            } catch (IOException e) {
+                logger.error(i18n.getMessage("resourceInitError"), e);
+                throw new RuntimeException(e.getMessage());
+            }
+        }
+        return this.persistenceHelper;
+    }
+        
+    /**
+     *
+     * @return Class The class of the Axis-generated Serializable
+     * implementation bean for the resource property set. 
+     * @see ReflectionResource
+     */
+    abstract protected Class getResourceBeanClass();
+
+    /**
+     * Called by ResourceHomeImpl when activating a resource.
+     * This is called after an instance has been created with the
+     * parameterless constructor, so nothing has been initialized yet.
+     * After deserialization, this calls initialize() so as to initialize
+     * the resource properly, with its key and the stored state of its
+     * resource properties.
+     * <p>
+     * If the resource was successfully loaded, its dirty flag is set to false.
+     * <p>
+     * <b>Postcondition</b> getDirty() == false
+     * @see #setDirty(boolean) setDirty()
+     * @see PersistenceCallback
+     */
+    public synchronized void load(ResourceKey key) throws ResourceException {
+        getPersistenceHelper().load(key, this);
+        setDirty(false);
+    }
+
+    /**
+     * Store the resource into an XML document (current implementation).
+     * The name of the file is governed by {@link #getKeyAsFile(Object)
+     * getKeyAsFile()}.
+     *
+     * This stores the state of the implementation JavaBean. If some resource
+     * properties have been implemented with something else (for instance
+     * getters and setters from another object) they will not be
+     * persisted with the current state. This is not a problem if their state
+     * is immutable after initial creation, as their values will be set by
+     * {@link ReflectionResource#initialize(Object, QName, Object) initialize},
+     * ReflectionResource.initialize()} which is called by
+     * this method.
+     * (TODO: persist based on each RP?)
+     * <p>
+     * If the resource was successfully stored, its dirty flag is set to false.
+     * <p>
+     * <b>Postcondition</b> getDirty() == false
+     * @see #setDirty(boolean) setDirty()
+     * @see #getKeyAsFile(Object) getKeyAsFile()
+     * @see PersistenceCallback
+     * @throws ResourceException if the resource could not be stored
+     */
+    public synchronized void store() throws ResourceException {
+        if (!this.dirty) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Dirty flag not set: resource will not be stored");
+            }
+            return;
+        }
+        getPersistenceHelper().store(this);
+        setDirty(false);
+    }
+
+    /**
+     * Create a file object based on the key supplied in parameter.
+     * The file name will follow the format:<p>
+     * file name :== (class name)_(key scalar value).xml<p>
+     * where:
+     * <ul>
+     * <li>(class name) is class name of the implementation resource bean.</li>
+     * <li>(key scalar value) is the toString value of the key passed in
+     *     parameter. If the key is an instance of ResourceKey, its value is
+     *     the result of key.getValue().</li>
+     *
+     * @param key Object the key of the resource
+     * @return File
+     */
+    protected File getKeyAsFile(Object key) {
+        return getPersistenceHelper().getKeyAsFile(key);
+    }
+
+    protected File getStorageDirectory() {
+        return getPersistenceHelper().getStorageDirectory();
+    }
+
+    /**
+     * @see RemoveCallback
+     */
+    public void remove() throws ResourceException {
+        getPersistenceHelper().remove(this);
+    }
+
+    /**
+     * @param rpQName QName
+     * @param resourceBean Object
+     * @throws Exception
+     * @return ResourceProperty
+     */
+    protected ResourceProperty createNewResourceProperty(
+        QName rpQName,
+        Object resourceBean)
+        throws Exception {
+        ResourceProperty prop =
+            super.createNewResourceProperty(rpQName, resourceBean);
+
+        return new PersistentResourceProperty(prop, this);
+    }
+
+
+    /**
+     * Sets the dirty flag on this persistent object. The resource will not be
+     * persisted unless it the firty flag is true.
+     *
+     * @param changed boolean To flag the resource as changed i.e. "dirty" and
+     * have it persisted by the next invocation of {@link #store() store}
+     */
+    public void setDirty(boolean changed) {
+        this.dirty = changed;
+    }
+
+    public boolean getDirty() {
+        return this.dirty;
+    }
+
+    /**
+     * This function returns the keys of the resources that have been stored.
+     * This should be used by the home in order to recover state,
+     * by listing all the stored resource keys and adding them to the
+     * map of resources. The consumer code must test for null.
+     * @return List the list of key values
+     */
+    public List getStoredResourceKeyValues() throws IOException {
+        return getPersistenceHelper().list();
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/PersistentResourceProperty.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/PersistentResourceProperty.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/PersistentResourceProperty.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,98 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.soap.SOAPElement;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.w3c.dom.Element;
+
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourcePropertyMetaData;
+import org.globus.wsrf.encoding.SerializationException;
+
+/**
+ * A wrapper for a ResourceProperty object. If
+ * {@link PersistentResourceProperty#set set} is called it will set the dirty
+ * flag of the associated {@link DirtyFlagHolder DirtyFlagHolder} to true.
+ *
+ * @see PersistentReflectionResource
+ */
+public class PersistentResourceProperty implements ResourceProperty {
+
+    private ResourceProperty rp;
+    private DirtyFlagHolder dirtyFlagHolder;
+
+    /**
+     * @param resourceProperty ResourceProperty to wrap
+     * @param dirtyFlagHolder DirtyFlagHolder to be set to "dirty" when the
+     *                                        property is changed
+     * @throws Exception
+     */
+    public PersistentResourceProperty(ResourceProperty resourceProperty,
+                                      DirtyFlagHolder dirtyFlagHolder)
+        throws Exception {
+        this.rp = resourceProperty;
+        this.dirtyFlagHolder = dirtyFlagHolder;
+    }
+
+    public void set(int index, Object value) {
+        rp.set(index,value);
+        dirtyFlagHolder.setDirty(true);
+    }
+
+    public void add(Object value) {
+        rp.add(value);
+        dirtyFlagHolder.setDirty(true);
+    }
+
+    public boolean remove(Object value) {
+        if (rp.remove(value)) {
+            dirtyFlagHolder.setDirty(true);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public Object get(int index) { return rp.get(index); }
+
+    public void clear() {
+        rp.clear();
+        dirtyFlagHolder.setDirty(true);
+    }
+
+    public int size() { return rp.size(); }
+
+    public boolean isEmpty() { return rp.isEmpty(); }
+
+    public Iterator iterator() { return rp.iterator(); }
+
+    public SOAPElement[] toSOAPElements()
+        throws SerializationException { return rp.toSOAPElements(); }
+
+    public Element[] toElements()
+        throws SerializationException { return rp.toElements(); }
+
+    public ResourcePropertyMetaData getMetaData() { return rp.getMetaData(); }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/QueryEngineImpl.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/QueryEngineImpl.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/QueryEngineImpl.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,131 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.naming.NamingEnumeration;
+import javax.naming.NameClassPair;
+
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.query.ExpressionEvaluator;
+import org.globus.wsrf.query.QueryEngine;
+import org.globus.wsrf.query.QueryException;
+import org.globus.wsrf.query.UnsupportedQueryDialectException;
+import org.globus.wsrf.query.QueryEvaluationException;
+import org.globus.wsrf.query.InvalidQueryExpressionException;
+import org.globus.wsrf.jndi.JNDIUtils;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Hashtable;
+
+import org.oasis.wsrf.properties.QueryExpressionType;
+
+/**
+ * Executes queries on resource property sets.
+ * The engine looks for evaluators under "java:comp/env/query/eval" context.
+ * @see ResourcePropertySet
+ */
+public class QueryEngineImpl implements QueryEngine {
+
+    static Log logger =
+        LogFactory.getLog(QueryEngineImpl.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private static String QUERY_EVALUATOR_CONTEXT =
+        Constants.JNDI_BASE_NAME + "/query/eval";
+
+    private Hashtable evaluators = new Hashtable();
+
+    public QueryEngineImpl() {
+        refresh();
+    }
+
+    /**
+     * Reinitializes the evaluators list from JNDI context. If any evaluators
+     * were added using {@link #registerEvaluator(ExpressionEvaluator)
+     * registerEvaluator()} function they will be lost.
+     */
+    public synchronized void refresh() {
+        evaluators.clear();
+        NamingEnumeration list = null;
+        try {
+            Context initialContext = new InitialContext();
+            list = initialContext.list(QUERY_EVALUATOR_CONTEXT);
+            NameClassPair pair = null;
+            ExpressionEvaluator evaluator = null;
+            while(list.hasMore()) {
+                pair = (NameClassPair)list.next();
+                evaluator = (ExpressionEvaluator)JNDIUtils.lookup(
+                               initialContext,
+                               QUERY_EVALUATOR_CONTEXT + "/" + pair.getName(),
+                               ExpressionEvaluator.class
+                             );
+                registerEvaluator(evaluator);
+            }
+        } catch (NamingException e) {
+            logger.error(i18n.getMessage("queryEngineInitError"), e);
+        } finally {
+            if (list != null) {
+                try { list.close(); } catch (NamingException ee) {}
+            }
+        }
+    }
+
+    public void registerEvaluator(ExpressionEvaluator evaluator) {
+        String[] names = evaluator.getDialects();
+        for (int i = 0; i < names.length; i++) {
+            this.evaluators.put(names[i], evaluator);
+        }
+    }
+
+    public ExpressionEvaluator getEvaluator(String dialect) {
+        ExpressionEvaluator evaluator =
+            (ExpressionEvaluator) this.evaluators.get(dialect);
+        return evaluator;
+    }
+
+    public Object executeQuery(QueryExpressionType expression,
+                               ResourcePropertySet resourcePropertySet)
+        throws UnsupportedQueryDialectException,
+               QueryEvaluationException,
+               InvalidQueryExpressionException,
+               QueryException {
+        if (expression == null) {
+            throw new QueryException(i18n.getMessage("noQuery"));
+        }
+        if (expression.getDialect() == null) {
+            throw new QueryException(
+                i18n.getMessage("nullArgument", "expression.dialect")
+            );
+        }
+        String dialect = expression.getDialect().toString();
+        ExpressionEvaluator evaluator = getEvaluator(dialect);
+        if (evaluator == null) {
+            throw new UnsupportedQueryDialectException(
+                i18n.getMessage("unsupportedQueryDialect", dialect)
+            );
+        }
+        return evaluator.evaluate(expression, resourcePropertySet);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ReflectionResource.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ReflectionResource.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ReflectionResource.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,427 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.lang.reflect.Method;
+import java.util.Calendar;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.description.ElementDesc;
+import org.apache.axis.description.FieldDesc;
+import org.apache.axis.description.TypeDesc;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.ResourceIdentifier;
+import org.globus.wsrf.ResourceLifetime;
+import org.globus.wsrf.ResourceProperties;
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourcePropertyMetaData;
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.utils.Resources;
+
+/**
+ * An implementation of {@link ResourceProperties ResourceProperties} and
+ * {@link ResourceIdentifier ResourceIdentifier} which
+ * frees the developer from having to write a getter and possibly a setter
+ * to implement every resource property (RP).
+ * <p>
+ * This class uses an Axis-generated JavaBean class based on the Schema
+ * definition of the RP set used by the service port type in WSDL.
+ * Since the generated class contain a JavaBean property as well as QName and
+ * Schema type metadata (such as occurence cardinality) for each RP, it is
+ * possible to automatically create {@link org.globus.wsrf.impl.ReflectionResourceProperty ReflectionResourceProperty}
+ * objects to provide an implementation of the RPs. This is what
+ * ReflectionResource does.
+ * <p>
+ * Advantages of using this class:
+ * <ul>
+ * <li>Less errors due to forgetting to implement a resource property.</li>
+ * <li>Less code to write, so implementing a resource is faster.</li>
+ * <li>Easier maintenance when the WSDL/Schema definition changes.</li>
+ * <li>Less errors due to namespace mismatch between WSDL and code.</li>
+ * <li>Less errors thanks to the handling of a few special cases.</li>
+ * </ul>
+ * <p>
+ * Usage:
+ * <p>
+ * The specialized resource home class should do the following when creating a
+ * resource:
+ * <ol>
+ * <li>create an object corresponding to the Schema type or element of the
+ * resource property set.</li>
+ * <li>initialize the object by calling its setters.</li>
+ * <li>construct the specialized ReflectionResource-based resource object.</li>
+ * <li>call initialize on the resource, passing it the implementation bean
+ *     created in 1).</li>
+ * </ol>
+ * <p>
+ * Reuse approach:
+ * <ul>
+ * <li>If no specialized behavior is required from the resource implementation,
+ *   there is no need for a specialized class. The Home class can just create
+ *   objects of type ReflectionResource.</li>
+ * <li>If specialized behavior is required from the resource
+ *   implementation, it is easy to reuse this class (via inheritance or
+ *   delegation) and thus achieve a clean separation of the specialized
+ *   code from the RP setup code.</li>
+ * </ul>
+ * <p>
+ * Typical goals when extending the class:
+ * <ul>
+ *       <li>to customize the resource property creation behavior for special
+ *         cases not handled by this class.</li>
+ *       <li>to add domain-specific behavior, public or not, to the
+ *         Resource objects.</li>
+ * </ul>
+ * Extending ReflectionResource:<p>
+ * Classes directly or indirectly extending ReflectionResource property must be
+ * allow instanciation without parameter. If a parameterless constructor is
+ * present it must not do any initialization whatsoever. The reason is to
+ * decouple object creation from initialization so as to match the requirements
+ * of Resource Home classes such as ResourceHomeImpl, which, when
+ * materializing a previously stored persistent resource, creates the resource
+ * object first using a parameterless constructor, and then initializes the
+ * object.
+ *
+ * Code that creates the key of the resource automatically (for instance
+ * a UUID) - in domain-specific cases where it makes sense - should not be
+ * put inside a parameterless constructor but in an a overriding version of the
+ * {@link #initialize(Object, QName, Object) initialize()} method, or inside
+ * the Resource Home class. In this way
+ * a Persistent Resource object can be brought back from a passivated state
+ * and be given the ID it used to have in activated mode, as opposed to a
+ * newly generated ID.
+ * <p>
+ * Known limitations:
+ * <ul>
+ *   <li>does not set the 'nillable' JavaBean property on the ResourceProperty
+ *     objects (Axis does not generate this metadatum).</li>
+ * </ul>
+ * <p>
+ * This class does not provide a getter to the implementation JavaBean, because
+ * it is good practice to access the value of a resource property
+ * by obtaining the {@link ResourceProperty ResourceProperty}
+ * object first, as opposed to calling the getters and setters of its
+ * implementation Bean.
+ * <p>
+ * In fact:
+ * <ul>
+ * <li>some resource properties are implemented using other objects
+ *    (for instance wsrl:CurrentTime is implemented via
+ *     {@link #getCurrentTime() getCurrentTime},
+ *     and the resource properties from wsnt:NotificationProducer are
+ *     implemented directly or indirectly by a
+ *     {@link SimpleTopicList SimpleTopicList}).
+ * </li>
+ * <li>the {@link ResourceProperty ResourceProperty} object generic accessors
+ *     may do extra processing such as firing change notification events
+ *     (for instance if it is a
+ *     {@link ResourcePropertyTopic ResourcePropertyTopic}).
+ * </li>
+ * </ul>
+ *
+ */
+public class ReflectionResource
+    implements Resource,
+               ResourceProperties,
+               ResourceIdentifier,
+               ResourceLifetime {
+
+    private static Log logger =
+        LogFactory.getLog(ReflectionResource.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private ResourcePropertySet resourcePropertySet;
+
+    private Object ID;
+
+    private Object resourceBean;
+
+    private Method setTerminationTimeMethod;
+    private Method getTerminationTimeMethod;
+
+    /**
+     * This should be called before any other resource property addition
+     * is made as it will create resource properties object based on the
+     * resource properties defined in the schema. It is possible to override
+     * the implementation of certain resources properties by adding a new
+     * ResourceProperty object to the resource property set after this method
+     * has been called.
+     *
+     * This method should be called in the constructor of the concrete
+     * resource class, or shortly after the parameterless constructor
+     * has been called.
+     *
+     * @param resourceBean Object An instance of the Axis-generated class
+     *                            corresponding to the resource property set
+     *                            global Schema type or element (with local
+     *                            type) used by the port type definition. That
+     *                            class has JavaBean properties matching all
+     *                            the resource properties of the port type.
+     *                            The ReflectionResource constructor creates the
+     *                            ResourceProperty objects based on the resource
+     *                            bean, which JavaBean properties SHOULD thus
+     *                            have been initialized beforehand. This object
+     *                            provides an easy way to initialize the values
+     *                            of the resource properties.<p>
+     * @param resourceElementQName  QName The QName of the resource properties
+     *                                    element used by the port type. This
+     *                                    corresponds to the value of the
+     *                                    'wsrp:ResourceProperties' attribute.
+     *                                    If the type of this element is
+     *                                    anonymous (i.e. inlined in the element
+     *                                    declaration) then this parameter is
+     *                                    optional. If it is non-null though,
+     *                                    its value takes precedence over
+     *                                    Axis-generated metadata.<p>
+
+     * @param key Object The resource key object for this resource. This is used
+     *                   to set the ID property of this object as a
+     *                   ResourceIdentifier, if the resource class doesn't
+     *                   create it automatically.<p>
+     */
+    public void initialize(Object resourceBean,
+                           QName resourceElementQName,
+                           Object key)
+        throws ResourceException {
+        if (key == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "key"));
+        }
+        this.ID = key;
+        if (logger.isDebugEnabled()) {
+            logger.debug("class of key passed to resource:" +
+                         key.getClass().getName());
+            logger.debug("class of implementation bean passed to resource:" +
+                         resourceBean.getClass().getName());
+        }
+        initializeResourceProperties(resourceBean, resourceElementQName);
+    }
+
+    private void initializeResourceProperties(Object resourceBean,
+                                              QName resourceElementQName)
+        throws ResourceException {
+
+        if (resourceBean == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "resourceBean"));
+        }
+
+        this.resourceBean = resourceBean;
+
+        Class resourceBeanClazz = resourceBean.getClass();
+
+        TypeDesc typeDesc = TypeDesc.getTypeDescForClass(resourceBeanClazz);
+        if (typeDesc == null) {
+            throw new ResourceException(i18n.getMessage("noTypeDesc",
+                                                        resourceBeanClazz));
+        }
+
+        //is type anonymous?
+        String localTypeName = typeDesc.getXmlType().getLocalPart();
+        if (localTypeName.startsWith(">")) {
+            String globalElementName = localTypeName.substring(1); //this
+            //is Axis-dependent of course...
+
+            if (resourceElementQName == null) {
+                resourceElementQName =
+                    new QName(typeDesc.getXmlType().getNamespaceURI(),
+                              globalElementName);
+            }
+
+        }
+        if (logger.isDebugEnabled()) {
+            logger.debug("QName of global element for resource properties is:" +
+                         resourceElementQName);
+        }
+
+        // get the resource properties
+        FieldDesc[] fields = typeDesc.getFields();
+
+        // Create resource properties per se
+        this.resourcePropertySet =
+            new SimpleResourcePropertySet(resourceElementQName);
+
+        ResourceProperty prop = null;
+
+        try {
+            for (int i=0; i<fields.length; i++) {
+                QName rpQName = fields[i].getXmlName();
+                if (logger.isDebugEnabled()) {
+                    logger.debug("creating new resource property \""
+                                +rpQName.toString() + "\"");
+                }
+                if (!(fields[i] instanceof ElementDesc)) {
+                    String errorMessage = i18n.getMessage(
+                      "rpNotElement", fields[i].getXmlType().getLocalPart());
+                    throw new ResourceException(errorMessage);
+                }
+                ElementDesc elementDesc = (ElementDesc)fields[i];
+                // assume nillable always false since no metadata for that
+                SimpleResourcePropertyMetaData metaData =
+                    new SimpleResourcePropertyMetaData(
+                                  rpQName,
+                                  elementDesc.getMinOccurs(),
+                                  elementDesc.getMaxOccurs(),
+                                  false,
+                                  Object.class,
+                                  false);
+                prop = createNewResourceProperty(metaData,
+                                                 this.resourceBean);
+                this.resourcePropertySet.add(prop);
+            }
+        } catch (ResourceException e) {
+            logger.error("", e);
+            throw e;
+        } catch (Exception e) {
+            logger.error("", e);
+            throw new ResourceException(
+                i18n.getMessage("resourceInitError"), e);
+        }
+
+    }
+
+    protected ResourceProperty createNewResourceProperty(QName rpQName,
+                                                         Object resourceBean)
+        throws Exception {
+        return createNewResourceProperty(
+                           new SimpleResourcePropertyMetaData(rpQName),
+                           resourceBean);
+    }
+
+    /**
+     * Override this callback method to specialize the implementation of the
+     * resource property value accessors on a per resource property basis.
+     * For instance, in the overriden version, do special processing if the
+     * QName of the property matches a special QName, or just call this base
+     * implementation otherwise.
+     * <p>
+     * The default behavior is to create a new
+     * {@link ReflectionResourceProperty ReflectionResourceProperty}
+     * constructed with the QName of the resource property and the
+     * resource implementation Bean used to construct this ReflectionResource
+     * object.
+     * <p>
+     * This function handles a few special cases:
+     * <ul>
+     * <li>If rpQName equals WSRFConstants.CURRENT_TIME, the resource property
+     * MUST use a dynamic implementation of getCurrentTime(), since time
+     * never stops changing. Therefore the resource bean callback used is not
+     * the initial resource Bean but the ReflectionResource object, which bears
+     * such an implementation of that function.</li>
+     * <li>If rpQName equals WSRFConstants.TERMINATION_TIME, the resource property
+     * created is set be nillable.</li>
+     * </ul>
+     *
+     * @param metaData Meta data associated with the resource property object
+     * @param resourceBean same as passed to constructor or initialize
+     */
+    protected ResourceProperty createNewResourceProperty(
+                                       ResourcePropertyMetaData metaData,
+                                       Object resourceBean)
+        throws Exception {
+        Object resourceBeanCallback = resourceBean; //default
+
+        QName rpQName = metaData.getName();
+
+        ReflectionResourceProperty prop = null;
+
+        if (rpQName.equals(WSRFConstants.TERMINATION_TIME)) {
+            prop = new ReflectionResourceProperty(
+                SimpleResourcePropertyMetaData.TERMINATION_TIME,
+                resourceBeanCallback);
+            this.setTerminationTimeMethod =
+                resourceBeanCallback.getClass().getMethod(
+                    "setTerminationTime", new Class[] {Calendar.class});
+            this.getTerminationTimeMethod =
+                resourceBeanCallback.getClass().getMethod(
+                    "getTerminationTime", null);
+        } else if (rpQName.equals(WSRFConstants.CURRENT_TIME)) {
+            prop = new ReflectionResourceProperty(
+                SimpleResourcePropertyMetaData.CURRENT_TIME, this);
+        } else {
+            prop = new ReflectionResourceProperty(rpQName,
+                                                  resourceBeanCallback);
+        }
+
+        return prop;
+    }
+
+    public void setTerminationTime(Calendar time) {
+        if (this.setTerminationTimeMethod != null) {
+            try {
+                this.setTerminationTimeMethod.invoke(this.getResourceBean(),
+                                                     new Object[] {time});
+            } catch (Exception e) {
+                logger.error("", e);
+                throw new RuntimeException(e.getMessage());
+            }
+        }
+    }
+
+    public Calendar getTerminationTime() {
+        if (this.getTerminationTimeMethod != null) {
+            try {
+                return (Calendar) this.getTerminationTimeMethod.invoke(
+                    this.getResourceBean(), null);
+            } catch (Exception e) {
+                logger.error("", e);
+                throw new RuntimeException(e.getMessage());
+            }
+        }
+        return null;
+    }
+
+    public Calendar getCurrentTime() {
+        return Calendar.getInstance();
+    }
+
+    /**
+     * See ResourceProperties.
+     *
+     * @return ResourcePropertySet
+     */
+    public ResourcePropertySet getResourcePropertySet() {
+        return this.resourcePropertySet;
+    }
+
+    /**
+     * See ResourceIdentifier.
+     *
+     * @return Object The key of the Resource. This is useful for instance when
+     * creating an endpoint reference that must be qualified with this resource.
+     */
+    public Object getID() {
+        return this.ID;
+    }
+
+    /**
+     * @return Object the Axis-generated Java Bean used as the main
+     *                implementation of the resource state.
+     */
+    public Object getResourceBean() {
+        return this.resourceBean;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ReflectionResourceProperty.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ReflectionResourceProperty.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ReflectionResourceProperty.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,741 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Arrays;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.w3c.dom.Element;
+
+import org.globus.wsrf.ResourcePropertyMetaData;
+import org.globus.wsrf.encoding.ObjectSerializer;
+import org.globus.wsrf.encoding.SerializationException;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+public class ReflectionResourceProperty extends BaseResourceProperty {
+
+    private static Log logger =
+        LogFactory.getLog(ReflectionResourceProperty.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private static final Object[] NULL_ARGS =
+        new Object[] {null};
+
+    private String propertyName;
+    private Object obj;
+    private Method getMethod;
+    private Method setMethod;
+
+    /**
+     * Used by subclasses only. Subclasses must call {@link #setObject(Object)
+     * setObject()} and {@link #setPropertyName(String) setPropertyName()}
+     * and {@link #initialize() initialize()} first.
+     */
+    protected ReflectionResourceProperty(ResourcePropertyMetaData metaData) {
+        super(metaData);
+    }
+
+    public ReflectionResourceProperty(ResourcePropertyMetaData metaData,
+                                      String propertyName,
+                                      Object obj)
+        throws Exception {
+        this(metaData);
+        setObject(obj);
+        setPropertyName(propertyName);
+        initialize();
+    }
+
+    public ReflectionResourceProperty(QName name,
+                                      String propertyName,
+                                      Object obj)
+        throws Exception {
+        this(new SimpleResourcePropertyMetaData(name),
+             propertyName,
+             obj);
+    }
+
+    public ReflectionResourceProperty(QName name, Object obj)
+        throws Exception {
+        this(new SimpleResourcePropertyMetaData(name),
+             name.getLocalPart(),
+             obj);
+    }
+
+    public ReflectionResourceProperty(ResourcePropertyMetaData metaData,
+                                      Object obj)
+        throws Exception {
+        this(metaData,
+             metaData.getName().getLocalPart(),
+             obj);
+    }
+
+    protected void setPropertyName(String propertyName) {
+        if (propertyName == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "propertyName"));
+        }
+        this.propertyName = propertyName;
+    }
+
+    protected void setObject(Object obj) {
+        if (obj == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "obj"));
+        }
+        this.obj = obj;
+    }
+
+    /**
+     * Must be called after object and propertyName have been set.
+     */
+    protected void initialize()
+        throws Exception {
+        if (this.obj == null || this.propertyName == null) {
+            throw new Exception(
+                i18n.getMessage("reflectionRPMembersNotInitialized"));
+        }
+
+      String methodPostfix = this.propertyName.substring(0, 1).toUpperCase()
+                           + this.propertyName.substring(1);
+        try {
+          this.getMethod =
+              this.obj.getClass().getMethod("get" + methodPostfix, null);
+          logger.debug("Found get method: " + this.getMethod);
+        } catch (NoSuchMethodException e) {
+            //this may be a boolean/Boolean JavaBean property
+            this.getMethod =
+                this.obj.getClass().getMethod("is" + methodPostfix, null);
+            logger.debug("Found is method: " + this.getMethod);
+        }
+
+        if (!this.metaData.isReadOnly()) {
+            try {
+                this.setMethod =
+                    this.obj.getClass().getMethod(
+                         "set" + methodPostfix,
+                         new Class [] {this.getMethod.getReturnType()});
+                logger.debug("Found set method: " + this.setMethod);
+            } catch (NoSuchMethodException e) {
+                // that's fine
+                logger.debug("Did not find set method");
+            }
+        }
+
+        Class type = null;
+
+        Class returnType = this.getMethod.getReturnType();
+        if (returnType.isArray()) {
+            type = returnType.getComponentType();
+        } else if (List.class.isAssignableFrom(returnType)) {
+            type = this.metaData.getType();
+        } else {
+            type = returnType;
+        }
+
+        // update meta data info
+        this.metaData =
+            new SimpleResourcePropertyMetaData(this.metaData.getName(),
+                                               this.metaData.getMinOccurs(),
+                                               this.metaData.getMaxOccurs(),
+                                               this.metaData.isNillable(),
+                                               type,
+                                               this.metaData.isReadOnly());
+    }
+
+    private RuntimeException handleException(Throwable e) {
+        logger.debug("", e);
+        if (e instanceof InvocationTargetException) {
+            e = ((InvocationTargetException)e).getTargetException();
+        }
+
+        if (e instanceof RuntimeException) {
+            return (RuntimeException)e;
+        } else {
+            return new RuntimeException(e.getMessage());
+        }
+    }
+
+    // ----------------- IMPL FUNCTIONS ------------------------
+
+    public int size() {
+        Class returnType = this.getMethod.getReturnType();
+        if (returnType.isArray()) {
+            return sizeArray();
+        } else if (List.class.isAssignableFrom(returnType)) {
+            return sizeList();
+        } else {
+            return sizeSimple();
+        }
+    }
+
+    public boolean isEmpty() {
+        Class returnType = this.getMethod.getReturnType();
+        if (returnType.isArray()) {
+            return isEmptyArray();
+        } else if (List.class.isAssignableFrom(returnType)) {
+            return isEmptyList();
+        } else {
+            return isEmptySimple();
+        }
+    }
+
+    public Iterator iterator() {
+        Class returnType = this.getMethod.getReturnType();
+        if (returnType.isArray()) {
+            return iteratorArray();
+        } else if (List.class.isAssignableFrom(returnType)) {
+            return iteratorList();
+        } else {
+            return iteratorSimple();
+        }
+    }
+
+    public Object get(int index) {
+        Class returnType = this.getMethod.getReturnType();
+        if (returnType.isArray()) {
+            return getArray(index);
+        } else if (List.class.isAssignableFrom(returnType)) {
+            return getList(index);
+        } else {
+            return getSimple(index);
+        }
+    }
+
+    public void set(int index, Object value) {
+        Class returnType = this.getMethod.getReturnType();
+        if (returnType.isArray()) {
+            setArray(index, value);
+        } else if (List.class.isAssignableFrom(returnType)) {
+            setList(index, value);
+        } else {
+            setSimple(index, value);
+        }
+    }
+
+    public void add(Object value) {
+        Class returnType = this.getMethod.getReturnType();
+        if (returnType.isArray()) {
+            addArray(value);
+        } else if (List.class.isAssignableFrom(returnType)) {
+            addList(value);
+        } else {
+            addSimple(value);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.globus.wsrf.ResourceProperty#remove(java.lang.Object)
+     */
+    public boolean remove(Object value) {
+        Class returnType = this.getMethod.getReturnType();
+        if (returnType.isArray()) {
+            return removeArray(value);
+        } else if (List.class.isAssignableFrom(returnType)) {
+            return removeList(value);
+        } else {
+            return removeSimple(value);
+        }
+    }
+
+    public void clear() {
+        Class returnType = this.getMethod.getReturnType();
+        if (returnType.isArray()) {
+            clearArray();
+        } else if (List.class.isAssignableFrom(returnType)) {
+            clearList();
+        } else {
+            clearSimple();
+        }
+    }
+
+    public SOAPElement[] toSOAPElements()
+        throws SerializationException {
+        Class returnType = this.getMethod.getReturnType();
+        if (returnType.isArray()) {
+            return toSOAPElementArray();
+        } else if (List.class.isAssignableFrom(returnType)) {
+            return toSOAPElementList();
+        } else {
+            return toSOAPElementSimple();
+        }
+    }
+
+    public Element[] toElements()
+        throws SerializationException {
+        Class returnType = this.getMethod.getReturnType();
+        if (returnType.isArray()) {
+            return toElementArray();
+        } else if (List.class.isAssignableFrom(returnType)) {
+            return toElementList();
+        } else {
+            return toElementSimple();
+        }
+    }
+
+    // ***************** Simple property methods ***************
+
+    protected Object getValueSimple() {
+        try {
+            return this.getMethod.invoke(this.obj, null);
+        } catch (Exception e) {
+            throw handleException(e);
+        }
+    }
+
+    private int sizeSimple() {
+        Object returnValue = getValueSimple();
+        return (returnValue == null) ? 0 : 1;
+    }
+
+    private boolean isEmptySimple() {
+        return (sizeSimple() == 0);
+    }
+
+    private Iterator iteratorSimple() {
+        List list = null;
+        Object returnValue = getValueSimple();
+        if (returnValue != null) {
+            list = new ArrayList(1);
+            list.add(returnValue);
+        } else {
+            list = new ArrayList(0);
+        }
+        return list.iterator();
+    }
+
+    private Object getSimple(int index) {
+        if (index != 0) {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
+        }
+        Object returnValue = getValueSimple();
+        return returnValue;
+    }
+
+    private void setSimple(int index, Object value) {
+        if (this.setMethod == null) {
+            throw new UnsupportedOperationException();
+        }
+        if (index != 0) {
+            throw new IndexOutOfBoundsException(String.valueOf(index));
+        }
+        value = convert(value);
+        try {
+            this.setMethod.invoke(this.obj, new Object[] {value});
+        } catch (Exception e) {
+            throw handleException(e);
+        }
+    }
+
+    private void clearSimple() {
+        if (this.setMethod == null) {
+            throw new UnsupportedOperationException();
+        }
+        if (!this.metaData.getType().isPrimitive()) {
+            try {
+                this.setMethod.invoke(this.obj, NULL_ARGS);
+            } catch (Exception e) {
+                throw handleException(e);
+            }
+        }
+    }
+
+    private void addSimple(Object value) {
+        Object returnValue = getValueSimple();
+        if (returnValue == null || this.metaData.getType().isPrimitive()) {
+            setSimple(0, value);
+        } else {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+    private boolean removeSimple(Object value) {
+        if (this.setMethod == null || this.metaData.getType().isPrimitive()) {
+            throw new UnsupportedOperationException();
+        }
+        Object currentObject = getValueSimple();
+        Object convertedValue = convert(value);
+        if (convertedValue.equals(currentObject)) {
+            try {
+                this.setMethod.invoke(this.obj, NULL_ARGS);
+            } catch (Exception e) {
+                throw handleException(e);
+            }
+            return true;
+        }
+        return false;
+    }
+
+    private SOAPElement[] toSOAPElementSimple()
+        throws SerializationException {
+        Object returnValue = getValueSimple();
+        SOAPElement [] elements = null;
+        boolean nillable = this.metaData.isNillable();
+        QName name = getMetaData().getName();
+        if (returnValue == null) {
+            if (nillable) {
+                elements = new SOAPElement[1];
+                elements[0] = ObjectSerializer.toSOAPElement(returnValue,
+                                                             name,
+                                                             nillable);
+            }
+        } else {
+            elements = new SOAPElement[1];
+            elements[0] = ObjectSerializer.toSOAPElement(returnValue,
+                                                         name,
+                                                         nillable);
+        }
+        return elements;
+    }
+
+    private Element[] toElementSimple()
+        throws SerializationException {
+        Object returnValue = getValueSimple();
+        Element [] elements = null;
+        boolean nillable = this.metaData.isNillable();
+        QName name = getMetaData().getName();
+        if (returnValue == null) {
+            if (nillable) {
+                elements = new Element[1];
+                elements[0] = ObjectSerializer.toElement(returnValue,
+                                                         name,
+                                                         nillable);
+            }
+        } else {
+            elements = new Element[1];
+            elements[0] = ObjectSerializer.toElement(returnValue,
+                                                     name,
+                                                     nillable);
+        }
+        return elements;
+    }
+
+    // ************* Array-based property methods *************
+
+    private Object getValueArray() {
+        try {
+            return this.getMethod.invoke(this.obj, null);
+        } catch (Exception e) {
+            throw handleException(e);
+        }
+    }
+
+    private int sizeArray() {
+        Object array = getValueArray();
+        return (array == null) ? 0 : Array.getLength(array);
+    }
+
+    private boolean isEmptyArray() {
+        return (sizeArray() == 0);
+    }
+
+    private Iterator iteratorArray() {
+        List list = null;
+        Object array = getValueArray();
+        if (array == null) {
+            list = new ArrayList(0);
+        } else {
+            list = Arrays.asList((Object[])array);
+        }
+        return list.iterator();
+    }
+
+    private Object getArray(int index) {
+        Object array = getValueArray();
+        return Array.get(array, index);
+    }
+
+    private void setArray(int index, Object value) {
+        Object array = getValueArray();
+        if (array == null) {
+            String errorMessage = "Value was not initialized.";
+            throw new NullPointerException(errorMessage);
+        }
+        Array.set(array, index, convert(value));
+    }
+
+    private void clearArray() {
+        if (this.setMethod == null) {
+            throw new UnsupportedOperationException();
+        }
+        try {
+            this.setMethod.invoke(this.obj, NULL_ARGS);
+        } catch (Exception e) {
+            throw handleException(e);
+        }
+    }
+
+    private void addArray(Object value) {
+        if (this.setMethod == null) {
+            throw new UnsupportedOperationException();
+        }
+        try {
+            Object array = this.getMethod.invoke(this.obj, null);
+            Class componentType =
+                this.getMethod.getReturnType().getComponentType();
+            Object newArray = null;
+            if (array == null) {
+                newArray = Array.newInstance(componentType, 1);
+                Array.set(newArray, 0, convert(value));
+            } else {
+                int len = Array.getLength(array);
+                newArray = Array.newInstance(componentType, len + 1);
+                System.arraycopy(array, 0, newArray, 0, len);
+                Array.set(newArray, len, convert(value));
+            }
+            this.setMethod.invoke(this.obj, new Object[] {newArray});
+        } catch (Exception e) {
+            throw handleException(e);
+        }
+    }
+
+    private boolean removeArray(Object value) {
+        Object array = getValueArray();
+        if (array == null) {
+            return false;
+        }
+        Object convertedValue = convert(value);
+
+        int len = Array.getLength(array);
+        int j = 0;
+        Object currValue = null;
+        for (int i = 0; i < len; i++) {
+            currValue = Array.get(array, i);
+            if (!currValue.equals(convertedValue)) {
+                if (j != i) {
+                    Array.set(array, j, currValue);
+                }
+                j++;
+            }
+        }
+
+        if (j != len) {
+            Object newArray = null;
+            if (j > 0) {
+                Class componentType =
+                    this.getMethod.getReturnType().getComponentType();
+                newArray = Array.newInstance(componentType, j);
+                System.arraycopy(array, 0, newArray, 0, j);
+            }
+            try {
+                this.setMethod.invoke(this.obj, new Object[] {newArray});
+            } catch (Exception e) {
+                throw handleException(e);
+            }
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private SOAPElement[] toSOAPElementArray()
+        throws SerializationException {
+        Object array = getValueArray();
+        SOAPElement [] elements = null;
+        boolean nillable = this.metaData.isNillable();
+        QName name = getMetaData().getName();
+        if (array == null || Array.getLength(array) == 0) {
+            if (nillable) {
+                elements = new SOAPElement[1];
+                elements[0] = ObjectSerializer.toSOAPElement(null,
+                                                             name,
+                                                             nillable);
+            }
+        } else {
+            int len = Array.getLength(array);
+            Object value = null;
+            elements = new SOAPElement[len];
+            for (int i=0;i<len;i++) {
+                value = Array.get(array, i);
+                elements[i] = ObjectSerializer.toSOAPElement(value,
+                                                             name,
+                                                             nillable);
+            }
+        }
+        return elements;
+    }
+
+    private Element[] toElementArray()
+        throws SerializationException {
+        Object array = getValueArray();
+        Element [] elements = null;
+        boolean nillable = this.metaData.isNillable();
+        QName name = getMetaData().getName();
+        if (array == null || Array.getLength(array) == 0) {
+            if (nillable) {
+                elements = new Element[1];
+                elements[0] = ObjectSerializer.toElement(null,
+                                                         name,
+                                                         nillable);
+            }
+        } else {
+            int len = Array.getLength(array);
+            Object value = null;
+            elements = new Element[len];
+            for (int i=0;i<len;i++) {
+                value = Array.get(array, i);
+                elements[i] = ObjectSerializer.toElement(value,
+                                                         name,
+                                                         nillable);
+            }
+        }
+        return elements;
+    }
+
+    // ************** List-based property methods ***************
+
+    private List getValueList() {
+        try {
+            return (List)this.getMethod.invoke(this.obj, null);
+        } catch (Exception e) {
+            throw handleException(e);
+        }
+    }
+
+    private int sizeList() {
+        List returnValue = getValueList();
+        return (returnValue == null) ? 0 : returnValue.size();
+    }
+
+    private boolean isEmptyList() {
+        return (sizeList() == 0);
+    }
+
+    private Iterator iteratorList() {
+        List list = null;
+        List returnValue = getValueList();
+        if (returnValue == null) {
+            list = new ArrayList(0);
+        } else {
+            list = returnValue;
+        }
+        return list.iterator();
+    }
+
+    private Object getList(int index) {
+        List returnValue =  getValueList();
+        return returnValue.get(index);
+    }
+
+    private void setList(int index, Object value) {
+        List returnValue = getValueList();
+        returnValue.set(index, convert(value));
+    }
+
+    private void clearList() {
+        List returnValue = getValueList();
+        returnValue.clear();
+    }
+
+    private void addList(Object value) {
+        List returnValue = getValueList();
+        if (returnValue == null) {
+            if (this.setMethod == null) {
+                throw new UnsupportedOperationException();
+            }
+            try {
+                returnValue =
+                    (List)this.getMethod.getReturnType().newInstance();
+            } catch (Exception e) {
+                throw handleException(e);
+            }
+            returnValue.add(convert(value));
+            try {
+                this.setMethod.invoke(this.obj, new Object[] {returnValue});
+            } catch (Exception e) {
+                throw handleException(e);
+            }
+        } else {
+            returnValue.add(convert(value));
+        }
+    }
+
+    private boolean removeList(Object value) {
+        List returnValue = getValueList();
+        boolean result;
+        if(returnValue == null) {
+            result = false;
+        } else {
+            result = returnValue.remove(convert(value));
+        }
+        return result;
+    }
+
+    private SOAPElement[] toSOAPElementList()
+        throws SerializationException {
+        List returnValue = getValueList();
+        SOAPElement [] elements = null;
+        boolean nillable = this.metaData.isNillable();
+        QName name = getMetaData().getName();
+        if (returnValue == null || returnValue.size() == 0) {
+            if (nillable) {
+                elements = new SOAPElement[1];
+                elements[0] = ObjectSerializer.toSOAPElement(returnValue,
+                                                             name,
+                                                             nillable);
+            }
+        } else {
+            elements = new SOAPElement[returnValue.size()];
+            Iterator iter = returnValue.iterator();
+            int i = 0;
+            while(iter.hasNext()) {
+                elements[i++] = ObjectSerializer.toSOAPElement(iter.next(),
+                                                               name,
+                                                               nillable);
+            }
+        }
+        return elements;
+    }
+
+    private Element[] toElementList()
+        throws SerializationException {
+        List returnValue = getValueList();
+        Element [] elements = null;
+        boolean nillable = this.metaData.isNillable();
+        QName name = getMetaData().getName();
+        if (returnValue == null || returnValue.size() == 0) {
+            if (nillable) {
+                elements = new Element[1];
+                elements[0] = ObjectSerializer.toElement(returnValue,
+                                                         name,
+                                                         nillable);
+            }
+        } else {
+            elements = new Element[returnValue.size()];
+            Iterator iter = returnValue.iterator();
+            int i = 0;
+            while(iter.hasNext()) {
+                elements[i++] = ObjectSerializer.toElement(iter.next(),
+                                                           name,
+                                                           nillable);
+            }
+        }
+        return elements;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourceContextImpl.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourceContextImpl.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourceContextImpl.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,307 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.util.Iterator;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.MessageContext;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.NoResourceHomeException;
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.ResourceContextException;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.ResourceHome;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.utils.Resources;
+
+public class ResourceContextImpl extends ResourceContext {
+
+    private static Log logger =
+        LogFactory.getLog(ResourceContextImpl.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private SOAPMessageContext context = null;
+    private SOAPMessage message = null;
+
+    private ResourceHome home = null;
+    private String homeLocation = null;
+    private String service = null;
+    private URL serviceURL = null;
+
+    public ResourceContextImpl() {
+        this(org.apache.axis.MessageContext.getCurrentContext());
+    }
+
+    public ResourceContextImpl(SOAPMessageContext ctx) {
+        if (ctx == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "ctx"));
+        }
+        this.context = ctx;
+        this.message = ctx.getMessage();
+    }
+
+    public ResourceContextImpl(SOAPMessageContext ctx,
+                               SOAPMessage msg) {
+        if (ctx == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "ctx"));
+        }
+        this.context = ctx;
+        this.message = msg;
+    }
+
+    public ResourceKey getResourceKey()
+        throws ResourceContextException {
+        ResourceHome home = getResourceHome();
+        return getResourceKey(home.getKeyTypeName(),
+                              home.getKeyTypeClass());
+    }
+
+    public ResourceKey getResourceKey(QName keyName, Class keyClass)
+        throws ResourceContextException {
+        if (keyName == null) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("resource key name is null");
+            }
+            return null;
+        }
+        SOAPHeaderElement headerElement = getResourceKeyHeader(keyName);
+        if (headerElement == null) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("resource key header is null");
+            }
+            return null;
+        }
+        try {
+            return new SimpleResourceKey(headerElement, keyClass);
+        } catch (Exception e) {
+            throw new ResourceContextException("", e);
+        }
+    }
+
+    public synchronized ResourceHome getResourceHome()
+        throws NoResourceHomeException, ResourceContextException {
+        if (this.home == null) {
+            String homeLoc = getResourceHomeLocation();
+            try {
+                Context initialContext = new InitialContext();
+                this.home = (ResourceHome) initialContext.lookup(homeLoc);
+            } catch (NameNotFoundException e) {
+                throw new NoResourceHomeException();
+            } catch (NamingException e) {
+                throw new ResourceContextException("", e);
+            }
+        }
+        return this.home;
+    }
+
+    public synchronized String getResourceHomeLocation() {
+        if (this.homeLocation == null) {
+            this.homeLocation = Constants.JNDI_SERVICES_BASE_NAME +
+                getService() + Constants.HOME_NAME;
+        }
+        return this.homeLocation;
+    }
+
+    public SOAPHeaderElement getResourceKeyHeader()
+        throws ResourceContextException {
+        ResourceHome home = getResourceHome();
+        QName keyName = home.getKeyTypeName();
+        return (keyName == null) ? null : getResourceKeyHeader(keyName);
+    }
+
+    public SOAPHeaderElement getResourceKeyHeader(QName keyName)
+        throws ResourceContextException {
+        try {
+            return ResourceContextImpl.getResourceKeyHeader(this.message,
+                                                            keyName,
+                                                            null);
+        } catch (SOAPException e) {
+            throw new ResourceContextException("", e);
+        }
+    }
+
+    public Resource getResource()
+        throws ResourceContextException, ResourceException {
+        ResourceHome home = getResourceHome();
+        ResourceKey key = getResourceKey(home.getKeyTypeName(),
+                                         home.getKeyTypeClass());
+        if (logger.isDebugEnabled()) {
+            logger.debug("resource key: " + key);
+        }
+
+        Resource resource = home.find(key);
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("Found resource: " + resource);
+        }
+
+        return resource;
+    }
+
+    /**
+     * Sets the target service of this context.
+     *
+     * @param service service name.
+     */
+    public void setService(String service) {
+        this.service = service;
+        // reset in case
+        synchronized(this) {
+            this.home = null;
+            this.homeLocation = null;
+        }
+    }
+
+    /**
+     * Returns target service associated with this context.
+     * @return the target service that was set with
+     *         {@link #setService(String) setService()}. If set to
+     *         <code>null</code> or not set at all, by default it returns the
+     *         target service associated with the underlying SOAP message
+     *         context.
+     */
+    public String getService() {
+        return (this.service == null) ?
+               getService(this.context) : this.service;
+    }
+
+    public URL getServiceURL() {
+        return (this.serviceURL == null) ?
+               getServiceURL(this.context) : this.serviceURL;
+    }
+
+    public boolean containsProperty(String name) {
+        return this.context.containsProperty(name);
+    }
+
+    public Object getProperty(String name) {
+        return this.context.getProperty(name);
+    }
+
+    public void removeProperty(String name) {
+        this.context.removeProperty(name);
+    }
+
+    public void setProperty(String name, Object value) {
+        this.context.setProperty(name, value);
+    }
+
+    public Iterator getPropertyNames() {
+        return this.context.getPropertyNames();
+    }
+
+    public static SOAPHeaderElement getResourceKeyHeader(SOAPMessage msg,
+                                                         QName keyName,
+                                                         String actorURI)
+        throws SOAPException {
+        if (msg == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "msg"));
+        }
+        if (keyName == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "keyName"));
+        }
+
+        SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
+        SOAPHeader header = env.getHeader();
+
+        if (header == null) {
+            return null;
+        }
+
+        Iterator iter = header.examineHeaderElements(actorURI);
+        while(iter.hasNext()) {
+            SOAPHeaderElement hE = (SOAPHeaderElement)iter.next();
+            Name nm = hE.getElementName();
+
+            if (nm.getLocalName().equals(keyName.getLocalPart()) &&
+                nm.getURI().equals(keyName.getNamespaceURI())) {
+                // found my header element;
+                return hE;
+            }
+        }
+
+        return null;
+    }
+
+    public static String getService(SOAPMessageContext ctx) {
+        if (ctx == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "ctx"));
+        }
+        if (!(ctx instanceof org.apache.axis.MessageContext)) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("contextNotMessageContext","ctx"));
+        }
+
+        org.apache.axis.MessageContext msgCtx =
+            (org.apache.axis.MessageContext)ctx;
+
+        return msgCtx.getTargetService();
+    }
+
+    public static URL getServiceURL(SOAPMessageContext ctx)
+    {
+        if (ctx == null) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "ctx"));
+        }
+        if (!(ctx instanceof org.apache.axis.MessageContext)) {
+            throw new IllegalArgumentException(
+                i18n.getMessage("contextNotMessageContext","ctx"));
+        }
+
+        org.apache.axis.MessageContext msgCtx =
+            (org.apache.axis.MessageContext)ctx;
+        URL serviceURL = null;
+
+        try
+        {
+            serviceURL = new URL(
+                (String) msgCtx.getProperty(MessageContext.TRANS_URL));
+        }
+        catch(MalformedURLException e)
+        {
+            logger.error("", e);
+        }
+        return serviceURL;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourceHomeImpl.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourceHomeImpl.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourceHomeImpl.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,400 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.collections.map.ReferenceMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.InvalidResourceKeyException;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.PersistenceCallback;
+import org.globus.wsrf.RemoveCallback;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.ResourceHome;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.ResourceLifetime;
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.container.Lock;
+import org.globus.wsrf.container.LockManager;
+import org.globus.wsrf.impl.lifetime.SetTerminationTimeProvider;
+import org.globus.wsrf.jndi.Initializable;
+import org.globus.wsrf.jndi.JNDIUtils;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.utils.cache.Cache;
+import commonj.timers.Timer;
+import commonj.timers.TimerManager;
+
+/**
+ * An implementation of the <code>ResourceHome</code> interface.
+ * This implementation was designed to work with resources that implement
+ * the {@link PersistenceCallback PersistenceCallback} interface as well as 
+ * memory resident resources. If the resource class implements the
+ * {@link PersistenceCallback PersistenceCallback} interface
+ * <code>SoftReference</code>s will be used to recycle resource
+ * objects. The resource class implementation is responsible for saving its
+ * state to disk. This implementation will <b>not</b> call
+ * {@link PersistenceCallback#store() PersistenceCallback.store()}. The 
+ * resource implementation must have a default constructor.
+ * <br><br>
+ * Configuration options:
+ * <ul>
+ * <li>
+ * sweeperDelay - configures how often the resource sweeper runs in msec.
+ * By default the resource sweeper runs every minute. For example:
+ * <pre>
+ *    &lt;parameter&gt;
+ *     &lt;name&gt;sweeperDelay&lt;/name&gt;
+ *     &lt;value&gt;60000&lt;/value&gt;
+ *    &lt;/parameter&gt;
+ * </pre>
+ * <li>
+ * resourceClass - configures the name of the resource class. For example:
+ * <pre>
+ *    &lt;parameter&gt;
+ *     &lt;name&gt;resourceClass&lt;/name&gt;
+ *     &lt;value&gt;org.globus.wsrf.samples.counter.PersistentCounter&lt;/value&gt;
+ *    &lt;/parameter&gt;
+ * </pre>
+ * <li>
+ * resourceKeyType - configures the key type class. By default
+ * <code>java.lang.String</code> is used. For example:
+ * <pre>
+ *    &lt;parameter&gt;
+ *     &lt;name&gt;resourceKeyType&lt;/name&gt;
+ *     &lt;value&gt;java.lang.Integer&lt;/value&gt;
+ *    &lt;/parameter&gt;
+ * </pre>
+ * <li>
+ * resourceKeyName - configures the key name. For example:
+ * <pre>
+ *    &lt;parameter&gt;
+ *     &lt;name&gt;resourceKeyName&lt;/name&gt;
+ *     &lt;value&gt;{http://counter.com}CounterKey&lt;/value&gt;
+ *    &lt;/parameter&gt;
+ * </pre>
+ * </ul>
+ * <br>
+ * <b>Note:</b> Must be deployed with
+ * <code>org.globus.wsrf.jndi.BeanFactory</code> in JNDI or user must
+ * first call {@link #initialize() initialize()} method. Also when overriding
+ * the {@link #initialize() initialize()} method make sure to call
+ * <code>super.initialize();</code>.
+ */
+public abstract class ResourceHomeImpl
+    implements ResourceHome,
+               Initializable {
+
+    private static Log logger =
+            LogFactory.getLog(ResourceHomeImpl.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    protected Map resources;
+
+    protected QName keyTypeName;
+    protected Class resourceClass;
+    protected Class keyTypeClass;
+    private boolean resourceIsPersistent = false;
+
+    protected LockManager lockManager;
+
+    private String cacheLocation;
+    private Cache cache;
+
+    private long sweeperDelay = 60000;
+    private Sweeper sweeper;
+
+    private boolean initialized = false;
+
+    public void setResourceClass(String clazz)
+        throws ClassNotFoundException {
+        this.resourceClass = Class.forName(clazz);
+    }
+
+    public String getResourceClass() {
+        return this.resourceClass.getName();
+    }
+
+    public void setResourceKeyType(String clazz)
+        throws ClassNotFoundException {
+        this.keyTypeClass = Class.forName(clazz);
+    }
+
+    public Class getKeyTypeClass() {
+        return this.keyTypeClass;
+    }
+
+    public void setResourceKeyName(String keyName) {
+        this.keyTypeName = QName.valueOf(keyName);
+    }
+
+    public QName getKeyTypeName() {
+        return this.keyTypeName;
+    }
+
+    public void setSweeperDelay(long delay) {
+        this.sweeperDelay = delay;
+    }
+
+    public long getSweeperDelay() {
+        return this.sweeperDelay;
+    }
+
+    public void setCacheLocation(String jndiLocation) {
+        this.cacheLocation = jndiLocation;
+    }
+
+    public String getCacheLocation() {
+        return this.cacheLocation;
+    }
+
+    public synchronized void initialize() throws Exception {
+        if (this.initialized) {
+            return;
+        }
+        if (this.keyTypeClass == null) {
+            this.keyTypeClass = String.class;
+        }
+        if (this.keyTypeName == null) {
+            throw new Exception(i18n.getMessage("resourceKeyConfigError"));
+        }
+        if (this.resourceClass == null) {
+            throw new Exception(i18n.getMessage("resourceClassConfigError"));
+        }
+        if (!Resource.class.isAssignableFrom(this.resourceClass)) {
+            throw new Exception(i18n.getMessage("invalidResourceType", 
+                                                this.resourceClass.getName()));
+        }
+        if (PersistenceCallback.class.isAssignableFrom(this.resourceClass)) {
+            this.resourceIsPersistent = true;
+        }
+
+        Context initialContext = new InitialContext();
+        TimerManager timerManager =
+            (TimerManager)initialContext.lookup(Constants.DEFAULT_TIMER);
+
+        if (this.resourceIsPersistent) {
+            this.resources = new ReferenceMap(ReferenceMap.HARD,
+                                              ReferenceMap.SOFT,
+                                              true);
+
+            // initialize cache policy
+            if (this.cacheLocation != null) {
+                this.cache =
+                    (Cache)JNDIUtils.lookup(initialContext,
+                                            this.cacheLocation,
+                                            Cache.class);
+            }
+        } else {
+            this.resources = new HashMap();
+        }
+
+        this.resources = Collections.synchronizedMap(this.resources);
+
+        this.lockManager = new LockManager();
+
+        if (ResourceLifetime.class.isAssignableFrom(this.resourceClass)) {
+            this.sweeper = new Sweeper(this,
+                                       this.resources,
+                                       timerManager,
+                                       this.sweeperDelay);
+        }
+
+        // nothing to do for now
+        this.initialized = true;
+    }
+
+    protected Resource createNewInstance()
+        throws ResourceException {
+        try {
+            return (Resource)this.resourceClass.newInstance();
+        } catch (Exception e) {
+            throw new ResourceException("", e);
+        }
+    }
+
+    protected Resource createNewInstanceAndLoad(ResourceKey key)
+        throws ResourceException {
+        Resource resource = createNewInstance();
+        ((PersistenceCallback)resource).load(key);
+        return resource;
+    }
+
+    public Resource find(ResourceKey key)
+        throws ResourceException {
+        if (key == null) {
+            throw new InvalidResourceKeyException(
+                i18n.getMessage("nullArgument", "key"));
+        }
+
+        Resource resource = null;
+
+        Lock lock = this.lockManager.getLock(key);
+        try {
+            lock.acquire();
+        } catch (InterruptedException e) {
+            throw new ResourceException(e);
+        }
+        try {
+            resource = get(key);
+            if (this.cache != null) {
+                this.cache.update(resource);
+            }
+        } finally {
+            lock.release();
+        }
+        return resource;
+    }
+
+    private Resource get(ResourceKey key)
+        throws ResourceException {
+        Resource resource = (Resource)this.resources.get(key);
+        if (resource == null) {
+            if (this.resourceIsPersistent) {
+                resource = createNewInstanceAndLoad(key);
+                // add it to the map
+                addResource(key, resource);
+                // check the termination time of the service
+                if (ResourceSweeper.isExpired(resource)) {
+                    // if resource is expired then remove it explicitely
+                    remove(key);
+                    // throw exception
+                    throw new NoSuchResourceException();
+                }
+            } else {
+                throw new NoSuchResourceException();
+            }
+        }
+        return resource;
+    }
+
+    public void remove(ResourceKey key)
+        throws ResourceException {
+        if (key == null) {
+            throw new InvalidResourceKeyException(
+                i18n.getMessage("nullArgument", "key"));
+        }
+
+        Resource resource = null;
+
+        Lock lock = this.lockManager.getLock(key);
+        try {
+            lock.acquire();
+        } catch (InterruptedException e) {
+            throw new ResourceException(e);
+        }
+        try {
+            resource = get(key);
+            if (resource instanceof RemoveCallback) {
+                ((RemoveCallback)resource).remove();
+            }
+            this.resources.remove(key);
+            if (this.cache != null) {
+                this.cache.remove(resource);
+            }
+        } finally {
+            lock.release();
+        }
+        Calendar currentTime = Calendar.getInstance();
+        SetTerminationTimeProvider.sendTerminationNotification(resource,
+                                                               currentTime);
+    }
+
+    protected void add(ResourceKey key, Resource resource) {
+        Lock lock = this.lockManager.getLock(key);
+        try {
+            lock.acquire();
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e.getMessage());
+        }
+        try {
+            addResource(key, resource);
+            if (this.cache != null) {
+                this.cache.update(resource);
+            }
+        } finally {
+            lock.release();
+        }
+    }
+
+    private void addResource(ResourceKey key, Resource resource) {
+        this.resources.put(key, resource);
+        // schedule sweeper task if needed
+        if (this.sweeper != null) {
+            this.sweeper.scheduleSweeper();
+        }
+    }
+
+    /**
+     * This ResourceSweeper implementation just returns the resources
+     * currently stored in the map. The reason is that the sweeper
+     * doesn't have to reactivate/reload a persistent resource if the
+     * resource object was reclaimed. So lifetime checks are not
+     * done on reclained resources. Lifetime checks have to be done
+     * on resource load.
+     */
+    private static class Sweeper extends ResourceSweeper {
+
+        private TimerManager timerManager;
+        private Timer timer;
+        private long delay;
+
+        public Sweeper(ResourceHome home, Map resources,
+                       TimerManager timerManager, long delay) {
+            super(home, resources);
+            this.timerManager = timerManager;
+            this.delay = delay;
+        }
+
+        private synchronized void resetSweeper() {
+            this.timer = null;
+        }
+
+        synchronized void scheduleSweeper() {
+            if (this.timer == null) {
+                this.timer = this.timerManager.schedule(this, this.delay);
+                this.logger.debug("scheduling sweeper");
+            }
+        }
+
+        protected Resource getResource(ResourceKey key)
+            throws ResourceException {
+            return (Resource)this.resources.get(key);
+        }
+
+        public void timerExpired(Timer timer) {
+            super.timerExpired(timer);
+            resetSweeper();
+            if (!this.resources.isEmpty()) {
+                scheduleSweeper();
+            }
+        }
+
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourcePropertyTopic.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourcePropertyTopic.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourcePropertyTopic.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,376 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.w3c.dom.Element;
+
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.Topic;
+import org.globus.wsrf.TopicListener;
+import org.globus.wsrf.ResourcePropertyMetaData;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.utils.AnyHelper;
+import org.globus.wsrf.encoding.SerializationException;
+import org.globus.wsrf.core.notification.ResourcePropertyValueChangeNotificationElementType;
+import org.globus.util.I18n;
+
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsrf.properties.ResourcePropertyValueChangeNotificationType;
+import org.oasis.wsrf.properties.ResourcePropertyValueChangeNotificationTypeNewValue;
+import org.oasis.wsrf.properties.ResourcePropertyValueChangeNotificationTypeOldValue;
+
+/**
+ * This class can be used to expose arbitrary ResourceProperty as a Topic.
+ */
+public class ResourcePropertyTopic implements ResourceProperty, Topic
+{
+    private static Log logger =
+        LogFactory.getLog(ResourcePropertyTopic.class.getName());
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+    private ResourceProperty rp;
+    protected Topic topic;
+    //TODO: might be safer to default to false
+    protected boolean autoNotify = true;
+    protected boolean sendOldValue = false;
+
+    /**
+     * Construct a new ResourcePropertyTopic
+     *
+     * @param rp    A ResourceProperty object.
+     * @param qname A name of the topic.
+     */
+    public ResourcePropertyTopic(ResourceProperty rp, QName qname)
+    {
+        if(rp == null)
+        {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "rp"));
+        }
+        if(qname == null)
+        {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "qname"));
+        }
+        this.rp = rp;
+        this.topic = new SimpleTopic(qname);
+    }
+
+    /**
+     * Construct a new ResourcePropertyTopic. The topic name is the name of the
+     * ResourceProperty.
+     *
+     * @param rp A ResourceProperty object.
+     */
+    public ResourcePropertyTopic(ResourceProperty rp)
+    {
+        if(rp == null)
+        {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "rp"));
+        }
+        this.rp = rp;
+        this.topic = new SimpleTopic(this.rp.getMetaData().getName());
+    }
+
+    /**
+     * Get the resource property associated with this topic
+     *
+     * @return The resource property
+     */
+    public ResourceProperty getResourceProperty()
+    {
+        return this.rp;
+    }
+
+    public QName getName()
+    {
+        return this.topic.getName();
+    }
+
+    public void addTopic(Topic topic) throws Exception
+    {
+        this.topic.addTopic(topic);
+    }
+
+    public void addTopicListener(TopicListener listener)
+    {
+        this.topic.addTopicListener(listener);
+    }
+
+    public Object getCurrentMessage()
+    {
+        return this.topic.getCurrentMessage();
+    }
+
+    public Topic getTopic(QName topicName)
+    {
+        return this.topic.getTopic(topicName);
+    }
+
+    public List getTopicPath()
+    {
+        return this.topic.getTopicPath();
+    }
+
+    public TopicExpressionType getTopicReference()
+    {
+        return this.topic.getTopicReference();
+    }
+
+    public boolean isReference()
+    {
+        return this.topic.isReference();
+    }
+
+    public Iterator topicIterator()
+    {
+        return this.topic.topicIterator();
+    }
+
+    public void notify(Object obj) throws Exception
+    {
+        ResourcePropertyValueChangeNotificationElementType message =
+            this.createValueChangeMessage(false);
+        //TODO: Ignoring parameter in this case
+        this.setNewValue(message);
+        this.topic.notify(message);
+    }
+
+    public void removeTopic(Topic topic)
+    {
+        this.topic.removeTopic(topic);
+    }
+
+    public void removeTopicListener(TopicListener listener)
+    {
+        this.topic.removeTopicListener(listener);
+    }
+
+    public Iterator topicListenerIterator()
+    {
+        return this.topic.topicListenerIterator();
+    }
+
+    public void setTopicPath(List topicPath)
+    {
+        this.topic.setTopicPath(topicPath);
+    }
+
+    public void setTopicReference(TopicExpressionType topicPath)
+    {
+        this.topic.setTopicReference(topicPath);
+    }
+
+    /**
+     * @return Returns the auto notify setting.
+     */
+    public boolean autoNotify()
+    {
+        return this.autoNotify;
+    }
+
+    /**
+     * @param autoNotify The autoNotify to set.
+     */
+    public void setAutoNotify(boolean autoNotify)
+    {
+        this.autoNotify = autoNotify;
+    }
+
+    protected void fireNotification(
+        ResourcePropertyValueChangeNotificationElementType message)
+    {
+        if(this.autoNotify)
+        {
+            try
+            {
+                this.topic.notify(message);
+            }
+            catch(Exception e)
+            {
+                logger.error(i18n.getMessage(
+                    "nodeliver", message), e);
+                // TODO: I think these methods need to be allowed to throw exceptions
+            }
+        }
+    }
+
+    // delegated calls
+
+    public void add(Object value)
+    {
+        ResourcePropertyValueChangeNotificationElementType message =
+            createValueChangeMessage(this.sendOldValue);
+        this.rp.add(value);
+        setNewValue(message);
+        fireNotification(message);
+    }
+
+    public void set(int index, Object value)
+    {
+        ResourcePropertyValueChangeNotificationElementType message =
+            createValueChangeMessage(this.sendOldValue);
+        this.rp.set(index, value);
+        setNewValue(message);
+        fireNotification(message);
+    }
+
+    public boolean remove(Object value)
+    {
+        ResourcePropertyValueChangeNotificationElementType message =
+            createValueChangeMessage(this.sendOldValue);
+        boolean rs = this.rp.remove(value);
+        if(rs)
+        {
+            setNewValue(message);
+            fireNotification(message);
+        }
+        return rs;
+    }
+
+    public Object get(int index)
+    {
+        return this.rp.get(index);
+    }
+
+    public void clear()
+    {
+        this.rp.clear();
+    }
+
+    public int size()
+    {
+        return this.rp.size();
+    }
+
+    public boolean isEmpty() 
+    {
+        return this.rp.isEmpty();
+    }
+
+    public Iterator iterator()
+    {
+        return this.rp.iterator();
+    }
+
+    public ResourcePropertyMetaData getMetaData() 
+    { 
+        return rp.getMetaData(); 
+    }
+
+    public SOAPElement[] toSOAPElements()
+        throws SerializationException
+    {
+        return this.rp.toSOAPElements();
+    }
+
+    public Element[] toElements()
+        throws SerializationException
+    {
+        return this.rp.toElements();
+    }
+
+    /**
+     * Determine whether notifications send the old resource property value as
+     * well as the new value. This setting defaults to only sending the new
+     * value.
+     *
+     * @return The setting
+     */
+    public boolean getSendOldValue()
+    {
+        return sendOldValue;
+    }
+
+    /**
+     * Set the "send old value" behavior. This setting determines if
+     * notifications include the old as well as the new value of the resource
+     * property.
+     *
+     * @param sendOldValue If true the old value will be sent, if false
+     *                     (default) only the new value will be sent.
+     */
+    public void setSendOldValue(boolean sendOldValue)
+    {
+        this.sendOldValue = sendOldValue;
+    }
+
+    private void setNewValue(
+        ResourcePropertyValueChangeNotificationElementType message)
+    {
+        ResourcePropertyValueChangeNotificationTypeNewValue newValue =
+            new ResourcePropertyValueChangeNotificationTypeNewValue();
+
+        if(this.rp.size() != 0)
+        {
+            try
+            {
+                AnyHelper.setAny(newValue, this.rp.toSOAPElements());
+            }
+            catch(Exception e)
+            {
+                logger.error(
+                    i18n.getMessage("rpSerializationError",
+                                    this.rp.getMetaData().getName()), e);
+                // TODO: I think these methods need to be allowed to throw exceptions
+            }
+        }
+        message.getResourcePropertyValueChangeNotification().setNewValue(
+            newValue);
+    }
+
+    private ResourcePropertyValueChangeNotificationElementType
+        createValueChangeMessage(boolean sendOld)
+    {
+        ResourcePropertyValueChangeNotificationElementType changeMessage =
+            new ResourcePropertyValueChangeNotificationElementType();
+        ResourcePropertyValueChangeNotificationType message =
+            new ResourcePropertyValueChangeNotificationType();
+        changeMessage.setResourcePropertyValueChangeNotification(message);
+
+        if(sendOld == true)
+        {
+            ResourcePropertyValueChangeNotificationTypeOldValue oldValue =
+                new ResourcePropertyValueChangeNotificationTypeOldValue();
+
+            if(this.rp.size() != 0)
+            {
+                try
+                {
+                    AnyHelper.setAny(oldValue, this.rp.toSOAPElements());
+                }
+                catch(Exception e)
+                {
+                    logger.error(
+                        i18n.getMessage("rpSerializationError",
+                                        this.rp.getMetaData().getName()), e);
+                    // TODO: I think these methods need to be allowed to throw exceptions
+                }
+            }
+            message.setOldValue(oldValue);
+        }
+        return changeMessage;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourceSweeper.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourceSweeper.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ResourceSweeper.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,112 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.ResourceHome;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.ResourceLifetime;
+
+import commonj.timers.Timer;
+import commonj.timers.TimerListener;
+
+public class ResourceSweeper implements TimerListener {
+
+    protected static Log logger =
+        LogFactory.getLog(ResourceSweeper.class.getName());
+
+    protected Map resources;
+    protected ResourceHome home;
+
+    /**
+     *
+     * @param resources must be synchronized map
+     */
+    public ResourceSweeper(ResourceHome home, Map resources) {
+        this.home = home;
+        this.resources = resources;
+    }
+
+    public void timerExpired(Timer timer) {
+        logger.debug("cleaning expired resources");
+
+        Calendar currentTime = Calendar.getInstance();
+        ResourceKey key;
+        Object resource;
+        LinkedList list = new LinkedList();
+
+        synchronized(this.resources) {
+            Iterator keyIterator = this.resources.keySet().iterator();
+            while(keyIterator.hasNext()) {
+                key = (ResourceKey)keyIterator.next();
+                try {
+                    resource = getResource(key);
+                    if (resource != null && isExpired(resource, currentTime)) {
+                        list.add(key);
+                    }
+                } catch (ResourceException e) {
+                    logger.error("", e);
+                }
+            }
+        }
+
+        Iterator iter = list.iterator();
+        while(iter.hasNext()) {
+            key = (ResourceKey)iter.next();
+            try {
+                this.home.remove(key);
+            } catch (ResourceException e) {
+                logger.error("", e);
+            }
+        }
+    }
+
+    protected Resource getResource(ResourceKey key)
+        throws ResourceException {
+        return (Resource)this.home.find(key);
+    }
+    
+    protected boolean isExpired(Object resource, Calendar currentTime) {
+        if (!(resource instanceof ResourceLifetime)) {
+            return false;
+        }
+        return isExpired((ResourceLifetime)resource, currentTime);
+    }
+    
+    public static boolean isExpired(Resource resource) {
+        if (!(resource instanceof ResourceLifetime)) {
+            return false;
+        }
+        return isExpired((ResourceLifetime)resource, Calendar.getInstance());
+    }
+    
+    public static boolean isExpired(ResourceLifetime resource,
+                                    Calendar currentTime) {
+        Calendar terminationTime = resource.getTerminationTime();
+        return (terminationTime != null &&
+                terminationTime.before(currentTime));
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ServiceResourceHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ServiceResourceHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/ServiceResourceHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,109 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import org.apache.axis.MessageContext;
+import org.apache.axis.AxisEngine;
+import org.apache.axis.handlers.soap.SOAPService;
+import org.apache.axis.providers.java.JavaProvider;
+import org.apache.axis.enum.Scope;
+import org.apache.axis.utils.cache.ClassCache;
+import org.apache.axis.utils.cache.JavaClass;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.jndi.Initializable;
+import org.globus.wsrf.utils.Resources;
+import org.globus.axis.providers.RPCProvider;
+
+/** 
+ * A ResourceHome that always returns its corresponding service object,
+ * in response to a null key. Note that the service MUST have been deployed
+ * with application scope (for example, with wsdl parameter <code>scope</code>
+ * set to value <code>Application</code>); otherwise there is no meaningful
+ * single object for this class to return. Also MUST be deployed with
+ * <code>loadOnStartup</code> parameter set to <code>true</code>.
+ */
+public class ServiceResourceHome
+    extends SingletonResourceHome 
+    implements Initializable {
+    
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private Resource service;
+
+    public synchronized void initialize() throws Exception {
+        if (this.service != null) {
+            return;
+        }
+        
+        /*
+         * Since must be deployed with loadOnStartup the MessageContext
+         * will be set property at initialize time.
+         */
+        MessageContext msgContext = MessageContext.getCurrentContext();
+        if (msgContext == null) {
+            throw new Exception(i18n.getMessage("noMsgContext"));
+        }
+        String targetService = msgContext.getTargetService();
+        if (targetService == null) {
+            throw new Exception(i18n.getMessage("noTargetServiceSet"));
+        }
+        SOAPService service = msgContext.getService();
+        if (service == null) {
+            throw new Exception(i18n.getMessage("noServiceSet"));
+        }
+        
+        Scope scope = Scope.getScope(
+                         (String)service.getOption(JavaProvider.OPTION_SCOPE), 
+                         Scope.DEFAULT);
+        if (scope != Scope.APPLICATION) {
+            throw new Exception(i18n.getMessage("applicationScopeNeeded",
+                                                targetService));
+        }
+
+        String clsName = 
+            (String)service.getOption(JavaProvider.OPTION_CLASSNAME);
+
+        AxisEngine engine = msgContext.getAxisEngine();
+        ClassLoader cl = msgContext.getClassLoader();
+        ClassCache cache = engine.getClassCache();
+        JavaClass  jc = cache.lookup(clsName, cl);
+        
+        if (!Resource.class.isAssignableFrom(jc.getJavaClass())) {
+            throw new Exception(i18n.getMessage("invalidResourceType",
+                                                jc.getJavaClass().getName()));
+        }
+
+        Object serviceInstance  = 
+            RPCProvider.getNewServiceInstance(msgContext, 
+                                              jc.getJavaClass());
+        engine.getApplicationSession().set(targetService,
+                                           serviceInstance);
+        
+        this.service = (Resource)serviceInstance;
+    }
+
+    /** 
+     * Finds the service object associated with this resource home.
+     */
+    protected Resource findSingleton()
+        throws ResourceException {
+        return this.service;
+    }
+}
+

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourceKey.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourceKey.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourceKey.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,119 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.InvalidResourceKeyException;
+import org.globus.wsrf.encoding.SerializationException;
+import org.globus.wsrf.encoding.ObjectSerializer;
+import org.globus.wsrf.encoding.ObjectDeserializer;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A basic implementation of <code>ResourceKey</code>. 
+ */
+public class SimpleResourceKey implements ResourceKey {
+
+    private static Log logger =
+        LogFactory.getLog(SimpleResourceKey.class.getName());
+
+    private QName name;
+    private Object value;
+    
+    /**
+     * Creates a new SimpleResourceKey.
+     *
+     * @param header the SOAPElement containing the key. The element's name
+     *        and namespace are used as key name.
+     * @param type the type of the key. The SOAPElement will be deserialized
+     *        into this type using 
+     *        {@link ObjectDeserializer#toObject(SOAPElement, Class) 
+     *        ObjectDeserializer.toObject()}. 
+     * @throws InvalidResourceKeyException if deserialization of the key fails.
+     */
+    public SimpleResourceKey(SOAPElement header, Class type)
+        throws InvalidResourceKeyException {
+        try {
+            this.value = ObjectDeserializer.toObject(header, type);
+        } catch (Exception e) {
+            throw new InvalidResourceKeyException(e);
+        }
+        this.name = new QName(header.getElementName().getURI(),
+                              header.getElementName().getLocalName());
+    }
+    
+    /**
+     * Creates a new SimpleResourceKey.
+     *
+     * @param name the name of the key
+     * @param value the value of the key. The value of the key can be any 
+     *        simple/primitive type or any WSDL2Java generated type or any
+     *        other type with proper type mappings.
+     */
+    public SimpleResourceKey(QName name, Object value) {
+        this.name = name;
+        this.value = value;
+    }
+    
+    public QName getName() {
+        return this.name;
+    }
+    
+    public Object getValue() {
+        return this.value;
+    }
+    
+    public SOAPElement toSOAPElement()
+        throws SerializationException {
+        return ObjectSerializer.toSOAPElement(this.value, this.name);
+    }
+
+    public String toString() {
+        return this.name  + "=" + this.value;
+    }
+
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (!(obj instanceof SimpleResourceKey)) {
+            return false;
+        }
+        
+        SimpleResourceKey otherKey = (SimpleResourceKey) obj;
+        
+        if (!this.name.equals(otherKey.name)) {
+            return false;
+        }
+        
+        if (!this.value.equals(otherKey.value)) {
+            return false;
+        }
+        
+        return true;
+    }
+    
+    public int hashCode() {
+        return this.name.hashCode() + this.value.hashCode();
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourceProperty.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourceProperty.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourceProperty.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,155 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+import javax.xml.soap.SOAPElement;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.encoding.ObjectSerializer;
+import org.globus.wsrf.encoding.SerializationException;
+import org.globus.wsrf.ResourcePropertyMetaData;
+import org.globus.wsrf.utils.Resources;
+
+/**
+ * A simple in-memory implementation of the <code>ResourceProperty</code>
+ * interface. The resource property values are stored in a List.
+ */
+public class SimpleResourceProperty extends BaseResourceProperty {
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private List list;
+    private boolean validation = false;
+
+    public SimpleResourceProperty(QName name) {
+        this(new SimpleResourcePropertyMetaData(name));
+    }
+
+    public SimpleResourceProperty(ResourcePropertyMetaData metaData) {
+        super(metaData);
+        this.list = new ArrayList();
+    }
+
+    public void setEnableValidation(boolean validation) {
+        this.validation = validation;
+    }
+
+    public boolean isValidationEnabled() {
+        return this.validation;
+    }
+
+    public void add(Object value) {
+        checkReadOnly();
+        this.list.add(convert(value));
+    }
+
+    public boolean remove(Object value) {
+        checkReadOnly();
+        return this.list.remove(convert(value));
+    }
+
+    public Object get(int index) {
+        return this.list.get(index);
+    }
+
+    public void set(int index, Object value) {
+        checkReadOnly();
+        this.list.set(index, convert(value));
+    }
+
+    public void clear() {
+        checkReadOnly();
+        this.list.clear();
+    }
+
+    public int size() {
+        return this.list.size();
+    }
+
+    public boolean isEmpty() {
+        return this.list.isEmpty();
+    }
+
+    public Iterator iterator() {
+        return this.list.iterator();
+    }
+
+    private void checkReadOnly() {
+        if (this.validation && this.metaData.isReadOnly()) {
+            throw new IllegalStateException(i18n.getMessage("modifyReadOnly"));
+        }
+    }
+
+    public SOAPElement[] toSOAPElements()
+        throws SerializationException {
+        SOAPElement [] values = null;
+        boolean nillable = this.metaData.isNillable();
+        QName name = getMetaData().getName();
+        if (this.list.isEmpty()) {
+            if (nillable) {
+                values = new SOAPElement[1];
+                values[0] = ObjectSerializer.toSOAPElement(null,
+                                                           name,
+                                                           nillable);
+            }
+        } else {
+            values = new SOAPElement[this.list.size()];
+            Iterator iter = this.list.iterator();
+            int i = 0;
+            while(iter.hasNext()) {
+                Object value = iter.next();
+                values[i++] = ObjectSerializer.toSOAPElement(value,
+                                                             name,
+                                                             nillable);
+            }
+        }
+        return values;
+    }
+
+    public Element[] toElements()
+        throws SerializationException {
+        Element [] values = null;
+        boolean nillable = this.metaData.isNillable();
+        QName name = getMetaData().getName();
+        if (this.list.isEmpty()) {
+            if (nillable) {
+                values = new Element[1];
+                values[0] = ObjectSerializer.toElement(null,
+                                                       name,
+                                                       nillable);
+            }
+        } else {
+            values = new Element[this.list.size()];
+            Iterator iter = this.list.iterator();
+            int i = 0;
+            while(iter.hasNext()) {
+                Object value = iter.next();
+                values[i++] = ObjectSerializer.toElement(value,
+                                                         name,
+                                                         nillable);
+            }
+        }
+        return values;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourcePropertyMetaData.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourcePropertyMetaData.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourcePropertyMetaData.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,156 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import javax.xml.namespace.QName;
+
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.ResourcePropertyMetaData;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+public class SimpleResourcePropertyMetaData 
+    implements ResourcePropertyMetaData {
+
+    public static final SimpleResourcePropertyMetaData TERMINATION_TIME = 
+        new SimpleResourcePropertyMetaData(WSRFConstants.TERMINATION_TIME, 
+                                           1, 1, true, true);
+    
+    public static final SimpleResourcePropertyMetaData CURRENT_TIME = 
+        new SimpleResourcePropertyMetaData(WSRFConstants.CURRENT_TIME, 
+                                           1, 1, false, true);
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    protected QName name;
+    protected boolean nillable;
+    protected int minOccurs;
+    protected int maxOccurs;
+    protected Class type;
+    protected boolean readOnly;
+
+    public SimpleResourcePropertyMetaData(QName name) {
+        this(name, 1, 1, false, Object.class, false);
+    }
+
+    public SimpleResourcePropertyMetaData(QName name,
+                                          int minOccurs,
+                                          int maxOccurs,
+                                          boolean nillable,
+                                          boolean readOnly) {
+        this(name, minOccurs, maxOccurs, 
+             nillable, Object.class, readOnly);
+    }
+
+    public SimpleResourcePropertyMetaData(QName name,
+                                          int minOccurs,
+                                          int maxOccurs,
+                                          boolean nillable,
+                                          Class type,
+                                          boolean readOnly) {
+        if (name == null) {
+            throw new IllegalArgumentException();
+        }
+        this.name = name;
+        this.minOccurs = minOccurs;
+        this.maxOccurs = maxOccurs;
+        this.nillable = nillable;
+        this.readOnly = readOnly;
+        setType(type);
+    }
+
+    public QName getName() {
+        return this.name;
+    }
+
+    public boolean isNillable() {
+        return this.nillable;
+    }
+
+    /**
+     * Sets if this resource property can be nillable.
+     *
+     * @param nillable the nillable property.
+     */
+    protected void setNillable(boolean nillable) {
+        this.nillable = nillable;
+    }
+
+    public int getMinOccurs() {
+        return this.minOccurs;
+    }
+
+    /**
+     * Sets the minimum number of values that this resource property can ever
+     * have.
+     *
+     * @param min the minimum number of values allowed in this resource 
+     *        property.
+     */
+    protected void setMinOccurs(int min) {
+        this.minOccurs = min;
+    }
+
+    public int getMaxOccurs() {
+        return this.maxOccurs;
+    }
+
+    /**
+     * Sets the maximum number of values that this resource property can ever
+     * have.
+     *
+     * @param max the maximum number of values allowed in this resource 
+     *        property.
+     */
+    protected void setMaxOccurs(int max) {
+        this.maxOccurs = max;
+    }
+
+    /**
+     * Sets the Java element type of this property.
+     * When adding or setting element values the input value
+     * will be automatically converted into this type.
+     * If set to <code>Object.class</code> then no conversion
+     * will be done. 
+     * This operation is optional. If setting the element type is not
+     * supported it should throw 
+     * {@link java.lang.UnsupportedOperationException
+     * UnsupportedOperationException}.
+     *
+     * @param type Element type of this property.
+     */
+    protected void setType(Class type) {
+        if (type == Void.TYPE ||
+            type.isArray()) {
+            throw new IllegalArgumentException();
+        }
+        this.type = type;
+    }
+
+    public Class getType() {
+        return this.type;
+    }
+
+    protected void setReadOnly(boolean readOnly) {
+        this.readOnly = readOnly;
+    }
+
+    public boolean isReadOnly() {
+        return this.readOnly;
+    }
+
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourcePropertySet.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourcePropertySet.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleResourcePropertySet.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,175 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.Map;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.ResourcePropertyMetaData;
+import org.globus.wsrf.encoding.SerializationException;
+import org.globus.wsrf.utils.XmlUtils;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Simple in-memory implementation of <code>ResourcePropertySet</code>.
+ */
+public class SimpleResourcePropertySet implements ResourcePropertySet {
+
+    private QName name;
+    private Map properties;
+    private boolean openContent;
+    private boolean localNameMatching = false;
+    
+    public SimpleResourcePropertySet(QName name) {
+        this.properties = new Hashtable();
+        this.name = name;
+    }
+
+    public QName getName() {
+        return this.name;
+    }
+
+    public ResourceProperty create(ResourcePropertyMetaData rpMetaData) {
+        return new SimpleResourceProperty(rpMetaData);
+    }
+
+    public ResourceProperty get(QName name) {
+        ResourceProperty prop = (ResourceProperty)this.properties.get(name);
+        if (prop != null) {
+            return prop;
+        }
+        if (this.localNameMatching) {
+            // try local name matching
+            Iterator iter = this.properties.entrySet().iterator();
+            while(iter.hasNext()) {
+                Map.Entry entry = (Map.Entry)iter.next();
+                QName rp = (QName)entry.getKey();
+                if (rp.getLocalPart().equals(name.getLocalPart())) {
+                    return (ResourceProperty)entry.getValue();
+                }
+            }
+        }
+        return null;
+    }
+
+    public boolean add(ResourceProperty property) {
+        QName name = property.getMetaData().getName();
+        this.properties.put(name, property);
+        return true;
+    }
+
+    public boolean remove(QName name) {
+        ResourceProperty prop = (ResourceProperty)this.properties.remove(name);
+        return (prop != null);
+    }
+    
+    public Iterator iterator() {
+        return this.properties.values().iterator();
+    }
+
+    public boolean isOpenContent() {
+        return this.openContent;
+    }
+
+    public void clear() {
+        this.properties.clear();
+    }
+
+    public int size() {
+        return this.properties.size();
+    }
+
+    public boolean isEmpty() {
+        return this.properties.isEmpty();
+    }
+    
+    /**
+     * Configures open content property.
+     *
+     * @param open true if arbitrary resource property can be added to the set.
+     */
+    public void setOpenContent(boolean open) {
+        this.openContent = open;
+    }
+    
+    /**
+     * Returns whether local name matching is allowed. Local name matching
+     * is disabled by default.
+     *
+     * @return true if local name matching is allowed. False otherwise.
+     */
+    public boolean isLocalNameMatching() {
+        return this.localNameMatching;
+    }
+
+    /**
+     * Configures if ResourceProperty can be retrieved just by matching the
+     * local name (namespace part is ignored).
+     *
+     * @param matching true to allow local name matching.
+     */
+    public void setLocalNameMatching(boolean matching) {
+        this.localNameMatching = matching;
+    }
+ 
+    public Element toElement() 
+        throws SerializationException {
+        Document doc = null;
+        try {
+            doc = XmlUtils.newDocument();
+        } catch (Exception e) {
+            throw new SerializationException("", e);
+        }
+
+        Element rootElement = doc.createElementNS(this.name.getNamespaceURI(),
+                                                  this.name.getLocalPart());
+        doc.appendChild(rootElement);
+
+        Iterator iter = iterator();
+        while(iter.hasNext()) {
+            ResourceProperty prop = (ResourceProperty)iter.next();
+            Element [] values = prop.toElements();
+            if (values == null) {
+                continue;
+            }
+            for (int i=0;i<values.length;i++) {
+                // they will not match but for future reference
+                if (doc == values[i].getOwnerDocument()) {
+                    rootElement.appendChild(values[i]);
+                } else {
+                    rootElement.appendChild(doc.importNode(values[i], true));
+                }
+            }
+        }
+
+        return rootElement;
+    }
+
+    public SOAPElement toSOAPElement()
+        throws SerializationException {
+        // for now
+        throw new UnsupportedOperationException();
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleSubscriptionTopicListener.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleSubscriptionTopicListener.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleSubscriptionTopicListener.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,274 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.List;
+import java.io.Serializable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.rpc.Stub;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.ResourceHome;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.Subscription;
+import org.globus.wsrf.Topic;
+import org.globus.wsrf.topicexpression.TopicExpressionEngine;
+import org.globus.wsrf.topicexpression.TopicExpressionEvaluator;
+import org.globus.wsrf.TopicListener;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.impl.security.authentication.Constants;
+import org.globus.wsrf.impl.security.authorization.NoAuthorization;
+import org.globus.wsrf.impl.security.descriptor.ClientSecurityDescriptor;
+import org.globus.util.I18n;
+
+import org.oasis.wsn.NotificationConsumer;
+import org.oasis.wsn.NotificationMessageHolderType;
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.WSBaseNotificationServiceAddressingLocator;
+import org.oasis.wsn.Notify;
+
+/**
+ * Topic listener implementation that will trigger notifications when a topic
+ * changes. To be used in conjunction with the SimpleSubscription class.
+ *
+ * @see org.globus.wsrf.impl.notification.SimpleSubscription
+ */
+public class SimpleSubscriptionTopicListener implements TopicListener,
+                                                        Serializable
+{
+
+    private static Log logger =
+        LogFactory.getLog(SimpleSubscriptionTopicListener.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private ResourceKey key;
+    private String homeLocation;
+    private transient NotificationConsumer consumerPort = null;
+    private transient WSBaseNotificationServiceAddressingLocator locator =
+        null;
+
+    /**
+     * Construct a listener instance.
+     *
+     * @param key          The key for the subscription resource associated with
+     *                     this listener.
+     * @param homeLocation The JNDI location of the subscription resource home
+     */
+    public SimpleSubscriptionTopicListener(
+        ResourceKey key,
+        String homeLocation)
+    {
+        this.key = key;
+        this.homeLocation = homeLocation;
+    }
+
+    public void topicChanged(Topic topic)
+    {
+        Subscription subscription = null;
+        try
+        {
+            subscription = this.getSubscription();
+        }
+        catch(ResourceException e)
+        {
+            logger.warn(i18n.getMessage("subscriptionFindFailed",
+                                        this.key.getValue()));
+            logger.debug("", e);
+        }
+
+        if (subscription != null) {
+            try
+            {
+                this.notify(subscription,
+                            topic.getTopicPath(),
+                            topic.getCurrentMessage());
+            }
+            catch(Exception e)
+            {
+                logger.warn(i18n.getMessage("notificationFailed",
+                                            this.key.getValue()));
+                logger.debug("", e);
+            }
+        }
+    }
+
+    public void topicAdded(Topic topic)
+    {
+    }
+
+    public void topicRemoved(Topic topic)
+    {
+    }
+
+    public Subscription getSubscription() throws ResourceException
+    {
+        ResourceHome home = null;
+        try
+        {
+            Context initialContext = new InitialContext();
+            home = (ResourceHome) initialContext.lookup(this.homeLocation);
+        }
+        catch(Exception e)
+        {
+            throw new ResourceException(
+                i18n.getMessage("subscriptionFindFailed",
+                                this.key.getValue()), e);
+        }
+        return (Subscription) home.find(key);
+    }
+
+    /**
+     * @return String the JNDI location of the Home of the subscription
+     */
+    public String getSubscriptionHomeLocation() {
+        return this.homeLocation;
+    }
+
+    /**
+     * @return String the resource key of the subscription
+     */
+    public ResourceKey getSubscriptionResourceKey() {
+        return this.key;
+    }
+
+
+    /**
+     * Send a notification
+     *
+     * @param subscription The subscription for which to send the notification
+     * @param topicPath    The topic path of the topic that caused the
+     *                     notification
+     * @param newValue     The new value of the topic
+     * @throws Exception
+     */
+    protected void notify(
+        Subscription subscription, List topicPath, Object newValue)
+        throws Exception
+    {
+
+        synchronized(subscription)
+        {
+            if(!subscription.isPaused())
+            {
+                EndpointReferenceType consumerEPR =
+                    subscription.getConsumerReference();
+                if(subscription.getUseNotify())
+                {
+                    ClientSecurityDescriptor descriptor =
+                        subscription.getSecurityProperties();
+                    setPort(descriptor, consumerEPR);
+                    Notify notification = new Notify();
+                    EndpointReferenceType producerEndpoint =
+                        subscription.getProducerReference();
+                    TopicExpressionEngine engine =
+                        TopicExpressionEngineImpl.getInstance();
+                    TopicExpressionType tp = subscription.getTopicExpression();
+                    String dialect = tp.getDialect().toString();
+                    TopicExpressionEvaluator evaluator =
+                        engine.getEvaluator(dialect);
+                    TopicExpressionType topicExpression =
+                        (TopicExpressionType) evaluator.toTopicExpression(
+                            topicPath);
+                    NotificationMessageHolderType[] message =
+                        {new NotificationMessageHolderType()};
+                    message[0].setProducerReference(producerEndpoint);
+                    message[0].setMessage(newValue);
+                    message[0].setTopic(topicExpression);
+                    notification.setNotificationMessage(message);
+                    this.consumerPort.notify(notification);
+                }
+                else
+                {
+                    // TODO: raw notifications
+                }
+            }
+        }
+    }
+
+    //TODO: revisit this from perf angle, don't thing we need to regenerate
+    // the stub quite as aggressively
+    private void setPort(
+        ClientSecurityDescriptor descriptor,
+        EndpointReferenceType consumerEPR)
+        throws Exception
+    {
+        if(descriptor != null)
+        {
+            if(descriptor.getGSISecureConv() != null)
+            {
+                logger.debug("Security properties not null: secure conv");
+                // cannot reuse locator
+                WSBaseNotificationServiceAddressingLocator
+                    loc = new WSBaseNotificationServiceAddressingLocator();
+                this.consumerPort =
+                    loc.getNotificationConsumerPort(consumerEPR);
+            }
+            else
+            {
+                // resuse locator, not port
+                logger.debug("Security properties not null: not secure conv");
+                setPort(false, consumerEPR);
+            }
+            logger.debug("Setting security properties");
+            Stub portStub = (Stub) this.consumerPort;
+            // set authz to NoAuthz by default. Could be overridden if
+            // authorization property is set in the security
+            // descriptor
+            if(descriptor.getAuthz() == null)
+            {
+                descriptor.setAuthz(NoAuthorization.getInstance());
+            }
+            portStub._setProperty(Constants.CLIENT_DESCRIPTOR, descriptor);
+        }
+        else
+        {
+            logger.debug("Security properties null");
+            setPort(true, consumerEPR);
+        }
+    }
+
+    private synchronized void setPort(
+        boolean reuse,
+        EndpointReferenceType consumerEPR)
+        throws Exception
+    {
+
+        logger.debug("set port with " + reuse);
+        if((reuse) && (this.consumerPort != null))
+        {
+            return;
+        }
+
+        if(this.locator == null)
+        {
+            this.locator = new WSBaseNotificationServiceAddressingLocator();
+        }
+
+        if((this.consumerPort == null) || (!reuse))
+        {
+            this.consumerPort =
+                this.locator.getNotificationConsumerPort(consumerEPR);
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopic.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopic.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopic.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,218 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.oasis.wsn.TopicExpressionType;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.Topic;
+import org.globus.wsrf.TopicListener;
+import org.globus.wsrf.utils.Resources;
+
+/**
+ * Simple in-memory implementation of the Topic interface
+ */
+public class SimpleTopic implements Topic, TopicListener
+{
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+    protected Map subTopics;
+    protected TopicExpressionType reference;
+    protected Collection listeners;
+    protected QName name;
+    protected Object current;
+    protected List topicPath; // ordered set of QNames
+    static Log logger =
+        LogFactory.getLog(SimpleTopic.class.getName());
+
+    public void addTopic(Topic topic) throws Exception
+    {
+        if(this.reference != null)
+        {
+            throw new Exception(i18n.getMessage("addingSubTopicToReference"));
+        }
+
+        this.subTopics.put(topic.getName(), topic);
+
+        List topicPath = new LinkedList();
+
+        topicPath.addAll(this.topicPath);
+        topicPath.add(topic.getName());
+
+        topic.setTopicPath(topicPath);
+        topic.addTopicListener(this);
+        this.topicAdded(topic);
+    }
+
+    public synchronized void addTopicListener(TopicListener listener)
+    {
+        this.listeners.add(listener);
+    }
+
+    public QName getName()
+    {
+        return this.name;
+    }
+
+    public Topic getTopic(QName topicName)
+    {
+        // Maybe should be called getSubTopic ?
+        return (Topic) this.subTopics.get(topicName);
+    }
+
+    public TopicExpressionType getTopicReference()
+    {
+        return this.reference;
+    }
+
+    public boolean isReference()
+    {
+        return (this.reference != null);
+    }
+
+    public Iterator topicIterator()
+    {
+        return this.subTopics.values().iterator();
+    }
+
+    public void notify(Object obj) throws Exception
+    {
+        this.current = obj;
+        if(logger.isDebugEnabled())
+        {
+            logger.debug("Notify called on topic " +
+                         this.name + " with message " + obj.toString());
+        }
+        this.topicChanged(this);
+    }
+
+    public Object getCurrentMessage()
+    {
+        return this.current;
+    }
+
+    public void removeTopic(Topic topic)
+    {
+        this.subTopics.remove(topic.getName());
+        topic.removeTopicListener(this);
+        this.topicRemoved(topic);
+    }
+
+    public synchronized void removeTopicListener(TopicListener listener)
+    {
+        this.listeners.remove(listener);
+    }
+
+    public synchronized Iterator topicListenerIterator()
+    {
+        return this.listeners.iterator();
+    }
+
+    public void setTopicReference(TopicExpressionType topicPath)
+    {
+        this.reference = topicPath;
+    }
+
+    public void setTopicPath(List topicPath)
+    {
+        this.topicPath = topicPath;
+    }
+
+    public List getTopicPath()
+    {
+        return this.topicPath;
+    }
+
+    /**
+     * Create a topic with the given name
+     *
+     * @param name The name of the created topic
+     */
+    public SimpleTopic(QName name)
+    {
+        this(new HashMap(), null, new Vector(), name, null, null);
+    }
+
+    /**
+     * Create a topic with the given parameters
+     *
+     * @param subTopics     A map of child topics
+     * @param reference     A topic expression (only used if this is a topic
+     *                      alias)
+     * @param listeners     A collection of topic listeners
+     * @param name          The name of this topic
+     * @param current       The current value of this topic
+     * @param topicPath     The concrete topic path of this topic
+     */
+    public SimpleTopic(
+        Map subTopics, TopicExpressionType reference,
+        Collection listeners, QName name,
+        Object current, List topicPath)
+    {
+        this.subTopics = subTopics;
+        this.reference = reference;
+        this.listeners = listeners;
+        this.name = name;
+        this.current = current;
+        this.topicPath = topicPath;
+    }
+
+    public synchronized void topicAdded(Topic topic)
+    {
+        Iterator listenerIterator = this.listeners.iterator();
+        TopicListener listener;
+
+        while(listenerIterator.hasNext())
+        {
+            listener = (TopicListener) listenerIterator.next();
+            listener.topicAdded(topic);
+        }
+    }
+
+    public synchronized void topicChanged(Topic topic)
+    {
+        Iterator listenerIterator = this.listeners.iterator();
+        TopicListener listener;
+        while(listenerIterator.hasNext())
+        {
+            listener = (TopicListener) listenerIterator.next();
+            listener.topicChanged(this);
+        }
+    }
+
+    public synchronized void topicRemoved(Topic topic)
+    {
+        Iterator listenerIterator = this.listeners.iterator();
+        TopicListener listener;
+        while(listenerIterator.hasNext())
+        {
+            listener = (TopicListener) listenerIterator.next();
+            listener.topicRemoved(topic);
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopicExpressionEvaluator.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopicExpressionEvaluator.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopicExpressionEvaluator.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,115 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Vector;
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.Topic;
+import org.globus.wsrf.TopicList;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.topicexpression.InvalidTopicExpressionException;
+import org.globus.wsrf.topicexpression.TopicExpressionResolutionException;
+import org.globus.wsrf.topicexpression.TopicExpressionEvaluator;
+import org.globus.wsrf.topicexpression.TopicExpressionException;
+import org.globus.wsrf.topicexpression.UnsupportedTopicExpressionDialectException;
+import org.globus.wsrf.utils.Resources;
+import org.oasis.wsn.TopicExpressionType;
+
+/**
+ * Topic expression evalutor for the simple topic dialect.
+ *
+ * @see org.globus.wsrf.topicexpression.TopicExpressionEvaluator
+ */
+public class SimpleTopicExpressionEvaluator implements TopicExpressionEvaluator
+{
+    static Log logger =
+        LogFactory.getLog(SimpleTopicExpressionEvaluator.class.getName());
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+    private static String[] dialects = {WSNConstants.SIMPLE_TOPIC_DIALECT};
+
+    public Collection resolve(TopicExpressionType expression,
+                              TopicList topicList) 
+        throws UnsupportedTopicExpressionDialectException,
+               TopicExpressionResolutionException,
+               InvalidTopicExpressionException,
+               TopicExpressionException
+    {
+        QName topicName = (QName) ((TopicExpressionType) expression).getValue();
+
+        logger.debug("Looking for topic with namespace: " +
+                     topicName.getNamespaceURI() + " and local part " +
+                     topicName.getLocalPart());
+
+        Collection result = new Vector();
+        List topicPath = new LinkedList();
+        topicPath.add(topicName);
+
+        Topic topic = topicList.getTopic(topicPath);
+
+        if(topic != null)
+        {
+            result.add(topic);
+        }
+
+        return result;
+    }
+
+    public String[] getDialects()
+    {
+        return dialects;
+    }
+
+    public List getConcreteTopicPath(TopicExpressionType expression)
+        throws UnsupportedTopicExpressionDialectException,
+               InvalidTopicExpressionException,
+               TopicExpressionException
+    {
+        List result = new LinkedList();
+        result.add(((TopicExpressionType) expression).getValue());
+        return result;
+    }
+
+    public TopicExpressionType toTopicExpression(List topicPath)
+        throws InvalidTopicExpressionException,
+               TopicExpressionException
+    {
+        if(topicPath == null || topicPath.size() != 1)
+        {
+            throw new InvalidTopicExpressionException(
+                i18n.getMessage("invalidSimpleTopicPath"));
+        }
+
+        TopicExpressionType result = null;
+        try {
+             result = new TopicExpressionType(
+                            WSNConstants.SIMPLE_TOPIC_DIALECT, 
+                            (QName) topicPath.get(0));
+        } catch (IOException e) {
+            throw new TopicExpressionException("", e);
+        }
+        return result;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopicList.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopicList.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopicList.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,277 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.oasis.wsn.TopicExpressionType;
+
+import org.globus.wsrf.ResourceProperties;
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.Topic;
+import org.globus.wsrf.TopicList;
+import org.globus.wsrf.TopicListMetaData;
+import org.globus.wsrf.TopicListener;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.topicexpression.InvalidTopicExpressionException;
+import org.globus.wsrf.topicexpression.TopicExpressionEngine;
+import org.globus.wsrf.topicexpression.TopicExpressionEvaluator;
+import org.globus.wsrf.topicexpression.TopicExpressionException;
+import org.globus.wsrf.topicexpression.TopicExpressionResolutionException;
+import org.globus.wsrf.topicexpression.UnsupportedTopicExpressionDialectException;
+
+/**
+ * Simplistic in memory topic list.
+ */
+public class SimpleTopicList implements TopicList, TopicListener
+{
+    protected Map rootTopics = new HashMap();
+    protected Collection listeners = new Vector();
+
+    private ResourceProperty supportedTopics =
+        new SimpleResourceProperty(WSNConstants.TOPIC);
+    private ResourceProperty fixedTopicSet =
+        new SimpleResourceProperty(WSNConstants.FIXED_TOPIC_SET);
+
+    private static TopicExpressionEngine topicExpressionEngine =
+        TopicExpressionEngineImpl.getInstance();
+
+    private TopicListMetaData metaData;
+
+    static Log logger =
+        LogFactory.getLog(SimpleTopicList.class.getName());
+
+    /**
+     * This constructor will add the resource properties associated with the
+     * notification producer porttype to the supplied resource object
+     *
+     * @param resource Resource object, must implement the ResourceProperties
+     *                 interface
+     */
+    public SimpleTopicList(ResourceProperties resource)
+    {
+        this(resource, new SimpleTopicListMetaData(false));
+    }
+
+    /**
+     * This constructor will add the resource properties associated with the
+     * notification producer porttype to the supplied resource object
+     *
+     * @param resource Resource object, must implement the ResourceProperties
+     *                 interface
+     */
+    public SimpleTopicList(ResourceProperties resource,
+                           TopicListMetaData metaData)
+    {
+        this.metaData = metaData;
+
+        ResourcePropertySet propertySet = resource.getResourcePropertySet();
+
+        // init and add fixedTopicSet RP
+        this.fixedTopicSet.add(new Boolean(metaData.isTopicSetFixed()));
+        propertySet.add(this.fixedTopicSet);
+
+        // add supportedTopics RP
+        propertySet.add(this.supportedTopics);
+
+        try
+        {
+            propertySet.add(new ReflectionResourceProperty(
+                WSNConstants.TOPIC_EXPRESSION_DIALECTS,
+                "SupportedDialects",
+                topicExpressionEngine));
+        }
+        catch(Exception e)
+        {
+            logger.debug("Failed to set up SupportedDialects RP", e);
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+    public void addTopic(Topic topic)
+    {
+        this.rootTopics.put(topic.getName(), topic);
+
+        List topicPath = new LinkedList();
+        topicPath.add(topic.getName());
+        topic.setTopicPath(topicPath);
+
+        topic.addTopicListener(this);
+        this.topicAdded(topic);
+    }
+
+    public synchronized void addTopicListener(TopicListener listener)
+    {
+        this.listeners.add(listener);
+    }
+
+    public Collection getTopics(TopicExpressionType topicExpression)
+        throws UnsupportedTopicExpressionDialectException,
+               TopicExpressionResolutionException,
+               InvalidTopicExpressionException,
+               TopicExpressionException
+    {
+        return topicExpressionEngine.resolveTopicExpression(topicExpression,
+                                                            this);
+    }
+
+    public void removeTopic(Topic topic)
+    {
+        this.rootTopics.remove(topic.getName());
+        topic.removeTopicListener(this);
+        this.topicRemoved(topic);
+    }
+
+    public synchronized void removeTopicListener(TopicListener listener)
+    {
+        listeners.remove(listener);
+    }
+
+    public synchronized Iterator topicListenerIterator()
+    {
+        return listeners.iterator();
+    }
+
+    public Topic getTopic(List topicPath)
+    {
+        Iterator pathIterator = topicPath.iterator();
+        QName topicName;
+        Topic topic = null;
+        while(pathIterator.hasNext())
+        {
+            topicName = (QName) pathIterator.next();
+            if(topic == null)
+            {
+                topic = (Topic) this.rootTopics.get(topicName);
+            }
+            else
+            {
+                topic = topic.getTopic(topicName);
+            }
+
+            if(topic == null)
+            {
+                return null;
+            }
+
+        }
+
+        return topic;
+    }
+
+    public TopicListMetaData getTopicListMetaData()
+    {
+        return this.metaData;
+    }
+
+    public Iterator topicIterator()
+    {
+        return this.rootTopics.values().iterator();
+    }
+
+    public void topicAdded(Topic topic)
+    {
+        TopicExpressionEvaluator evaluator =
+            topicExpressionEngine.getEvaluator(
+                WSNConstants.SIMPLE_TOPIC_DIALECT);
+        TopicExpressionType topicExpression = null;
+        try
+        {
+            topicExpression =
+                evaluator.toTopicExpression(topic.getTopicPath());
+        }
+        catch(Exception e)
+        {
+            logger.debug("Failed to create topic expression from topic path",
+                         e);
+            throw new RuntimeException(e.getMessage());
+        }
+
+        this.supportedTopics.add(topicExpression);
+
+        synchronized(this)
+        {
+            Iterator listenerIterator = this.listeners.iterator();
+            TopicListener listener;
+            while(listenerIterator.hasNext())
+            {
+                listener = (TopicListener) listenerIterator.next();
+                listener.topicAdded(topic);
+            }
+        }
+    }
+
+    public synchronized void topicChanged(Topic topic)
+    {
+        Iterator listenerIterator = this.listeners.iterator();
+        TopicListener listener;
+        if (logger.isDebugEnabled()) {
+            logger.debug("being notified that a topic has changed");
+        }
+        while(listenerIterator.hasNext())
+        {
+            listener = (TopicListener) listenerIterator.next();
+            if (logger.isDebugEnabled()) {
+                logger.debug("notifying listener " + listener);
+            }
+            listener.topicChanged(topic);
+        }
+    }
+
+    public void topicRemoved(Topic topic)
+    {
+        TopicExpressionEvaluator evaluator =
+            topicExpressionEngine.getEvaluator(
+                WSNConstants.SIMPLE_TOPIC_DIALECT);
+        TopicExpressionType topicExpression = null;
+        try
+        {
+            topicExpression =
+                evaluator.toTopicExpression(topic.getTopicPath());
+        }
+        catch(Exception e)
+        {
+            logger.debug("Failed to create topic expression from topic path",
+                         e);
+            throw new RuntimeException(e.getMessage());
+        }
+
+        this.supportedTopics.remove(topicExpression);
+
+        synchronized(this)
+        {
+            Iterator listenerIterator = this.listeners.iterator();
+            TopicListener listener;
+            while(listenerIterator.hasNext())
+            {
+                listener = (TopicListener) listenerIterator.next();
+                listener.topicRemoved(topic);
+            }
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopicListMetaData.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopicListMetaData.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SimpleTopicListMetaData.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,49 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import org.globus.wsrf.TopicListMetaData;
+
+/**
+ * Simple TopicList meta data.
+ */
+public class SimpleTopicListMetaData implements TopicListMetaData {
+
+    protected boolean fixed = false;
+
+    public SimpleTopicListMetaData() {
+        this(false);
+    }
+
+    public SimpleTopicListMetaData(boolean fixed) {
+        this.fixed = fixed;
+    }
+
+    /**
+     * Indicate whether the topic set is fixed or not
+     *
+     * @param fixed Boolean indicating whether the topic set is fixed or
+     *              not
+     */
+    protected void setFixedTopicSet(boolean fixed) {
+        this.fixed = fixed;
+    }
+
+    public boolean isTopicSetFixed() {
+        return this.fixed;
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SingletonResourceHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SingletonResourceHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/SingletonResourceHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,82 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import javax.xml.namespace.QName;
+
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.ResourceHome;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.RemoveNotSupportedException;
+
+/** 
+ * A <code>ResourceHome</code> that always returns a single resource object.
+ */
+public abstract class SingletonResourceHome implements ResourceHome {
+    
+    /**
+     * The resource object that we will return. Starts off null and is
+     * populated when the first find() call is made. 
+     */
+    private Resource singleResource = null;
+
+    public Class getKeyTypeClass() {
+        return null;
+    }
+
+    public QName getKeyTypeName() {
+        return null;
+    }
+
+    public Resource find(ResourceKey key) throws ResourceException {
+        if (key != null) {
+            throw new NoSuchResourceException();
+        }
+        synchronized(this) {
+            if (this.singleResource == null) {
+                // if we do not already have a value, call findSingleton()
+                // and then cache the result.
+                this.singleResource = findSingleton();
+                if (this.singleResource == null) {
+                    throw new NoSuchResourceException();
+                }
+            }
+        }
+        return this.singleResource;
+    }
+
+    /** 
+     * Always throws as an exception - not permitted to remove any key. 
+     */
+    public void remove(ResourceKey key) throws ResourceException {
+        throw new RemoveNotSupportedException();
+    }
+
+    /** 
+     * Finds the single resource to be associated with this resource home. 
+     * If this operation returns null a <code>NoSuchResourceException</code>
+     * will be raised. <br>
+     * If this method returns a non-null reference, then the reference will
+     * be cached, and findSingleton will not be called again. This allows, 
+     * for example, <code>findSingleton</code> to create a new resource
+     * object without needing to track whether it has been called previously.
+    */
+    protected abstract Resource findSingleton()
+        throws ResourceException;
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/TopicExpressionEngineImpl.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/TopicExpressionEngineImpl.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/TopicExpressionEngineImpl.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,242 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameClassPair;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.TopicList;
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.topicexpression.InvalidTopicExpressionException;
+import org.globus.wsrf.topicexpression.TopicExpressionEngine;
+import org.globus.wsrf.topicexpression.TopicExpressionResolutionException;
+import org.globus.wsrf.topicexpression.TopicExpressionEvaluator;
+import org.globus.wsrf.topicexpression.TopicExpressionException;
+import org.globus.wsrf.topicexpression.UnsupportedTopicExpressionDialectException;
+import org.globus.wsrf.jndi.JNDIUtils;
+import org.globus.wsrf.utils.Resources;
+import org.oasis.wsn.TopicExpressionType;
+
+/**
+ * Resolves topic expressions over topic lists.
+ * The engine looks for topic expression evaluators under
+ * "java:comp/env/topic/eval" context.
+ *
+ * @see TopicList
+ */
+public class TopicExpressionEngineImpl implements TopicExpressionEngine
+{
+    private static String TOPIC_EXPRESSION_EVALUATOR_CONTEXT =
+        Constants.JNDI_BASE_NAME + "/topic/eval";
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    static Log logger =
+        LogFactory.getLog(TopicExpressionEngineImpl.class.getName());
+
+    private Map evaluators = new HashMap();
+
+    public TopicExpressionEngineImpl()
+    {
+        this.refresh();
+    }
+
+    /**
+     * Get the default topic expression engine instance (currently used to hide
+     * JNDI lookup details, may change in the future)
+     *
+     * @return The default topic expression engine instance
+     */
+    public static TopicExpressionEngine getInstance()
+    {
+        Context context = null;
+        try
+        {
+            context = new InitialContext();
+            return (TopicExpressionEngine) context.lookup(
+                Constants.DEFAULT_TOPIC_EXPRESSION_ENGINE);
+        }
+        catch(NamingException e)
+        {
+            logger.error(i18n.getMessage("topicEngineConfigError"), e);
+        }
+        return null;
+    }
+
+    /**
+     * Refresh the set of registered topic expression evaluators using
+     * information discovered from the JNDI registry. This method removes any
+     * previously registered topic expression evaluators, so handle with care.
+     */
+    public synchronized void refresh()
+    {
+        this.evaluators.clear();
+        NamingEnumeration list = null;
+        try
+        {
+            Context context = new InitialContext();
+            list = context.list(TOPIC_EXPRESSION_EVALUATOR_CONTEXT);
+            NameClassPair pair = null;
+            TopicExpressionEvaluator evaluator = null;
+            while(list.hasMore())
+            {
+                pair = (NameClassPair) list.next();
+                evaluator = (TopicExpressionEvaluator) JNDIUtils.lookup(
+                    context,
+                    TOPIC_EXPRESSION_EVALUATOR_CONTEXT + "/" + pair.getName(),
+                    TopicExpressionEvaluator.class);
+                this.registerEvaluator(evaluator);
+            }
+        }
+        catch(NamingException e)
+        {
+            logger.error(i18n.getMessage("topicEngineInitError"), e);
+        }
+        finally
+        {
+            if(list != null)
+            {
+                try
+                {
+                    list.close();
+                }
+                catch(NamingException ee)
+                {
+                }
+            }
+        }
+    }
+
+    public synchronized void registerEvaluator(
+        TopicExpressionEvaluator evaluator)
+    {
+        logger.debug("Adding dialects for " + evaluator.getClass().getName());
+        String[] dialects = evaluator.getDialects();
+        for(int i = 0; i < dialects.length; i++)
+        {
+            logger.debug("Adding dialect: " + dialects[i]);
+            this.evaluators.put(dialects[i], evaluator);
+        }
+    }
+
+    public synchronized TopicExpressionEvaluator getEvaluator(String dialect)
+    {
+        TopicExpressionEvaluator evaluator =
+            (TopicExpressionEvaluator) this.evaluators.get(dialect);
+        return evaluator;
+    }
+
+    public synchronized Collection resolveTopicExpression(
+        TopicExpressionType topicExpression,
+        TopicList topicList)
+        throws UnsupportedTopicExpressionDialectException,
+               TopicExpressionResolutionException,
+               InvalidTopicExpressionException,
+               TopicExpressionException
+    {
+        if(topicExpression == null)
+        {
+            throw new InvalidTopicExpressionException(
+                i18n.getMessage("nullArgument", "topicExpression"));
+        }
+
+        if(topicExpression.getDialect() == null)
+        {
+            throw new UnsupportedTopicExpressionDialectException(
+                i18n.getMessage("nullArgument", "topicExpression.dialect"));
+        }
+
+        String dialect = topicExpression.getDialect().toString();
+        TopicExpressionEvaluator evaluator = this.getEvaluator(dialect);
+
+        if(evaluator == null)
+        {
+            if(logger.isDebugEnabled())
+            {
+                logger.debug("Dialect not supported:" + dialect);
+                logger.debug("Registered dialects are:");
+                Iterator keyIterator = this.evaluators.keySet().iterator();
+                Object key = null;
+                while(keyIterator.hasNext())
+                {
+                    key = keyIterator.next();
+                    logger.debug(key);
+                }
+                logger.debug(
+                    "key.equals(dialect): " + (key.equals(dialect.toString())));
+                logger.debug("this.evaluators.containsKey(dialect): " +
+                             this.evaluators.containsKey(dialect.toString()));
+                logger.debug(
+                    "HashCode of key: " + String.valueOf(key.hashCode()));
+                logger.debug("HashCode of dialect: " + String.valueOf(
+                    dialect.toString().hashCode()));
+                logger.debug(
+                    "Object stored for key: " + this.evaluators.get(key));
+            }
+            throw new UnsupportedTopicExpressionDialectException();
+        }
+        return evaluator.resolve(topicExpression, topicList);
+    }
+
+    public synchronized List getConcretePath(
+        TopicExpressionType topicExpression)
+        throws UnsupportedTopicExpressionDialectException,
+               TopicExpressionResolutionException,
+               InvalidTopicExpressionException,
+               TopicExpressionException
+    {
+        if(topicExpression == null)
+        {
+            throw new InvalidTopicExpressionException(
+                i18n.getMessage("nullArgument", "topicExpression"));
+        }
+
+        if(topicExpression.getDialect() == null)
+        {
+            throw new UnsupportedTopicExpressionDialectException(
+                i18n.getMessage("nullArgument", "topicExpression.dialect"));
+        }
+
+        String dialect = topicExpression.getDialect().toString();
+        TopicExpressionEvaluator evaluator = this.getEvaluator(dialect);
+
+        if(evaluator == null)
+        {
+            throw new UnsupportedTopicExpressionDialectException();
+        }
+
+        return evaluator.getConcreteTopicPath(topicExpression);
+    }
+
+    public synchronized String[] getSupportedDialects()
+    {
+        return (String[]) this.evaluators.keySet().toArray(
+            new String[this.evaluators.size()]);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/XPathExpressionEvaluator.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/XPathExpressionEvaluator.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/XPathExpressionEvaluator.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,220 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.message.Text;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.xpath.XPathAPI;
+import org.apache.xpath.objects.XBoolean;
+import org.apache.xpath.objects.XNodeSet;
+import org.apache.xpath.objects.XNumber;
+import org.apache.xpath.objects.XObject;
+import org.apache.xpath.objects.XString;
+
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.query.ExpressionEvaluator;
+import org.globus.wsrf.query.QueryException;
+import org.globus.wsrf.query.UnsupportedQueryDialectException;
+import org.globus.wsrf.query.QueryEvaluationException;
+import org.globus.wsrf.query.InvalidQueryExpressionException;
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.utils.XmlUtils;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.CharacterData;
+
+import org.oasis.wsrf.properties.QueryExpressionType;
+
+/**
+ * Evaluator supporting XPath queries using Xalan-J XPathAPI.
+ * The implementation creates resource property document on-fly and runs
+ * the query against it.
+ */
+public class XPathExpressionEvaluator implements ExpressionEvaluator {
+
+    static Log logger =
+        LogFactory.getLog(XPathExpressionEvaluator.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private static final String [] DIALECTS =
+        new String [] { WSRFConstants.XPATH_1_DIALECT };
+
+    public String[] getDialects() {
+        return DIALECTS;
+    }
+
+    public Object evaluate(QueryExpressionType expression,
+                           ResourcePropertySet resourcePropertySet)
+        throws UnsupportedQueryDialectException,
+               QueryEvaluationException,
+               InvalidQueryExpressionException,
+               QueryException {
+        try {
+            return evaluateQuery(expression, resourcePropertySet);
+        } catch (QueryException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new QueryEvaluationException(e);
+        }
+    }
+
+    private List evaluateQuery(QueryExpressionType expression,
+                               ResourcePropertySet resourcePropertySet)
+        throws Exception {
+        if (expression == null) {
+            throw new QueryException(i18n.getMessage("noQuery"));
+        }
+        if (expression.getDialect() == null) {
+            throw new QueryException(
+                i18n.getMessage("nullArgument", "expression.dialect")
+            );
+        }
+        String dialect = expression.getDialect().toString();
+        if (!(dialect.equals(WSRFConstants.XPATH_1_DIALECT))) {
+            throw new UnsupportedQueryDialectException(
+                i18n.getMessage("invalidQueryExpressionDialect"));
+        }
+
+        if (expression.getValue() == null ||
+            expression.getValue().toString().trim().length() == 0) {
+            throw new InvalidQueryExpressionException(
+                i18n.getMessage("noQueryString"));
+        }
+
+        // TODO: error checking?
+        String query = expression.getValue().toString().trim();
+
+        logger.debug("Query: " + query);
+
+        // Turn ResourcePropertySet into one big DOM element
+        Element rootElement = resourcePropertySet.toElement();
+
+        // collects all NS in the document and puts them in the root element
+        // that root element is then used for xpath query to resolve all
+        // namespaces defined in the xpath query.
+
+        // XXX: The namespaces should probably be somehow passed with the query
+        // this will require spec changes
+        Map namespaces = new HashMap();
+        collectNamespaces(rootElement, namespaces, new HashMap());
+        setNamespaces(rootElement, namespaces);
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("Document: " + XmlUtils.toString(rootElement));
+        }
+
+        XObject result = XPathAPI.eval(rootElement,
+                                       query,
+                                       rootElement);
+
+        ArrayList resultList = null;
+
+        if (result instanceof XBoolean ||
+            result instanceof XNumber ||
+            result instanceof XString) {
+            resultList = new ArrayList(1);
+            MessageElement element = 
+                new MessageElement(new Text( result.str() ));
+            resultList.add(element);
+        } else if (result instanceof XNodeSet) {
+            XNodeSet set = (XNodeSet)result;
+            NodeList list = set.nodelist();
+            resultList = new ArrayList(list.getLength());
+            for (int i=0;i<list.getLength();i++) {
+                Node node = list.item(i);
+                if (node instanceof Document) {
+                    resultList.add(new MessageElement(((Document)node).getDocumentElement()));
+                } else if (node instanceof Element) {
+                    resultList.add(new MessageElement((Element)node));
+                } else if (node instanceof CharacterData) {
+                    resultList.add(new MessageElement(new Text(((CharacterData)node).getData())));
+                } else {
+                    throw new QueryException(i18n.getMessage(
+                        "unsupportedXpathReturn", node.getClass().getName()));
+                }
+            }
+        } else {
+            throw new QueryException(i18n.getMessage(
+                "unsupportedXpathReturn", result));
+        }
+
+        return resultList;
+    }
+
+    private void collectNamespaces(Node node, Map namespaces, Map prefixes) {
+        NamedNodeMap attributes = node.getAttributes();
+        if (attributes != null) {
+            for (int i=0;i<attributes.getLength();i++) {
+                Attr attr = (Attr)attributes.item(i);
+                String name = attr.getName();
+                String value = attr.getValue();
+                if (name.startsWith("xmlns:")) {
+                    if (namespaces.get(value) == null) {
+                        // ns not defined
+                        if (prefixes.get(name) != null) {
+                            // find unique prefix
+                            int j = 1;
+                            do {
+                                name = "xmlns:ns" + j++;
+                            } while ( prefixes.get(name) != null);
+                        }
+                        prefixes.put(name, value);
+                        namespaces.put(value, name);
+                    }
+                }
+            }
+        }
+        NodeList children = node.getChildNodes();
+        if (children != null) {
+            for (int i=0;i<children.getLength();i++) {
+                Node child = children.item(i);
+                if (child.getNodeType() == Node.ELEMENT_NODE) {
+                    collectNamespaces(child, namespaces, prefixes);
+                }
+            }
+        }
+    }
+
+    private void setNamespaces(Element node, Map namespaces) {
+        Iterator iter = namespaces.entrySet().iterator();
+        while(iter.hasNext()) {
+            Map.Entry entry = (Map.Entry)iter.next();
+            node.setAttributeNS("http://www.w3.org/2000/xmlns/",
+                                (String)entry.getValue(),
+                                (String)entry.getKey());
+        }
+    }
+
+}
+

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/lifetime/DestroyProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/lifetime/DestroyProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/lifetime/DestroyProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,68 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.lifetime;
+
+import java.rmi.RemoteException;
+
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.ResourceHome;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.utils.FaultHelper;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+import org.oasis.wsrf.lifetime.ResourceNotDestroyedFaultType;
+import org.oasis.wsrf.lifetime.ResourceUnknownFaultType;
+import org.oasis.wsrf.lifetime.Destroy;
+import org.oasis.wsrf.lifetime.DestroyResponse;
+
+public class DestroyProvider {
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public DestroyResponse destroy(Destroy request)
+        throws RemoteException,
+               ResourceNotDestroyedFaultType,
+               ResourceUnknownFaultType {
+        try {
+            ResourceContext ctx = ResourceContext.getResourceContext();
+            ResourceHome home = ctx.getResourceHome();
+            ResourceKey key = ctx.getResourceKey();
+            home.remove(key);
+        } catch (NoSuchResourceException e) {
+            ResourceUnknownFaultType fault = new ResourceUnknownFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(
+                          i18n.getMessage("resourceRemoveFailed")
+            );
+            faultHelper.addFaultCause(e);
+            throw fault;
+        } catch (Exception e) {
+            ResourceNotDestroyedFaultType fault =
+                new ResourceNotDestroyedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(
+                          i18n.getMessage("resourceRemoveFailed")
+            );
+            faultHelper.addFaultCause(e);
+            throw fault;
+        }
+
+        return new DestroyResponse();
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/lifetime/SetTerminationTimeProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/lifetime/SetTerminationTimeProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/lifetime/SetTerminationTimeProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,168 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.lifetime;
+
+import java.rmi.RemoteException;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.ResourceHome;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.ResourceLifetime;
+import org.globus.wsrf.Topic;
+import org.globus.wsrf.TopicList;
+import org.globus.wsrf.TopicListAccessor;
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.utils.FaultHelper;
+import org.globus.wsrf.utils.Resources;
+
+import org.oasis.wsrf.lifetime.ResourceUnknownFaultType;
+import org.oasis.wsrf.lifetime.TerminationTimeChangeRejectedFaultType;
+import org.oasis.wsrf.lifetime.UnableToSetTerminationTimeFaultType;
+import org.oasis.wsrf.lifetime.SetTerminationTime;
+import org.oasis.wsrf.lifetime.SetTerminationTimeResponse;
+import org.oasis.wsrf.lifetime.TerminationNotification;
+
+/**
+ * SetTerminationTime operation implementation. The resource must provide
+ * TerminationTime resource property to use this provider.
+ */
+public class SetTerminationTimeProvider {
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+    private static Log logger =
+        LogFactory.getLog(SetTerminationTimeProvider.class.getName());
+
+    public SetTerminationTimeResponse setTerminationTime(SetTerminationTime request)
+        throws RemoteException,
+               UnableToSetTerminationTimeFaultType,
+               ResourceUnknownFaultType,
+               TerminationTimeChangeRejectedFaultType {
+
+        if (request == null) {
+            UnableToSetTerminationTimeFaultType fault =
+                new UnableToSetTerminationTimeFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(
+                          i18n.getMessage("nullArgument", "request")
+            );
+            throw fault;
+        }
+
+        Object resource = null;
+        ResourceHome home = null;
+        ResourceKey key = null;
+        try {
+            ResourceContext ctx = ResourceContext.getResourceContext();
+            home = ctx.getResourceHome();
+            key = ctx.getResourceKey();
+            resource = home.find(key);
+        } catch (NoSuchResourceException e) {
+            ResourceUnknownFaultType fault = new ResourceUnknownFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(
+                          i18n.getMessage("resourceDisoveryFailed")
+            );
+            faultHelper.addFaultCause(e);
+            throw fault;
+        } catch (Exception e) {
+            throw new RemoteException(
+                i18n.getMessage("resourceDisoveryFailed"), e);
+        }
+
+        if (!(resource instanceof ResourceLifetime)) {
+            UnableToSetTerminationTimeFaultType fault = 
+                new UnableToSetTerminationTimeFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(i18n.getMessage("rltNotSupported"));
+            throw fault;
+        }
+
+        Calendar termTime = request.getRequestedTerminationTime();
+
+        Calendar currentTime = Calendar.getInstance();
+        Calendar newTermTime = null;
+
+        // if termTime in the past - immediate destruction
+        if (termTime != null &&
+            termTime.getTime().before(currentTime.getTime())) {
+            try {
+                home.remove(key);
+            } catch (NoSuchResourceException e) {
+                ResourceUnknownFaultType fault =
+                    new ResourceUnknownFaultType();
+                FaultHelper faultHelper = new FaultHelper(fault);
+                faultHelper.addFaultCause(e);
+                throw fault;
+            } catch (Exception e) {
+                UnableToSetTerminationTimeFaultType fault =
+                    new UnableToSetTerminationTimeFaultType();
+                FaultHelper faultHelper = new FaultHelper(fault);
+                faultHelper.setDescription(
+                              i18n.getMessage("resourceRemoveFailed")
+                );
+                faultHelper.addFaultCause(e);
+                throw fault;
+            }
+            newTermTime = currentTime;
+        } else {
+            ((ResourceLifetime) resource).setTerminationTime(termTime);
+            newTermTime = termTime;
+        }
+
+        SetTerminationTimeResponse response =
+            new SetTerminationTimeResponse();
+
+        response.setCurrentTime(currentTime);
+        response.setNewTerminationTime(newTermTime);
+
+        return response;
+    }
+
+    // TODO: move the below somewhere else?
+    public static void sendTerminationNotification(Object resource,
+                                                   Calendar currentTime) {
+        if (resource instanceof TopicListAccessor) {
+            TopicList topicList;
+            List topicPath = new Vector();
+            topicPath.add(WSRFConstants.TERMINATION_TOPIC);
+            Topic terminationTopic;
+            TerminationNotification terminationNotification =
+                    new TerminationNotification();
+            // TODO: what do we put in the reason field?
+            terminationNotification.setTerminationTime(currentTime);
+            topicList = ((TopicListAccessor) resource).
+                    getTopicList();
+            terminationTopic = topicList.getTopic(topicPath);
+            if (terminationTopic != null) {
+                try {
+                    terminationTopic.notify(
+                            terminationNotification);
+                } catch(Exception e) {
+                    logger.error("", e);
+                }
+            }
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/ClientNotificationConsumerManager.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/ClientNotificationConsumerManager.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/ClientNotificationConsumerManager.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,103 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.config.ContainerConfig;
+import org.globus.wsrf.container.ContainerException;
+import org.globus.wsrf.container.ServiceContainer;
+
+public class ClientNotificationConsumerManager
+    extends NotificationConsumerManager {
+
+    static Log logger =
+        LogFactory.getLog(ClientNotificationConsumerManager.class.getName());
+
+    private ServiceContainer serviceContainer = null;
+    private Map properties = null;
+
+    protected static final String CLIENT_PROFILE = "client";
+    
+    public ClientNotificationConsumerManager() {
+        this(new HashMap());
+    }
+
+    public ClientNotificationConsumerManager(Map properties) {
+        this.properties = properties;
+        
+        // overwrite these?
+        this.properties.put(ServiceContainer.MAIN_THREAD,
+                            Boolean.FALSE);
+        this.properties.put(ContainerConfig.CONFIG_PROFILE,
+                            CLIENT_PROFILE);
+    }
+
+    /**
+     * Start the notification consumer service
+     *
+     * @throws ContainerException
+     */
+    public synchronized void startListening()
+        throws ContainerException {
+        if (this.serviceContainer != null) {
+            return;
+        }
+
+        serviceContainer = ServiceContainer.createContainer(this.properties);
+
+        // should have jndi context setup by now
+        if (this.notificationConsumerHome == null) {
+            initializeConsumerHome();
+        }
+    }
+
+    /**
+     * Stop the notification consumer service
+     *
+     * @throws ContainerException
+     */
+    public synchronized void stopListening()
+        throws ContainerException {
+        if (this.serviceContainer == null) {
+            return;
+        }
+        this.serviceContainer.stop();
+        this.serviceContainer = null;
+    }
+
+    /**
+     * Is the notification consumer service started?
+     *
+     * @return True if the notification consumer serivce is running, false if
+     *         not
+     */
+    public synchronized boolean isListening() {
+        return (this.serviceContainer != null);
+    }
+
+    public synchronized URL getURL() {
+        return (this.serviceContainer != null) ?
+            this.serviceContainer.getURL() : null;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/GetCurrentMessageProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/GetCurrentMessageProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/GetCurrentMessageProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,156 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.rmi.RemoteException;
+import java.util.Collection;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.Topic;
+import org.globus.wsrf.TopicList;
+import org.globus.wsrf.TopicListAccessor;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.topicexpression.UnsupportedTopicExpressionDialectException;
+import org.globus.wsrf.utils.AnyHelper;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.utils.FaultHelper;
+import org.globus.wsrf.encoding.ObjectSerializer;
+import org.globus.util.I18n;
+
+import org.oasis.wsn.InvalidTopicExpressionFaultType;
+import org.oasis.wsn.NoCurrentMessageOnTopicFaultType;
+import org.oasis.wsn.ResourceUnknownFaultType;
+import org.oasis.wsn.TopicNotSupportedFaultType;
+import org.oasis.wsn.GetCurrentMessage;
+import org.oasis.wsn.GetCurrentMessageResponse;
+import org.oasis.wsn.TopicPathDialectUnknownFaultType;
+
+public class GetCurrentMessageProvider
+{
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private static Log logger =
+        LogFactory.getLog(GetCurrentMessageProvider.class.getName());
+
+    /**
+     * Provider for the get current message operation
+     *
+     * @param request
+     * @return The current message associated with the Topic
+     * @throws RemoteException
+     * @throws ResourceUnknownFaultType
+     * @throws InvalidTopicExpressionFaultType
+     *
+     * @throws TopicNotSupportedFaultType
+     * @throws NoCurrentMessageOnTopicFaultType
+     *
+     */
+    public GetCurrentMessageResponse
+        getCurrentMessage(GetCurrentMessage request)
+        throws RemoteException,
+               ResourceUnknownFaultType,
+               InvalidTopicExpressionFaultType,
+               TopicNotSupportedFaultType,
+               NoCurrentMessageOnTopicFaultType
+    {
+        Object resource = null;
+        try
+        {
+            resource = ResourceContext.getResourceContext().getResource();
+        }
+        catch (NoSuchResourceException e)
+        {
+            ResourceUnknownFaultType fault = new ResourceUnknownFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(
+                          i18n.getMessage("resourceDisoveryFailed")
+            );
+            faultHelper.addFaultCause(e);
+            throw fault;
+        }
+        catch(Exception e)
+        {
+            throw new RemoteException(
+                i18n.getMessage("resourceDisoveryFailed"), e);
+        }
+
+        if(!(resource instanceof TopicListAccessor))
+        {
+            throw new TopicNotSupportedFaultType();
+        }
+
+        TopicList topicList;
+        Collection topics;
+        Object message;
+        topicList = ((TopicListAccessor) resource).getTopicList();
+
+        try
+        {
+            topics = topicList.getTopics(request.getTopic());
+        }
+        catch(UnsupportedTopicExpressionDialectException e)
+        {
+            logger.debug("", e);
+            TopicPathDialectUnknownFaultType fault =
+                new TopicPathDialectUnknownFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            throw fault;
+        }
+        catch(Exception e)
+        {
+            logger.debug("", e);
+            InvalidTopicExpressionFaultType fault =
+                new InvalidTopicExpressionFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            faultHelper.setDescription(
+                          i18n.getMessage("topicExpressionResolutionFailed")
+            );
+            throw fault;
+        }
+
+        if(topics.isEmpty())
+        {
+            throw new TopicNotSupportedFaultType();
+        }
+
+        message = ((Topic) (topics.toArray())[0]).getCurrentMessage();
+
+        if(message == null)
+        {
+            throw new NoCurrentMessageOnTopicFaultType();
+        }
+
+        GetCurrentMessageResponse response = new GetCurrentMessageResponse();
+
+        try
+        {
+            AnyHelper.setAny(response,
+                             ObjectSerializer.toSOAPElement(message));
+        }
+        catch(Exception e)
+        {
+            throw new RemoteException(
+                i18n.getMessage("notificationSerializationError"), e);
+        }
+
+        return response;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/NotificationConsumerHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/NotificationConsumerHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/NotificationConsumerHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,49 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.NotificationConsumerCallbackManager;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.impl.NotificationConsumerCallbackManagerImpl;
+import org.globus.wsrf.impl.ResourceHomeImpl;
+import org.globus.wsrf.impl.SimpleResourceKey;
+import org.globus.wsrf.impl.security.descriptor.ResourceSecurityDescriptor;
+
+public class NotificationConsumerHome extends ResourceHomeImpl
+{
+    static Log logger =
+        LogFactory.getLog(NotificationConsumerHome.class.getName());
+
+    public ResourceKey create()
+    {
+        return create(null);
+    }
+
+    public ResourceKey create(ResourceSecurityDescriptor desc)
+    {
+        NotificationConsumerCallbackManager consumerResource =
+            new NotificationConsumerCallbackManagerImpl(desc);
+        ResourceKey key = new SimpleResourceKey(
+            keyTypeName,
+            String.valueOf(consumerResource.hashCode()));
+        this.add(key, consumerResource);
+        return key;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/NotificationConsumerProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/NotificationConsumerProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/NotificationConsumerProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,143 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.rmi.RemoteException;
+import java.util.List;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.NotificationConsumerCallbackManager;
+import org.globus.wsrf.NotifyCallback;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.topicexpression.TopicExpressionEngine;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.utils.AnyHelper;
+import org.globus.wsrf.impl.TopicExpressionEngineImpl;
+import org.globus.util.I18n;
+
+import org.oasis.wsn.ResourceUnknownFaultType;
+import org.oasis.wsn.NotificationMessageHolderType;
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.Notify;
+
+public class NotificationConsumerProvider
+{
+    static Log logger =
+        LogFactory.getLog(NotificationConsumerProvider.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    /**
+     * Provider for the notify operation, ie. the notification consumer
+     * porttype.
+     *
+     * @param request
+     * @throws RemoteException
+     */
+    public void notify(Notify request) throws RemoteException
+    {
+        NotificationMessageHolderType[] notifications =
+            request.getNotificationMessage();
+        TopicExpressionType topicExpression;
+        EndpointReferenceType producer;
+        List topicPath;
+        Object message;
+        NotifyCallback callback;
+        NotifyCallback defaultCallback;
+
+        Object resource = null;
+        try
+        {
+            resource = ResourceContext.getResourceContext().getResource();
+        }
+        catch (NoSuchResourceException e)
+        {
+            throw new ResourceUnknownFaultType();
+        }
+        catch(Exception e)
+        {
+            throw new RemoteException(
+                i18n.getMessage("resourceDisoveryFailed"), e);
+        }
+
+        NotificationConsumerCallbackManager manager =
+            (NotificationConsumerCallbackManager) resource;
+
+        TopicExpressionEngine topicExpressionEngine =
+            TopicExpressionEngineImpl.getInstance();
+        defaultCallback = manager.getCallback(null);
+
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(
+                "Invoked with " +
+                String.valueOf(notifications.length) + " notification message(s)");
+        }
+
+        for(int i = 0; i < notifications.length; i++)
+        {
+            topicExpression = notifications[i].getTopic();
+            producer = notifications[i].getProducerReference();
+            message = notifications[i].getMessage();
+
+            try
+            {
+                topicPath = topicExpressionEngine.getConcretePath(
+                    topicExpression);
+                callback = manager.getCallback(topicPath);
+
+                if(callback == null)
+                {
+                    callback = defaultCallback;
+                }
+
+                if(callback != null)
+                {
+                    callback.deliver(topicPath,
+                                     producer,
+                                     message);
+                }
+
+                if(logger.isDebugEnabled())
+                {
+                    logger.debug("Got notification on topic: " +
+                                 topicExpression.toString());
+                    logger.debug(
+                        "With dialect " + topicExpression.getDialect().toString());
+                    logger.debug("From producer at " + producer.getAddress());
+                    if(producer.getProperties() != null &&
+                       producer.getProperties().get_any() != null)
+                    {
+                        String value =
+                            AnyHelper.toSingleString(producer.getProperties());
+                        logger.debug("With resource ids " + value);
+                    }
+                    logger.debug("Notification message: " + message);
+                }
+            }
+            catch(Exception e)
+            {
+                throw new RemoteException(
+                    i18n.getMessage("notifyCallbackError"), e);
+            }
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/PauseSubscriptionProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/PauseSubscriptionProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/PauseSubscriptionProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,90 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.rmi.RemoteException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.Subscription;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.utils.FaultHelper;
+import org.globus.util.I18n;
+
+import org.oasis.wsn.PauseFailedFaultType;
+import org.oasis.wsn.ResourceUnknownFaultType;
+import org.oasis.wsn.PauseSubscriptionResponse;
+import org.oasis.wsn.PauseSubscription;
+
+public class PauseSubscriptionProvider
+{
+    static Log logger =
+        LogFactory.getLog(PauseSubscriptionProvider.class.getName());
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    /**
+     * Provider for the pause operation of the subscription manager porttype
+     *
+     * @param request
+     * @return null
+     * @throws RemoteException
+     * @throws ResourceUnknownFaultType
+     * @throws PauseFailedFaultType
+     */
+    public PauseSubscriptionResponse pauseSubscription(PauseSubscription request)
+        throws RemoteException,
+               ResourceUnknownFaultType,
+               PauseFailedFaultType
+    {
+        Object resource = null;
+        try
+        {
+            resource = ResourceContext.getResourceContext().getResource();
+        }
+        catch (NoSuchResourceException e)
+        {
+            ResourceUnknownFaultType fault = new ResourceUnknownFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(
+                          i18n.getMessage("resourceDisoveryFailed")
+            );
+            faultHelper.addFaultCause(e);
+            throw fault;
+        }
+        catch(Exception e)
+        {
+            throw new RemoteException(
+                i18n.getMessage("resourceDisoveryFailed"), e);
+        }
+
+        try
+        {
+            ((Subscription) resource).pause();
+        }
+        catch(Exception e)
+        {
+            PauseFailedFaultType fault = new PauseFailedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            throw fault;
+        }
+
+        return new PauseSubscriptionResponse();
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/PersistentSubscription.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/PersistentSubscription.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/PersistentSubscription.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,258 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectOutputStream;
+import java.util.Calendar;
+
+import org.globus.wsrf.impl.security.util.FixedObjectInputStream;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsrf.properties.QueryExpressionType;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.InvalidResourceKeyException;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.PersistenceCallback;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.impl.security.descriptor.ClientSecurityDescriptor;
+import org.globus.wsrf.impl.security.descriptor.ResourceSecurityDescriptor;
+import org.globus.wsrf.utils.FilePersistenceHelper;
+import org.globus.wsrf.utils.Resources;
+
+public class PersistentSubscription extends SimpleSubscription
+    implements PersistenceCallback
+{
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+    private transient FilePersistenceHelper persistenceHelper;
+    private static final String FILE_SUFFIX = ".obj";
+
+    public PersistentSubscription()
+    {
+        super();
+    }
+
+    public PersistentSubscription(
+        EndpointReferenceType consumerReference,
+        EndpointReferenceType producerReference,
+        Calendar initialTerminationTime, Object policy,
+        QueryExpressionType precondition,
+        QueryExpressionType selector, ResourceKey producerKey,
+        String producerHomeLocation,
+        TopicExpressionType topicExpression, boolean isPaused,
+        boolean useNotify,
+        ClientSecurityDescriptor notificationSecurityDescriptor,
+        ResourceSecurityDescriptor resourceSecurityDescriptor)
+    {
+        super(consumerReference, producerReference, initialTerminationTime,
+              policy, precondition, selector, producerKey,
+              producerHomeLocation, topicExpression, isPaused, useNotify,
+              notificationSecurityDescriptor, resourceSecurityDescriptor);
+    }
+
+    public void load(ResourceKey key) throws ResourceException,
+                                             NoSuchResourceException,
+                                             InvalidResourceKeyException
+    {
+        File file = getKeyAsFile(key.getValue());
+        if(!file.exists())
+        {
+            throw new NoSuchResourceException(key.toString());
+        }
+        FileInputStream fis = null;
+        try
+        {
+            fis = new FileInputStream(file);
+            FixedObjectInputStream ois = new FixedObjectInputStream(fis);
+            this.consumerReference = (EndpointReferenceType) ois.readObject();
+            this.producerReference = (EndpointReferenceType) ois.readObject();
+            this.policy = ois.readObject();
+            this.precondition = (QueryExpressionType) ois.readObject();
+            this.selector = (QueryExpressionType) ois.readObject();
+            this.producerKey = (ResourceKey) ois.readObject();
+            this.producerHomeLocation = (String) ois.readObject();
+            this.topicExpression = (TopicExpressionType) ois.readObject();
+            this.isPaused = ois.readBoolean();
+            this.useNotify = ois.readBoolean();
+            this.terminationTime = (Calendar) ois.readObject();
+            this.creationTime = (Calendar) ois.readObject();
+            this.securityDescriptor = (ClientSecurityDescriptor)
+                ois.readObject();
+            this.resourceSecurityDescriptor = (ResourceSecurityDescriptor)
+                ois.readObject();
+            this.creationTime = (Calendar) ois.readObject();
+            this.id = (String) ois.readObject();
+        }
+        catch(Exception e)
+        {
+            String errorMessage = i18n.getMessage("resourceLoadFailed");
+            throw new ResourceException(errorMessage, e);
+        }
+        finally
+        {
+            if(fis != null)
+            {
+                try
+                {
+                    fis.close();
+                }
+                catch(Exception ee)
+                {
+                }
+            }
+        }
+    }
+
+    public synchronized void store() throws ResourceException
+    {
+        FileOutputStream fos = null;
+        File tmpFile = null;
+        try
+        {
+            tmpFile = File.createTempFile(
+                "subscription", ".tmp",
+                getPersistenceHelper().getStorageDirectory());
+            fos = new FileOutputStream(tmpFile);
+            ObjectOutputStream oos = new ObjectOutputStream(fos);
+            oos.writeObject(this.consumerReference);
+            oos.writeObject(this.producerReference);
+            oos.writeObject(this.policy);
+            oos.writeObject(this.precondition);
+            oos.writeObject(this.selector);
+            oos.writeObject(this.producerKey);
+            oos.writeObject(this.producerHomeLocation);
+            oos.writeObject(this.topicExpression);
+            oos.writeBoolean(this.isPaused);
+            oos.writeBoolean(this.useNotify);
+            oos.writeObject(this.terminationTime);
+            oos.writeObject(this.creationTime);
+            oos.writeObject(this.securityDescriptor);
+            oos.writeObject(this.resourceSecurityDescriptor);
+            oos.writeObject(this.creationTime);
+            oos.writeObject(this.id);
+        }
+        catch(Exception e)
+        {
+            tmpFile.delete();
+            String errorMessage = i18n.getMessage("resourceStoreFailed");
+            throw new ResourceException(errorMessage, e);
+        }
+        finally
+        {
+            if(fos != null)
+            {
+                try
+                {
+                    fos.close();
+                }
+                catch(Exception ee)
+                {
+                }
+            }
+        }
+
+        File file = getKeyAsFile(this.id);
+        if (file.exists()) {
+            file.delete();
+        }
+        if (!tmpFile.renameTo(file)) {
+            tmpFile.delete();
+            throw new ResourceException(
+                i18n.getMessage("resourceStoreFailed"));
+        }
+    }
+
+    private File getKeyAsFile(Object key)
+        throws InvalidResourceKeyException
+    {
+        if(key instanceof String)
+        {
+            return getPersistenceHelper().getKeyAsFile(key);
+        }
+        else
+        {
+            throw new InvalidResourceKeyException();
+        }
+    }
+
+    public void remove() throws ResourceException
+    {
+        super.remove();
+        getPersistenceHelper().remove(this.id);
+    }
+
+    protected synchronized FilePersistenceHelper getPersistenceHelper()
+    {
+        if(this.persistenceHelper == null)
+        {
+            try
+            {
+                this.persistenceHelper = new FilePersistenceHelper(getClass(),
+                                                                   FILE_SUFFIX);
+            }
+            catch(Exception e)
+            {
+                throw new RuntimeException(e.getMessage());
+            }
+        }
+        return this.persistenceHelper;
+    }
+
+    public void setTerminationTime(Calendar time)
+    {
+        super.setTerminationTime(time);
+        try
+        {
+            this.store();
+        }
+        catch(Exception e)
+        {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+    public void pause() throws Exception
+    {
+        super.pause();
+        try
+        {
+            this.store();
+        }
+        catch(Exception e)
+        {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+    public void resume() throws Exception
+    {
+        super.resume();
+        try
+        {
+            this.store();
+        }
+        catch(Exception e)
+        {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/ResumeSubscriptionProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/ResumeSubscriptionProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/ResumeSubscriptionProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,91 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.rmi.RemoteException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.Subscription;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.utils.FaultHelper;
+import org.globus.util.I18n;
+
+import org.oasis.wsn.ResourceUnknownFaultType;
+import org.oasis.wsn.ResumeFailedFaultType;
+import org.oasis.wsn.ResumeSubscription;
+import org.oasis.wsn.ResumeSubscriptionResponse;
+
+public class ResumeSubscriptionProvider
+{
+    static Log logger =
+        LogFactory.getLog(ResumeSubscriptionProvider.class.getName());
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    /**
+     * Provider for the resume operation of the subscription manager porttype
+     *
+     * @param request
+     * @return null
+     * @throws RemoteException
+     * @throws ResourceUnknownFaultType
+     * @throws ResumeFailedFaultType
+     */
+    public ResumeSubscriptionResponse resumeSubscription(ResumeSubscription request)
+        throws RemoteException,
+               ResourceUnknownFaultType,
+               ResumeFailedFaultType
+    {
+        Object resource = null;
+        try
+        {
+            resource = ResourceContext.getResourceContext().getResource();
+        }
+        catch(NoSuchResourceException e)
+        {
+            ResourceUnknownFaultType fault = new ResourceUnknownFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(
+                          i18n.getMessage("resourceDisoveryFailed")
+            );
+            faultHelper.addFaultCause(e);
+            throw fault;
+        }
+        catch(Exception e)
+        {
+            throw new RemoteException(
+                i18n.getMessage("resourceDisoveryFailed"), e);
+        }
+
+        try
+        {
+            // FIXME: cast
+            ((Subscription) resource).resume();
+        }
+        catch(Exception e)
+        {
+            ResumeFailedFaultType fault = new ResumeFailedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            throw fault;
+        }
+
+        return new ResumeSubscriptionResponse();
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/ServerNotificationConsumerManager.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/ServerNotificationConsumerManager.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/ServerNotificationConsumerManager.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,80 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.net.URL;
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.container.ServiceHost;
+import org.globus.wsrf.container.ContainerException;
+
+public class ServerNotificationConsumerManager
+    extends NotificationConsumerManager {
+
+    static Log logger =
+        LogFactory.getLog(ServerNotificationConsumerManager.class.getName());
+
+    private URL url;
+
+    public ServerNotificationConsumerManager() {
+        try {
+            this.url = ServiceHost.getBaseURL();
+        } catch (IOException e) {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+    private synchronized void initialize() throws ContainerException {
+        if (this.notificationConsumerHome == null) {
+            initializeConsumerHome();
+        }
+    }
+
+    /**
+     * Start the notification consumer service. Noop.
+     *
+     * @throws ContainerException
+     */
+    public void startListening() throws ContainerException {
+        initialize();
+    }
+
+    /**
+     * Stop the notification consumer service. Noop.
+     *
+     * @throws ContainerException
+     */
+    public void stopListening() throws ContainerException {}
+
+    /**
+     * Returns if the notification consumer service is running.
+     *
+     * @return always <code>true</code>.
+     *
+     */
+    public boolean isListening() {
+        return true;
+    }
+
+    public URL getURL() {
+        return this.url;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SimpleSubscription.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SimpleSubscription.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SimpleSubscription.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,387 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.components.uuid.UUIDGen;
+import org.apache.axis.components.uuid.UUIDGenFactory;
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsrf.properties.QueryExpressionType;
+
+import org.globus.wsrf.RemoveCallback;
+import org.globus.wsrf.PersistenceCallback;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.ResourceHome;
+import org.globus.wsrf.ResourceIdentifier;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.ResourceLifetime;
+import org.globus.wsrf.ResourceProperties;
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.Subscription;
+import org.globus.wsrf.TopicList;
+import org.globus.wsrf.TopicListAccessor;
+import org.globus.wsrf.TopicListener;
+import org.globus.wsrf.TopicListenerList;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.impl.ReflectionResourceProperty;
+import org.globus.wsrf.impl.SimpleResourcePropertyMetaData;
+import org.globus.wsrf.impl.SimpleResourcePropertySet;
+import org.globus.wsrf.impl.SimpleSubscriptionTopicListener;
+import org.globus.wsrf.impl.security.descriptor.ClientSecurityDescriptor;
+import org.globus.wsrf.impl.security.descriptor.ResourceSecurityDescriptor;
+import org.globus.wsrf.security.SecureResource;
+
+/**
+ * Simple in-memory implementation of a subscription resource
+ */
+public class SimpleSubscription implements Subscription,
+                                           ResourceProperties,
+                                           ResourceIdentifier,
+                                           ResourceLifetime,
+                                           RemoveCallback,
+                                           SecureResource,
+                                           Serializable
+{
+    static Log logger =
+        LogFactory.getLog(SimpleSubscription.class.getName());
+    public static final QName RP_SET =
+        new QName(WSNConstants.BASEN_NS,
+                  "SubscriptionManagerRP");
+
+    protected EndpointReferenceType consumerReference;
+    protected EndpointReferenceType producerReference;
+    protected Object policy;
+    protected QueryExpressionType precondition;
+    protected QueryExpressionType selector;
+    protected ResourceKey producerKey;
+    protected String producerHomeLocation;
+    protected TopicExpressionType topicExpression;
+    protected boolean isPaused;
+    protected boolean useNotify;
+    protected Calendar terminationTime;
+    protected Calendar creationTime;
+    protected ClientSecurityDescriptor securityDescriptor;
+    protected String id = null;
+    protected ResourceSecurityDescriptor resourceSecurityDescriptor;
+
+    transient private ResourcePropertySet propertySet;
+
+    private static final UUIDGen uuidGen =
+        UUIDGenFactory.getUUIDGen();
+
+    public ResourcePropertySet getResourcePropertySet()
+    {
+        return this.propertySet;
+    }
+
+    public void setTerminationTime(Calendar time)
+    {
+        this.terminationTime = time;
+    }
+
+    public Calendar getTerminationTime()
+    {
+        return this.terminationTime;
+    }
+
+    public Calendar getCurrentTime()
+    {
+        return Calendar.getInstance();
+    }
+
+    public Calendar getCreationTime()
+    {
+        return this.creationTime;
+    }
+
+    public EndpointReferenceType getConsumerReference()
+    {
+        return this.consumerReference;
+    }
+
+    public Object getSubscriptionPolicy()
+    {
+        return this.policy;
+    }
+
+    public QueryExpressionType getPrecondition()
+    {
+        return this.precondition;
+    }
+
+    public EndpointReferenceType getProducerReference()
+    {
+        return this.producerReference;
+    }
+
+    public Object getResource() throws Exception
+    {
+        Context initialContext = new InitialContext();
+        ResourceHome producerHome = (ResourceHome) initialContext.lookup(
+            this.producerHomeLocation);
+        return producerHome.find(this.producerKey);
+    }
+
+    public QueryExpressionType getSelector()
+    {
+        return this.selector;
+    }
+
+    public TopicExpressionType getTopicExpression()
+    {
+        return topicExpression;
+    }
+
+    public boolean isPaused()
+    {
+        return this.isPaused;
+    }
+
+    public void pause() throws Exception
+    {
+        this.isPaused = true;
+    }
+
+    public void resume() throws Exception
+    {
+        this.isPaused = false;
+    }
+
+    public boolean getUseNotify()
+    {
+        return this.useNotify;
+    }
+
+    public ClientSecurityDescriptor getSecurityProperties()
+    {
+        return this.securityDescriptor;
+    }
+
+
+    public SimpleSubscription()
+    {
+        this(null, null, null, null, null, null,
+             null, null, null, false, true, null, null);
+    }
+
+    /**
+     * Construct a new subscription resource.
+     *
+     * @param consumerReference              The WS-Addressing endpoint
+     *                                       reference of the consumer
+     * @param producerReference              The WS-Addressing endpoint
+     *                                       reference of the producer
+     * @param initialTerminationTime         The initial termination time of
+     *                                       this resource
+     * @param policy                         The subscription policy
+     * @param precondition                   The precondition
+     * @param selector                       The selector
+     * @param producerKey                    The key of the producer resource
+     * @param producerHomeLocation           The JNDI location of the home of
+     *                                       the producer resource
+     * @param topicExpression                The topic expression for this
+     *                                       subscription
+     * @param isPaused                       The initial pause/resume state
+     * @param useNotify                      Whether to use raw notifications or
+     *                                       not.
+     * @param notificationSecurityDescriptor Security settings for notify
+     * @param resourceSecurityDescriptor     Security settings for this
+     *                                       subscription resource
+     */
+    public SimpleSubscription(
+        EndpointReferenceType consumerReference,
+        EndpointReferenceType producerReference,
+        Calendar initialTerminationTime,
+        Object policy,
+        QueryExpressionType precondition,
+        QueryExpressionType selector,
+        ResourceKey producerKey,
+        String producerHomeLocation,
+        TopicExpressionType topicExpression,
+        boolean isPaused,
+        boolean useNotify,
+        ClientSecurityDescriptor notificationSecurityDescriptor,
+        ResourceSecurityDescriptor resourceSecurityDescriptor)
+    {
+        this.id = uuidGen.nextUUID();
+        this.terminationTime = initialTerminationTime;
+        this.consumerReference = consumerReference;
+        this.producerReference = producerReference;
+        this.policy = policy;
+        this.precondition = precondition;
+        this.selector = selector;
+        this.producerKey = producerKey;
+        this.producerHomeLocation = producerHomeLocation;
+        this.topicExpression = topicExpression;
+        this.isPaused = isPaused;
+        this.useNotify = useNotify;
+        this.creationTime = Calendar.getInstance();
+        this.securityDescriptor = notificationSecurityDescriptor;
+        this.propertySet = new SimpleResourcePropertySet(RP_SET);
+        this.resourceSecurityDescriptor = resourceSecurityDescriptor;
+        ResourceProperty property = null;
+
+        if(this.consumerReference != null &&
+           this.consumerReference.getAddress().
+            getScheme().equalsIgnoreCase("https") &&
+           this.securityDescriptor == null)
+        {
+            this.securityDescriptor = new ClientSecurityDescriptor();
+        }
+
+        try
+        {
+            property = new ReflectionResourceProperty(
+                             SimpleResourcePropertyMetaData.TERMINATION_TIME,
+                             this);
+            this.propertySet.add(property);
+            property = new ReflectionResourceProperty(
+                             SimpleResourcePropertyMetaData.CURRENT_TIME,
+                             this);
+            this.propertySet.add(property);
+            property =
+                new ReflectionResourceProperty(WSNConstants.CREATION_TIME,
+                                               this);
+            this.propertySet.add(property);
+            property =
+                new ReflectionResourceProperty(WSNConstants.USE_NOTIFY,
+                                               this);
+            this.propertySet.add(property);
+            property =
+                new ReflectionResourceProperty(WSNConstants.CONSUMER_REFERENCE,
+                                               this);
+            this.propertySet.add(property);
+            property =
+                new ReflectionResourceProperty(WSNConstants.PRECONDITION,
+                                               this);
+            this.propertySet.add(property);
+            property =
+                new ReflectionResourceProperty(WSNConstants.SELECTOR,
+                                               this);
+            this.propertySet.add(property);
+            property =
+                new ReflectionResourceProperty(WSNConstants.SUBSCRIPTION_POLICY,
+                                               this);
+            this.propertySet.add(property);
+            property =
+                new ReflectionResourceProperty(WSNConstants.TOPIC_EXPRESSION,
+                                               this);
+            this.propertySet.add(property);
+        }
+        catch(Exception e)
+        {
+            logger.debug("Failed to set up resource properties", e);
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+    public Object getID()
+    {
+        return this.id;
+    }
+
+    public void remove() throws ResourceException
+    {
+        Object resource = null;
+        try
+        {
+            resource = getResource();
+        }
+        catch(Exception e)
+        {
+            throw new ResourceException("", e);
+        }
+
+        if (!(resource instanceof TopicListAccessor))
+        {
+            return;
+        }
+
+        TopicList topicList = ((TopicListAccessor)resource).getTopicList();
+        Collection topics = null;
+        try
+        {
+            topics = topicList.getTopics(this.topicExpression);
+        }
+        catch(Exception e)
+        {
+            throw new ResourceException("", e);
+        }
+
+        synchronized(resource) {
+            boolean removed = removeListener(topics);
+            if (removed && resource instanceof PersistenceCallback) {
+                ((PersistenceCallback)resource).store();
+            }
+        }
+    }
+
+    private boolean removeListener(Collection topics) {
+        boolean removed = false;
+
+        Iterator topicIterator = topics.iterator();
+        TopicListenerList topicListenerList;
+        Iterator topicListenerIterator;
+        TopicListener listener;
+
+        while(topicIterator.hasNext())
+        {
+            topicListenerList = (TopicListenerList) topicIterator.next();
+            synchronized(topicListenerList)
+            {
+                topicListenerIterator =
+                    topicListenerList.topicListenerIterator();
+                while(topicListenerIterator.hasNext())
+                {
+                    listener = (TopicListener)topicListenerIterator.next();
+                    if (listener instanceof SimpleSubscriptionTopicListener)
+                    {
+                        SimpleSubscriptionTopicListener lt =
+                            (SimpleSubscriptionTopicListener)listener;
+                        Object subKey =
+                            lt.getSubscriptionResourceKey().getValue();
+                        if (subKey.equals(this.id))
+                        {
+                            topicListenerIterator.remove();
+                            removed = true;
+                        }
+                    }
+                }
+            }
+        }
+
+        return removed;
+    }
+
+    public ResourceSecurityDescriptor getSecurityDescriptor()
+    {
+        return this.resourceSecurityDescriptor;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscribeHelper.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscribeHelper.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscribeHelper.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,654 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.security.auth.Subject;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.oasis.wsn.InvalidTopicExpressionFaultType;
+import org.oasis.wsn.SubscribeCreationFailedFaultType;
+import org.oasis.wsn.TopicNotSupportedFaultType;
+import org.oasis.wsn.TopicPathDialectUnknownFaultType;
+import org.oasis.wsn.Subscribe;
+
+import org.ietf.jgss.GSSCredential;
+
+import org.globus.gsi.jaas.JaasSubject;
+import org.globus.security.gridmap.GridMap;
+import org.globus.util.I18n;
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.PersistenceCallback;
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.Topic;
+import org.globus.wsrf.TopicList;
+import org.globus.wsrf.TopicListAccessor;
+import org.globus.wsrf.TopicListenerList;
+import org.globus.wsrf.config.ConfigException;
+import org.globus.wsrf.container.ServiceHost;
+import org.globus.wsrf.impl.SimpleSubscriptionTopicListener;
+import org.globus.wsrf.impl.security.authorization.Authorization;
+import org.globus.wsrf.impl.security.descriptor.ClientSecurityDescriptor;
+import org.globus.wsrf.impl.security.descriptor.ContainerSecurityConfig;
+import org.globus.wsrf.impl.security.descriptor.ContainerSecurityDescriptor;
+import org.globus.wsrf.impl.security.descriptor.ResourceSecurityDescriptor;
+import org.globus.wsrf.impl.security.descriptor.SecurityDescriptorException;
+import org.globus.wsrf.impl.security.descriptor.ServiceSecurityConfig;
+import org.globus.wsrf.impl.security.descriptor.ServiceSecurityDescriptor;
+import org.globus.wsrf.security.SecureResource;
+import org.globus.wsrf.security.SecurityException;
+import org.globus.wsrf.security.SecurityManager;
+import org.globus.wsrf.topicexpression.UnsupportedTopicExpressionDialectException;
+import org.globus.wsrf.utils.AddressingUtils;
+import org.globus.wsrf.utils.FaultHelper;
+import org.globus.wsrf.utils.Resources;
+
+/**
+ * Helper class to allow callers outside of SubscribeProvider to generate
+ * new subscriptions.
+ */
+public class SubscribeHelper
+{
+    private static Log logger =
+        LogFactory.getLog(SubscribeHelper.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private ResourceContext context;
+    private Resource producerResource;
+    private ResourceKey producerKey;
+    private String producerHomeLocation;
+    private String subscriptionManager;
+    private Subscribe request;
+    private SecurityManager securityManager;
+    private ContainerSecurityConfig containerSecurityConfig = null;
+
+    /**
+     * Constructor
+     *
+     * @param context              The resource context of caller. Used to
+     *                             detect security settings on the subscription
+     *                             resource as well as notifications
+     * @param producerResource     The producer resource
+     * @param producerKey          The key for the producer resource
+     * @param producerHomeLocation The location (JNDI) of the producer resource
+     *                             home
+     * @param request              The subscribe request
+     */
+    public SubscribeHelper(
+        ResourceContext context, Resource producerResource,
+        ResourceKey producerKey, String producerHomeLocation,
+        Subscribe request)
+    {
+        this.context = context;
+        this.producerResource = producerResource;
+        this.producerKey = producerKey;
+        this.producerHomeLocation = producerHomeLocation;
+        this.subscriptionManager = getSubscriptionManagerServiceName();
+        this.request = request;
+        this.securityManager = SecurityManager.getManager();
+        try
+        {
+            this.containerSecurityConfig = ContainerSecurityConfig.getConfig();
+        }
+        catch(ConfigException e)
+        {
+            logger.debug("Error trying to get container security config", e);
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+    /**
+     * Create a new subscription. This method creates a new subscription based
+     * on the information passed in the constructor. If this method is called
+     * with a resource context created by a secure invocation the subscribe call
+     * will set up the security of the subscription resource to require the same
+     * authentication methods as the invocation and gridmap authorization with
+     * the caller of the invoked method as the only allowed user. Furthermore,
+     * it will also set up outgoing notifications to use the same security
+     * mechanism that was used in the invocation associated with the resource
+     * context.
+     *
+     * @return The WS-Addressing endpoint reference to the new subscription
+     *         resource
+     * @throws SubscribeCreationFailedFaultType
+     *
+     * @throws TopicNotSupportedFaultType
+     * @throws TopicPathDialectUnknownFaultType
+     *
+     * @throws InvalidTopicExpressionFaultType
+     */
+    public EndpointReferenceType subscribe()
+        throws SubscribeCreationFailedFaultType,
+               TopicNotSupportedFaultType,
+               TopicPathDialectUnknownFaultType,
+               InvalidTopicExpressionFaultType
+    {
+        String subscriptionHomeLocation = null;
+        SubscriptionHome subscriptionHome = null;
+
+        if(request == null)
+        {
+            SubscribeCreationFailedFaultType fault =
+                new SubscribeCreationFailedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(
+                i18n.getMessage("nullArgument", "request")
+            );
+            throw fault;
+        }
+
+        if(request.getTopicExpression() == null)
+        {
+            SubscribeCreationFailedFaultType fault =
+                new SubscribeCreationFailedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(
+                i18n.getMessage("emptyTopicExpression")
+            );
+            throw fault;
+        }
+
+        EndpointReferenceType consumerReference =
+            request.getConsumerReference();
+
+        if(consumerReference == null)
+        {
+            SubscribeCreationFailedFaultType fault =
+                new SubscribeCreationFailedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(
+                i18n.getMessage("emptyConsumerReference")
+            );
+            throw fault;
+        }
+
+        // a little trick that enables the EPR to be serialized
+        // it also probably takes less memory as the original
+        // has lots of internal references to request message, etc.
+        consumerReference = new EndpointReferenceType(consumerReference, true);
+
+        if(logger.isDebugEnabled())
+        {
+            logger.debug(
+                request.getTopicExpression().getDialect().getClass().toString());
+        }
+
+        try
+        {
+            Context initialContext = new InitialContext();
+            subscriptionHomeLocation =
+                Constants.JNDI_SERVICES_BASE_NAME +
+                subscriptionManager +
+                Constants.HOME_NAME;
+            subscriptionHome = (SubscriptionHome)
+                initialContext.lookup(subscriptionHomeLocation);
+        }
+        catch(Exception e)
+        {
+            SubscribeCreationFailedFaultType fault =
+                new SubscribeCreationFailedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            faultHelper.setDescription(
+                i18n.getMessage("resourceDisoveryFailed"));
+            throw fault;
+        }
+
+
+        if(!(producerResource instanceof TopicListAccessor))
+        {
+            TopicNotSupportedFaultType fault =
+                new TopicNotSupportedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(
+                i18n.getMessage("noTopicList"));
+            logger.debug("", fault);
+            throw fault;
+        }
+
+        TopicList topicList =
+            ((TopicListAccessor) producerResource).getTopicList();
+        Collection topics;
+
+        try
+        {
+            topics = topicList.getTopics(request.getTopicExpression());
+        }
+        catch(UnsupportedTopicExpressionDialectException e)
+        {
+            logger.debug("", e);
+            TopicPathDialectUnknownFaultType fault =
+                new TopicPathDialectUnknownFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            throw fault;
+        }
+        catch(Exception e)
+        {
+            logger.debug("", e);
+            InvalidTopicExpressionFaultType fault =
+                new InvalidTopicExpressionFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            faultHelper.setDescription(
+                i18n.getMessage("topicExpressionResolutionFailed"));
+            throw fault;
+        }
+
+        if(topics.isEmpty())
+        {
+            if(logger.isDebugEnabled())
+            {
+                Iterator it = topicList.topicIterator();
+                String topicsString = "";
+                while(it.hasNext())
+                {
+                    Object topicObj = it.next();
+                    if(topicObj instanceof Topic)
+                    {
+                        Topic topic = (Topic) topicObj;
+                        topicsString += "; " + "{" +
+                                        topic.getName().getNamespaceURI() + "}"
+                                        + topic.getName().getLocalPart();
+                    }
+                }
+                if(request.getTopicExpression() != null)
+                {
+                    String expressionTopicString = "";
+                    Object expressionValue =
+                        request.getTopicExpression().getValue();
+                    if(expressionValue instanceof QName)
+                    {
+                        expressionTopicString =
+                        "{" + ((QName) expressionValue).getNamespaceURI() +
+                        "}" + ((QName) expressionValue).getLocalPart();
+                    }
+                    logger.debug("no topics found matching expression " +
+                                 request.getTopicExpression().getDialect() +
+                                 "; " +
+                                 expressionTopicString + "\n" +
+                                 "avail. topics are: " + topicsString);
+                }
+            }
+            throw new TopicNotSupportedFaultType();
+        }
+
+        EndpointReferenceType producerReference;
+
+        try
+        {
+            producerReference =
+                AddressingUtils.createEndpointReference(producerKey);
+        }
+        catch(Exception e)
+        {
+            logger.debug("", e);
+            SubscribeCreationFailedFaultType fault =
+                new SubscribeCreationFailedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            faultHelper.setDescription(
+                i18n.getMessage("eprCreationFailed")
+            );
+            throw fault;
+        }
+
+        // Get security properties from message context
+        ClientSecurityDescriptor desc = null;
+        ResourceSecurityDescriptor resourceSecurityDescriptor = null;
+        try
+        {
+            desc = setupNotificationSecurityDescriptor(consumerReference);
+        }
+        catch(SecurityException e)
+        {
+            SubscribeCreationFailedFaultType fault =
+                new SubscribeCreationFailedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            faultHelper.setDescription(
+                i18n.getMessage("secureNotificationSetupFailed")
+            );
+            throw fault;
+        }
+
+        //TODO: change conditional to something better: Only want to do the
+        // below if someone is using security on the incoming connection
+        if(desc != null)
+        {
+            try
+            {
+                resourceSecurityDescriptor = setupResourceSecurityDescriptor();
+            }
+            catch(Exception e)
+            {
+                SubscribeCreationFailedFaultType fault =
+                    new SubscribeCreationFailedFaultType();
+                FaultHelper faultHelper = new FaultHelper(fault);
+                faultHelper.addFaultCause(e);
+                faultHelper.setDescription(
+                    i18n.getMessage("secureSubscriptionSetupFailed")
+                );
+                throw fault;
+            }
+        }
+
+        ResourceKey subscriptionKey = null;
+        try
+        {
+            //TODO: When/If we start using some of these other fields we need to
+            // look at memory associated with the request tied to them
+            subscriptionKey = subscriptionHome.create(
+                        consumerReference,
+                        producerReference,
+                        request.getInitialTerminationTime(),
+                        request.getSubscriptionPolicy(),
+                        request.getPrecondition(),
+                        request.getSelector(),
+                        producerKey,
+                        producerHomeLocation,
+                        request.getTopicExpression(),
+                        request.getUseNotify() == null ?
+                        true : request.getUseNotify().booleanValue(), desc,
+                        resourceSecurityDescriptor);
+        }
+        catch(SubscriptionCreationException e)
+        {
+            SubscribeCreationFailedFaultType fault =
+                new SubscribeCreationFailedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            faultHelper.setDescription(
+                i18n.getMessage("subscriptionCreateFailed")
+            );
+            throw fault;
+        }
+
+        SimpleSubscriptionTopicListener topicListener =
+            new SimpleSubscriptionTopicListener(
+                subscriptionKey,
+                subscriptionHomeLocation);
+
+        if(logger.isDebugEnabled())
+        {
+            logger.debug("Subscription is being added to " +
+                         String.valueOf(topics.size()) + " topics");
+        }
+
+        Iterator topicIterator = topics.iterator();
+        while(topicIterator.hasNext())
+        {
+            ((TopicListenerList) topicIterator.next()).addTopicListener(
+                topicListener);
+        }
+
+        EndpointReferenceType reference = null;
+        try
+        {
+            String address =
+                ServiceHost.getBaseURL() + subscriptionManager;
+            reference =
+            AddressingUtils.createEndpointReference(address,
+                                                    subscriptionKey);
+            if(producerResource instanceof PersistenceCallback)
+            {
+                ((PersistenceCallback) producerResource).store();
+            }
+        }
+        catch(Exception e)
+        {
+            logger.debug("", e);
+            try
+            {
+                subscriptionHome.remove(subscriptionKey);
+            }
+            catch(Exception e1)
+            {
+                logger.error(i18n.getMessage("subscriptionRemoveFailed"), e1);
+            }
+            SubscribeCreationFailedFaultType fault =
+                new SubscribeCreationFailedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            faultHelper.setDescription(
+                i18n.getMessage("eprCreationFailed")
+            );
+            throw fault;
+        }
+
+        return reference;
+    }
+
+    /**
+     * Set up the resource descriptor to be used on the resource.
+     *
+     * @throws SecurityException
+     * @throws ConfigException
+     * @throws SecurityDescriptorException
+     */
+    protected ResourceSecurityDescriptor setupResourceSecurityDescriptor()
+        throws SecurityException, ConfigException, SecurityDescriptorException
+    {
+        ServiceSecurityDescriptor serviceSecurityDescriptor =
+            ServiceSecurityConfig.getSecurityDescriptor();
+        ContainerSecurityDescriptor containerSecurityDescriptor =
+            containerSecurityConfig.getSecurityDescriptor();
+        ResourceSecurityDescriptor desc = null;
+        boolean setAuth = false;
+        List authMethods = null;
+        QName operationName = (QName) context.getProperty(
+            org.globus.wsrf.impl.security.authentication.Constants.OPERATION_NAME);
+
+        if(producerResource instanceof SecureResource)
+        {
+            desc = createResourceSecurityDescriptor();
+            ResourceSecurityDescriptor producerSecurityDescriptor =
+                ((SecureResource) producerResource).getSecurityDescriptor();
+
+            if(producerSecurityDescriptor != null)
+            {
+                if(operationName != null)
+                {
+                    authMethods = producerSecurityDescriptor.getAuthMethods(
+                        operationName);
+                }
+                if(authMethods != null)
+                {
+                    desc.setAuthMethods(authMethods);
+                    setAuth = true;
+                }
+
+                authMethods =
+                    producerSecurityDescriptor.getDefaultAuthMethods();
+                if(!setAuth && authMethods != null)
+                {
+                    desc.setAuthMethods(authMethods);
+                    setAuth = true;
+                }
+            }
+        }
+        if(!setAuth && serviceSecurityDescriptor != null)
+        {
+            desc = createResourceSecurityDescriptor();
+            if(operationName != null)
+            {
+                authMethods = serviceSecurityDescriptor.getAuthMethods(
+                    operationName);
+            }
+            if(authMethods != null)
+            {
+                desc.setAuthMethods(authMethods);
+                setAuth = true;
+            }
+
+            authMethods =
+                serviceSecurityDescriptor.getDefaultAuthMethods();
+            if(!setAuth && authMethods != null)
+            {
+                desc.setAuthMethods(authMethods);
+                setAuth = true;
+            }
+        }
+
+        if(desc == null && containerSecurityDescriptor != null)
+        {
+            desc = createResourceSecurityDescriptor();
+        }
+
+        return desc;
+    }
+
+    /**
+     * Create a new resource security descriptor and fill in the subject and
+     * authorization bits
+     *
+     * @throws SecurityException
+     */
+    private ResourceSecurityDescriptor createResourceSecurityDescriptor()
+        throws SecurityException
+    {
+        ResourceSecurityDescriptor desc = new ResourceSecurityDescriptor();
+        Subject subject = JaasSubject.getCurrentSubject();
+        if(subject == null)
+        {
+            subject = securityManager.getSubject(producerResource);
+        }
+
+        desc.setSubject(subject);
+        String peer = securityManager.getCaller();
+        GridMap gridmap = new GridMap();
+        gridmap.map(peer, System.getProperty("user.name"));
+        desc.setGridMap(gridmap);
+        desc.setAuthz(Authorization.AUTHZ_GRIDMAP);
+        return desc;
+    }
+
+    /**
+     * Set up the client security descriptor used for sending notifications.
+     *
+     * @throws SecurityException
+     * @param consumerEPR
+     */
+    protected ClientSecurityDescriptor setupNotificationSecurityDescriptor(
+        EndpointReferenceType consumerEPR)
+        throws SecurityException
+    {
+        ClientSecurityDescriptor desc = null;
+        Integer protLevel = null;
+        boolean secureMessage = false;
+        boolean secureConversation = false;
+
+        protLevel = (Integer) context.getProperty(
+            org.globus.wsrf.security.Constants.GSI_SEC_MSG);
+
+        if(protLevel == null)
+        {
+            protLevel = (Integer) context.getProperty(
+                org.globus.wsrf.security.Constants.GSI_SEC_CONV);
+            if(protLevel == null)
+            {
+                protLevel = (Integer) context.getProperty(
+                    org.globus.wsrf.security.Constants.GSI_TRANSPORT);
+            }
+            else
+            {
+                secureConversation = true;
+            }
+        }
+        else
+        {
+            secureMessage = true;
+        }
+
+        if(consumerEPR.getAddress().getScheme().equals("https"))
+        {
+            desc = new ClientSecurityDescriptor();
+            desc.setGSITransport(
+                protLevel == null?
+                org.globus.wsrf.security.Constants.SIGNATURE : protLevel);
+        }
+        else
+        {
+            if (protLevel != null && secureMessage)
+            {
+                if (logger.isDebugEnabled())
+                {
+                    logger.debug("Secure message " + protLevel);
+                }
+
+                desc = new ClientSecurityDescriptor();
+                desc.setGSISecureMsg((Integer)protLevel);
+            }
+
+            if (protLevel != null && secureConversation)
+            {
+                if (logger.isDebugEnabled())
+                {
+                    logger.debug("Secure conversation " + protLevel);
+                }
+                if (desc == null)
+                {
+                    desc = new ClientSecurityDescriptor();
+                }
+                desc.setGSISecureConv((Integer)protLevel);
+            }
+        }
+
+        if(desc != null)
+        {
+            Subject currentSubject = JaasSubject.getCurrentSubject();
+
+            if(currentSubject == null)
+            {
+                currentSubject = securityManager.getSubject(producerResource);
+            }
+
+            if(currentSubject != null)
+            {
+                Set privateCreds =
+                    currentSubject.getPrivateCredentials(GSSCredential.class);
+                if(privateCreds != null && !privateCreds.isEmpty())
+                {
+                    Iterator iterator = privateCreds.iterator();
+                    GSSCredential cred = (GSSCredential)iterator.next();
+                    desc.setGSSCredential(cred);
+                }
+            }
+        }
+        //Todo: set up authorization to identity of subscriber?
+
+        return desc;
+    }
+
+    protected String getSubscriptionManagerServiceName()
+    {
+        return Constants.SUBSCRIPTION_MANAGER_SERVICE_NAME;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscribeProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscribeProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscribeProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,113 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.rmi.RemoteException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.oasis.wsn.ResourceUnknownFaultType;
+import org.oasis.wsn.SubscribeCreationFailedFaultType;
+import org.oasis.wsn.TopicPathDialectUnknownFaultType;
+import org.oasis.wsn.Subscribe;
+import org.oasis.wsn.SubscribeResponse;
+
+import org.globus.util.I18n;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.impl.ResourceContextImpl;
+import org.globus.wsrf.utils.FaultHelper;
+import org.globus.wsrf.utils.Resources;
+
+public class SubscribeProvider
+{
+    private static Log logger =
+        LogFactory.getLog(SubscribeProvider.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    /**
+     * Provider for the subscribe operation of the notification producer
+     * porttype
+     *
+     * @param request
+     * @return The endpoint of Subscription resource.
+     * @throws RemoteException
+     * @throws ResourceUnknownFaultType
+     * @throws SubscribeCreationFailedFaultType
+     *
+     * @throws TopicPathDialectUnknownFaultType
+     *
+     */
+    public SubscribeResponse subscribe(Subscribe request)
+        throws RemoteException,
+               ResourceUnknownFaultType,
+               SubscribeCreationFailedFaultType,
+               TopicPathDialectUnknownFaultType
+    {
+        Resource resource = null;
+        ResourceKey key = null;
+        String homeLocation = null;
+        ResourceContext ctx = null;
+
+        try
+        {
+            ctx = ResourceContext.getResourceContext();
+            key = ctx.getResourceKey();
+            resource = ctx.getResource();
+            // FIXME: use service name instead?
+            homeLocation =
+                ((ResourceContextImpl)ctx).getResourceHomeLocation();
+        }
+        catch (NoSuchResourceException e)
+        {
+            ResourceUnknownFaultType fault = new ResourceUnknownFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            throw fault;
+        }
+        catch(Exception e)
+        {
+            SubscribeCreationFailedFaultType fault =
+                new SubscribeCreationFailedFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            faultHelper.setDescription(
+                          i18n.getMessage("resourceDisoveryFailed"));
+            throw fault;
+        }
+
+        EndpointReferenceType reference = getSubscribeHelper(
+            ctx, resource, key, homeLocation, request).subscribe();
+        SubscribeResponse response = new SubscribeResponse();
+        response.setSubscriptionReference(reference);
+        return response;
+    }
+
+    protected SubscribeHelper getSubscribeHelper(
+        ResourceContext context, Resource producerResource,
+        ResourceKey producerKey, String producerHomeLocation,
+        Subscribe request)
+    {
+        return new SubscribeHelper(context, producerResource, producerKey,
+                                   producerHomeLocation, request);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscriptionCreationException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscriptionCreationException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscriptionCreationException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,63 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import org.globus.wsrf.ResourceException;
+
+/**
+ * This exception is raised when the subscription resource creation fails.
+ */
+public class SubscriptionCreationException extends ResourceException
+{
+    /**
+     * Creates a SubscriptionCreationException without error message.
+     */
+    public SubscriptionCreationException()
+    {
+    }
+
+    /**
+     * Creates a SubscriptionCreationException with a given error message.
+     *
+     * @param message error message
+     */
+    public SubscriptionCreationException(String message)
+    {
+        super(message);
+    }
+
+    /**
+     * Creates a SubscriptionCreationException with a given error message and
+     * nested exception.
+     *
+     * @param message   error message
+     * @param exception nested exception/
+     */
+    public SubscriptionCreationException(String message, Throwable exception)
+    {
+        super(message, exception);
+    }
+
+    /**
+     * Creates a SubscriptionCreationException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public SubscriptionCreationException(Throwable exception)
+    {
+        super(exception);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscriptionHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscriptionHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/notification/SubscriptionHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,211 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Calendar;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsrf.properties.QueryExpressionType;
+
+import org.globus.axis.description.Resources;
+import org.globus.util.I18n;
+import org.globus.wsrf.PersistenceCallback;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.ResourceIdentifier;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.Subscription;
+import org.globus.wsrf.impl.ResourceHomeImpl;
+import org.globus.wsrf.impl.SimpleResourceKey;
+import org.globus.wsrf.impl.security.descriptor.ClientSecurityDescriptor;
+import org.globus.wsrf.impl.security.descriptor.ResourceSecurityDescriptor;
+
+public class SubscriptionHome extends ResourceHomeImpl
+{
+    private static Log logger =
+        LogFactory.getLog(SubscriptionHome.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private Constructor resourceConstructor;
+
+    public synchronized void initialize() throws Exception
+    {
+        super.initialize();
+        this.resourceConstructor =
+            this.resourceClass.getConstructor(
+                new Class[] {EndpointReferenceType.class,
+                             EndpointReferenceType.class,
+                             Calendar.class,
+                             Object.class,
+                             QueryExpressionType.class,
+                             QueryExpressionType.class,
+                             ResourceKey.class,
+                             String.class,
+                             TopicExpressionType.class,
+                             boolean.class,
+                             boolean.class,
+                             ClientSecurityDescriptor.class,
+                             ResourceSecurityDescriptor.class});
+    }
+
+    /**
+     * Create a subscription resource
+     *
+     * @param consumerReference              The EPR of the notification
+     *                                       consumer
+     * @param producerReference              The EPR of the producer resource
+     * @param initialTerminationTime         The initial termination time for
+     *                                       the subscription
+     * @param subscriptionPolicy             The policy associciated with the
+     *                                       subscription
+     * @param precondition                   The precondition associciated with
+     *                                       the subscription
+     * @param selector                       The selector associciated with the
+     *                                       subscription
+     * @param producerKey                    The key for the producer resource
+     * @param producerHomeLocation           The JNDI path for the producer
+     *                                       resource's resource home
+     * @param topicPathExpression            The topic path expression for this
+     *                                       subscription
+     * @param useNotify                      Flag indicating if notifications
+     *                                       should be wrapped
+     * @param notificationSecurityDescriptor The security settings to use when
+     *                                       sending notifications for this
+     *                                       subscription
+     * @param resourceSecurityDescriptor     The resource security descriptor to
+     *                                       apply to the created resource
+     * @return The resource key for the created resource
+     * @throws SubscriptionCreationException If the create fails
+     */
+    public ResourceKey create(
+        EndpointReferenceType consumerReference,
+        EndpointReferenceType producerReference,
+        Calendar initialTerminationTime,
+        Object subscriptionPolicy,
+        QueryExpressionType precondition,
+        QueryExpressionType selector,
+        ResourceKey producerKey,
+        String producerHomeLocation,
+        TopicExpressionType topicPathExpression,
+        boolean useNotify,
+        ClientSecurityDescriptor notificationSecurityDescriptor,
+        ResourceSecurityDescriptor resourceSecurityDescriptor)
+        throws SubscriptionCreationException
+    {
+        Subscription subscriptionResource = null;
+
+        try
+        {
+            subscriptionResource = createSubscription(
+                consumerReference,
+                producerReference,
+                initialTerminationTime,
+                subscriptionPolicy,
+                precondition,
+                selector,
+                producerKey,
+                producerHomeLocation,
+                topicPathExpression,
+                useNotify,
+                notificationSecurityDescriptor,
+                resourceSecurityDescriptor);
+        }
+        catch(Exception e)
+        {
+            throw new SubscriptionCreationException(
+                i18n.getMessage("subscriptionCreateFailed"),e);
+        }
+
+        if(subscriptionResource instanceof PersistenceCallback)
+        {
+            try
+            {
+                ((PersistenceCallback) subscriptionResource).store();
+            }
+            catch(ResourceException e)
+            {
+                throw new SubscriptionCreationException(
+                    i18n.getMessage("subscriptionCreateFailed"),e);
+            }
+        }
+
+        ResourceKey key = new SimpleResourceKey(
+            this.keyTypeName,
+            ((ResourceIdentifier) subscriptionResource).getID());
+
+        this.add(key, subscriptionResource);
+        return key;
+    }
+
+    /**
+     *
+     * @param consumerReference
+     * @param producerReference
+     * @param initialTerminationTime
+     * @param subscriptionPolicy
+     * @param precondition
+     * @param selector
+     * @param producerKey
+     * @param producerHomeLocation
+     * @param topicPathExpression
+     * @param useNotify
+     * @param notificationSecurityDescriptor
+     * @param resourceSecurityDescriptor
+     *
+     * @throws NoSuchMethodException
+     * @throws IllegalAccessException
+     * @throws InvocationTargetException
+     * @throws InstantiationException
+     */
+    protected Subscription createSubscription(
+        EndpointReferenceType consumerReference,
+        EndpointReferenceType producerReference,
+        Calendar initialTerminationTime,
+        Object subscriptionPolicy,
+        QueryExpressionType precondition,
+        QueryExpressionType selector,
+        ResourceKey producerKey,
+        String producerHomeLocation,
+        TopicExpressionType topicPathExpression,
+        boolean useNotify,
+        ClientSecurityDescriptor notificationSecurityDescriptor,
+        ResourceSecurityDescriptor resourceSecurityDescriptor)
+            throws NoSuchMethodException, IllegalAccessException,
+                   InvocationTargetException, InstantiationException
+    {
+        return (Subscription) this.resourceConstructor.newInstance(
+            new Object [] {consumerReference,
+                           producerReference,
+                           initialTerminationTime,
+                           subscriptionPolicy,
+                           precondition,
+                           selector,
+                           producerKey,
+                           producerHomeLocation,
+                           topicPathExpression,
+                           Boolean.FALSE,
+                           new Boolean(useNotify),
+                           notificationSecurityDescriptor,
+                           resourceSecurityDescriptor});
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/GetMultipleResourcePropertiesProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/GetMultipleResourcePropertiesProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/GetMultipleResourcePropertiesProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,121 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.properties;
+
+import org.oasis.wsrf.properties.GetMultipleResourcePropertiesResponse;
+import org.oasis.wsrf.properties.GetMultipleResourceProperties_Element;
+import org.oasis.wsrf.properties.InvalidResourcePropertyQNameFaultType;
+import org.oasis.wsrf.properties.ResourceUnknownFaultType;
+
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.ResourceProperties;
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.utils.AnyHelper;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.utils.FaultHelper;
+import org.globus.util.I18n;
+
+import java.rmi.RemoteException;
+import java.util.List;
+import java.util.ArrayList;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+public class GetMultipleResourcePropertiesProvider {
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public GetMultipleResourcePropertiesResponse getMultipleResourceProperties(GetMultipleResourceProperties_Element request)
+        throws RemoteException,
+               InvalidResourcePropertyQNameFaultType,
+               ResourceUnknownFaultType {
+
+        if (request == null) {
+            InvalidResourcePropertyQNameFaultType fault =
+                new InvalidResourcePropertyQNameFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(
+                          i18n.getMessage("nullArgument", "request")
+            );
+            throw fault;
+        }
+
+        QName [] qnames = request.getResourceProperty();
+
+        if (qnames == null) {
+            InvalidResourcePropertyQNameFaultType fault =
+                new InvalidResourcePropertyQNameFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(i18n.getMessage("noRPNames"));
+            throw fault;
+        }
+
+        Object resource = null;
+        try {
+            resource = ResourceContext.getResourceContext().getResource();
+        } catch (NoSuchResourceException e) {
+            ResourceUnknownFaultType fault = 
+                new ResourceUnknownFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            throw fault;
+        } catch (Exception e) {
+            throw new RemoteException(
+                i18n.getMessage("resourceDisoveryFailed"), e);
+        }
+
+        if (!(resource instanceof ResourceProperties)) {
+            throw new RemoteException(i18n.getMessage("rpsNotSupported"));
+        }
+
+        ResourcePropertySet set =
+            ((ResourceProperties)resource).getResourcePropertySet();
+
+        List list = new ArrayList();
+        SOAPElement [] rp;
+        for (int i=0;i<qnames.length;i++) {
+            ResourceProperty prop = set.get(qnames[i]);
+            if (prop == null) {
+                InvalidResourcePropertyQNameFaultType fault =
+                    new InvalidResourcePropertyQNameFaultType();
+                FaultHelper faultHelper = new FaultHelper(fault);
+                faultHelper.setDescription(qnames[i].toString());
+                throw fault;
+            }
+            try {
+                rp = prop.toSOAPElements();
+            } catch (Exception e) {
+                throw new RemoteException(
+                    i18n.getMessage("rpSerializationError", prop), e);
+            }
+            if (rp != null) {
+                for (int j=0;j<rp.length;j++) {
+                    list.add(rp[j]);
+                }
+            }
+        }
+
+        GetMultipleResourcePropertiesResponse response =
+            new GetMultipleResourcePropertiesResponse();
+
+        AnyHelper.setAny(response, list);
+
+        return response;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/GetResourcePropertyProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/GetResourcePropertyProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/GetResourcePropertyProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,96 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.properties;
+
+import org.oasis.wsrf.properties.GetResourcePropertyResponse;
+import org.oasis.wsrf.properties.InvalidResourcePropertyQNameFaultType;
+import org.oasis.wsrf.properties.ResourceUnknownFaultType;
+
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.ResourceProperties;
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.utils.AnyHelper;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.utils.FaultHelper;
+import org.globus.util.I18n;
+
+import java.rmi.RemoteException;
+
+import javax.xml.namespace.QName;
+
+public class GetResourcePropertyProvider {
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public GetResourcePropertyResponse getResourceProperty(QName name)
+        throws RemoteException,
+               InvalidResourcePropertyQNameFaultType,
+               ResourceUnknownFaultType {
+
+        if (name == null) {
+            InvalidResourcePropertyQNameFaultType fault =
+                new InvalidResourcePropertyQNameFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(i18n.getMessage("noRPName"));
+            throw fault;
+        }
+
+        Object resource = null;
+        try {
+            resource = ResourceContext.getResourceContext().getResource();
+        } catch (NoSuchResourceException e) {
+            ResourceUnknownFaultType fault = 
+                new ResourceUnknownFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            throw fault;
+        } catch (Exception e) {
+            throw new RemoteException(
+                i18n.getMessage("resourceDisoveryFailed"), e);
+        }
+
+        if (!(resource instanceof ResourceProperties)) {
+            throw new RemoteException(i18n.getMessage("rpsNotSupported"));
+        }
+
+        ResourcePropertySet set =
+            ((ResourceProperties)resource).getResourcePropertySet();
+
+        ResourceProperty prop = set.get(name);
+        if (prop == null) {
+            InvalidResourcePropertyQNameFaultType fault = 
+                new InvalidResourcePropertyQNameFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(name.toString());
+            throw fault;
+        }
+
+        GetResourcePropertyResponse response =
+            new GetResourcePropertyResponse();
+
+        try {
+            AnyHelper.setAny(response, prop.toSOAPElements());
+        } catch (Exception e) {
+            throw new RemoteException(
+                i18n.getMessage("rpSerializationError", prop), e);
+        }
+
+        return response;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/QueryResourcePropertiesProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/QueryResourcePropertiesProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/QueryResourcePropertiesProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,158 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.properties;
+
+import java.rmi.RemoteException;
+import java.util.List;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.ResourceProperties;
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.query.QueryEngine;
+import org.globus.wsrf.query.UnsupportedQueryDialectException;
+import org.globus.wsrf.query.QueryException;
+import org.globus.wsrf.query.QueryEvaluationException;
+import org.globus.wsrf.query.InvalidQueryExpressionException;
+import org.globus.wsrf.utils.AnyHelper;
+import org.globus.wsrf.jndi.JNDIUtils;
+import org.globus.wsrf.utils.FaultHelper;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+import org.oasis.wsrf.properties.InvalidQueryExpressionFaultType;
+import org.oasis.wsrf.properties.InvalidResourcePropertyQNameFaultType;
+import org.oasis.wsrf.properties.QueryEvaluationErrorFaultType;
+import org.oasis.wsrf.properties.QueryExpressionType;
+import org.oasis.wsrf.properties.ResourceUnknownFaultType;
+import org.oasis.wsrf.properties.UnknownQueryExpressionDialectFaultType;
+import org.oasis.wsrf.properties.QueryResourceProperties_Element;
+import org.oasis.wsrf.properties.QueryResourcePropertiesResponse;
+
+import javax.xml.soap.SOAPElement;
+
+/**
+ * QueryResourceProperties operation implementation. It looks for a QueryEngine
+ * implementation under "java:comp/env/query/ContainerQueryEngine".
+ */
+public class QueryResourcePropertiesProvider {
+
+    static Log logger =
+        LogFactory.getLog(QueryResourcePropertiesProvider.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public QueryResourcePropertiesResponse queryResourceProperties(QueryResourceProperties_Element request)
+        throws RemoteException,
+               InvalidResourcePropertyQNameFaultType,
+               ResourceUnknownFaultType,
+               InvalidQueryExpressionFaultType,
+               QueryEvaluationErrorFaultType,
+               UnknownQueryExpressionDialectFaultType {
+
+        if (request == null) {
+            throw new RemoteException(
+                i18n.getMessage("nullArgument", "request"));
+        }
+
+        Object resource = null;
+        try {
+            resource = ResourceContext.getResourceContext().getResource();
+        } catch (NoSuchResourceException e) {
+            ResourceUnknownFaultType fault = 
+                new ResourceUnknownFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            throw fault;
+        } catch (Exception e) {
+            throw new RemoteException(
+                i18n.getMessage("resourceDisoveryFailed"), e);
+        }
+
+        if (!(resource instanceof ResourceProperties)) {
+            throw new RemoteException(i18n.getMessage("rpsNotSupported"));
+        }
+
+        ResourcePropertySet set =
+            ((ResourceProperties)resource).getResourcePropertySet();
+
+        QueryEngine engine = null;
+        try {
+            Context initialContext = new InitialContext();
+            engine = (QueryEngine)JNDIUtils.lookup(
+                                 initialContext,
+                                 Constants.DEFAULT_QUERY_ENGINE,
+                                 QueryEngine.class
+                     );
+        } catch (NamingException e) {
+            throw new RemoteException(
+                i18n.getMessage("queryEngineLookupError"), e
+            );
+        }
+
+        QueryExpressionType query = request.getQueryExpression();
+
+        Object result = null;
+        try {
+            result = engine.executeQuery(query, set);
+        } catch (UnsupportedQueryDialectException e) {
+            UnknownQueryExpressionDialectFaultType fault =
+                new UnknownQueryExpressionDialectFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            throw fault;
+        } catch (QueryEvaluationException e) {
+            QueryEvaluationErrorFaultType fault =
+                new QueryEvaluationErrorFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            throw fault;
+        } catch (InvalidQueryExpressionException e) {
+            InvalidQueryExpressionFaultType fault =
+                new InvalidQueryExpressionFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            throw fault;
+        } catch (QueryException e) {
+            throw new RemoteException(i18n.getMessage("queryFailed"), e);
+        }
+
+        QueryResourcePropertiesResponse response =
+            new QueryResourcePropertiesResponse();
+        
+        if (result instanceof List) {
+            AnyHelper.setAny(response, (List)result);
+        } else if (result instanceof SOAPElement) {
+            AnyHelper.setAny(response, (SOAPElement)result);
+        } else if (result instanceof SOAPElement[]) {
+            AnyHelper.setAny(response, (SOAPElement[])result);
+        } else {
+            throw new RemoteException(
+              i18n.getMessage("unsupportedQueryReturnType",
+                              new Object [] {result.getClass().getName() }));
+        }
+        
+        return response;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/SetResourcePropertiesProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/SetResourcePropertiesProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/properties/SetResourcePropertiesProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,286 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.properties;
+
+import java.rmi.RemoteException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.ResourceProperties;
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.impl.SimpleResourcePropertyMetaData;
+import org.globus.wsrf.utils.Resources;
+import org.globus.wsrf.utils.FaultHelper;
+import org.globus.util.I18n;
+
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.Name;
+
+import org.oasis.wsrf.properties.DeleteType;
+import org.oasis.wsrf.properties.InsertType;
+import org.oasis.wsrf.properties.UpdateType;
+import org.oasis.wsrf.properties.InvalidResourcePropertyQNameFaultType;
+import org.oasis.wsrf.properties.InvalidSetResourcePropertiesRequestContentFaultType;
+import org.oasis.wsrf.properties.ResourceUnknownFaultType;
+import org.oasis.wsrf.properties.SetResourcePropertyRequestFailedFaultType;
+import org.oasis.wsrf.properties.UnableToModifyResourcePropertyFaultType;
+import org.oasis.wsrf.properties.SetResourceProperties_Element;
+import org.oasis.wsrf.properties.SetResourcePropertiesResponse;
+
+public class SetResourcePropertiesProvider {
+
+    private static Log logger =
+        LogFactory.getLog(SetResourcePropertiesProvider.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public SetResourcePropertiesResponse setResourceProperties(SetResourceProperties_Element request)
+        throws RemoteException,
+               SetResourcePropertyRequestFailedFaultType,
+               InvalidResourcePropertyQNameFaultType,
+               UnableToModifyResourcePropertyFaultType,
+               ResourceUnknownFaultType,
+               InvalidSetResourcePropertiesRequestContentFaultType {
+
+        if (request == null) {
+            throw new RemoteException(
+                i18n.getMessage("nullArgument", "request"));
+        }
+
+        Object resource = null;
+        try {
+            resource = ResourceContext.getResourceContext().getResource();
+        } catch (NoSuchResourceException e) {
+            ResourceUnknownFaultType fault = 
+                new ResourceUnknownFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            throw fault;
+        } catch (Exception e) {
+            throw new RemoteException(
+                i18n.getMessage("resourceDisoveryFailed"), e);
+        }
+
+        if (!(resource instanceof ResourceProperties)) {
+            throw new RemoteException(i18n.getMessage("rpsNotSupported"));
+        }
+        
+        ResourcePropertySet set =
+            ((ResourceProperties)resource).getResourcePropertySet();
+
+        ResourceProperty prop = null;
+        QName rp = null;
+
+        Object component = null;
+        Iterator iter = request.iterator();
+        while(iter.hasNext()) {
+            component = iter.next();
+            if (component instanceof DeleteType) {
+                handleDelete( (DeleteType)component, set );
+            } else if (component instanceof InsertType) {
+                handleInsert( (InsertType)component, set);
+            } else if (component instanceof UpdateType) {
+                handleUpdate( (UpdateType)component, set);
+            } else {
+                SetResourcePropertyRequestFailedFaultType fault =
+                    new SetResourcePropertyRequestFailedFaultType();
+                FaultHelper faultHelper = new FaultHelper(fault);
+                throw fault;
+            }
+        }
+        
+        SetResourcePropertiesResponse response =
+            new SetResourcePropertiesResponse();
+
+        return response;
+    }
+        
+    private void handleDelete(DeleteType delete, ResourcePropertySet set)
+        throws InvalidResourcePropertyQNameFaultType,
+               UnableToModifyResourcePropertyFaultType {
+        QName rp = delete.getResourceProperty();
+        if (rp == null) {
+            InvalidResourcePropertyQNameFaultType fault = 
+                new InvalidResourcePropertyQNameFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(i18n.getMessage("noRPName"));
+            throw fault;
+        }
+        checkRP(rp);
+        ResourceProperty prop = set.get(rp);
+        if (prop == null) {
+            InvalidResourcePropertyQNameFaultType fault = 
+                new InvalidResourcePropertyQNameFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(rp.toString());
+            throw fault;
+        }
+        try {
+            prop.clear();
+        } catch (RuntimeException e) {
+            UnableToModifyResourcePropertyFaultType fault =
+                new UnableToModifyResourcePropertyFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.addFaultCause(e);
+            faultHelper.setDescription(rp.toString());
+            throw fault;
+        }
+    }
+
+    private void handleInsert(InsertType insert, ResourcePropertySet set)
+        throws InvalidResourcePropertyQNameFaultType,
+               UnableToModifyResourcePropertyFaultType {
+        SOAPElement [] any = insert.get_any();
+        if (any == null) {
+            InvalidResourcePropertyQNameFaultType fault = 
+                new InvalidResourcePropertyQNameFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(i18n.getMessage("noRPName"));
+            throw fault;
+        }
+        QName rp = null;
+        ResourceProperty prop = null;
+        for (int j=0;j<any.length;j++) {
+            rp = getQName(any[j]);
+            checkRP(rp);
+            prop = set.get(rp);
+            if (prop == null) {
+                if (set.isOpenContent()) {
+                    SimpleResourcePropertyMetaData metaData = 
+                        new SimpleResourcePropertyMetaData(rp);
+                    prop = set.create(metaData);
+                    set.add(prop);
+                } else {
+                    InvalidResourcePropertyQNameFaultType fault = 
+                        new InvalidResourcePropertyQNameFaultType();
+                    FaultHelper faultHelper = new FaultHelper(fault);
+                    faultHelper.setDescription(rp.toString());
+                    throw fault;
+                }
+            }
+            try {
+                prop.add(any[j]);
+            } catch (RuntimeException e) {
+                UnableToModifyResourcePropertyFaultType fault =
+                    new UnableToModifyResourcePropertyFaultType();
+                FaultHelper faultHelper = new FaultHelper(fault);
+                faultHelper.addFaultCause(e);
+                faultHelper.setDescription(rp.toString());
+                throw fault;
+            }
+        }
+    }
+
+    private void handleUpdate(UpdateType update, ResourcePropertySet set)
+        throws InvalidResourcePropertyQNameFaultType,
+               UnableToModifyResourcePropertyFaultType {
+        SOAPElement [] any = update.get_any();
+        if (any == null) {
+            InvalidResourcePropertyQNameFaultType fault = 
+                new InvalidResourcePropertyQNameFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(i18n.getMessage("noRPName"));
+            throw fault;
+        }
+        QName rp = null;
+        ResourceProperty prop = null;
+        Map updates = new HashMap();
+        for (int j=0;j<any.length;j++) {
+            rp = getQName(any[j]);
+            checkRP(rp);
+            prop = set.get(rp);
+            if (prop == null) {
+                if (set.isOpenContent()) {
+                    SimpleResourcePropertyMetaData metaData = 
+                        new SimpleResourcePropertyMetaData(rp);
+                    prop = set.create(metaData);
+                    set.add(prop);
+                } else {
+                    InvalidResourcePropertyQNameFaultType fault = 
+                        new InvalidResourcePropertyQNameFaultType();
+                    FaultHelper faultHelper = new FaultHelper(fault);
+                    faultHelper.setDescription(rp.toString());
+                    throw fault;
+                }
+            }
+            List values = (List)updates.get(rp);
+            if (values == null) {
+                values = new LinkedList();
+                updates.put(rp, values);
+            }
+            values.add(any[j]);
+        }
+        Iterator iter = updates.entrySet().iterator();
+        while(iter.hasNext()) {
+            Map.Entry entry = (Map.Entry)iter.next();
+            rp = (QName)entry.getKey();
+            prop = set.get(rp);
+            // XXX: property was removed during?!
+            if (prop == null) {
+                continue;
+            }
+            synchronized(prop) {
+                try {
+                    prop.clear();
+                    Iterator listIter =
+                        ((List)entry.getValue()).iterator();
+                    while(listIter.hasNext()) {
+                        prop.add(listIter.next());
+                    }
+                } catch (RuntimeException e) {
+                    UnableToModifyResourcePropertyFaultType fault =
+                        new UnableToModifyResourcePropertyFaultType();
+                    FaultHelper faultHelper = new FaultHelper(fault);
+                    faultHelper.addFaultCause(e);
+                    faultHelper.setDescription(rp.toString());
+                    throw fault;
+                }
+            }
+        }
+    }
+
+    private void checkRP(QName rp) 
+        throws UnableToModifyResourcePropertyFaultType {
+        // according to the WSRL spec these cannot be modified
+        // via SetResourceProperties operation.
+        if (rp.equals(WSRFConstants.CURRENT_TIME) ||
+            rp.equals(WSRFConstants.TERMINATION_TIME)) {
+            UnableToModifyResourcePropertyFaultType fault =
+                new UnableToModifyResourcePropertyFaultType();
+            FaultHelper faultHelper = new FaultHelper(fault);
+            faultHelper.setDescription(rp.toString());
+            throw fault;
+        }
+    }
+    
+    public static QName getQName(SOAPElement element) {
+        Name name = element.getElementName();
+        return new QName(name.getURI(), name.getLocalName());
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/TimerImpl.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/TimerImpl.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/TimerImpl.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,86 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.timer;
+
+import commonj.timers.CancelTimerListener;
+import commonj.timers.Timer;
+import commonj.timers.TimerListener;
+
+public class TimerImpl implements Timer
+{
+    private TimerListenerWrapper timerTask;
+    private TimerListener listener;
+    private long period;
+
+    public TimerImpl(TimerListener listener, long period)
+    {
+        this.period = period;
+        this.listener = listener;
+    }
+
+    /* (non-Javadoc)
+     * @see commonj.timer.Timer#cancel()
+     */
+    public boolean cancel()
+    {
+        if(this.listener instanceof CancelTimerListener)
+        {
+            ((CancelTimerListener) this.listener).timerCancel(this);
+        }
+        return timerTask.cancel();
+    }
+
+    /* (non-Javadoc)
+     * @see commonj.timer.Timer#getPeriod()
+     */
+    public long getPeriod()
+    {
+        return this.period;
+    }
+
+    /* (non-Javadoc)
+     * @see commonj.timer.Timer#getTimerListener()
+     */
+    public TimerListener getTimerListener()
+    {
+        return this.listener;
+    }
+
+    /* (non-Javadoc)
+     * @see commonj.timer.Timer#scheduledExecutionTime()
+     */
+    public long scheduledExecutionTime()
+    {
+        return this.timerTask.scheduledExecutionTime() + this.period;
+    }
+
+    /**
+     * @return Returns the timerTask.
+     */
+    protected TimerListenerWrapper getTimerTask()
+    {
+        return this.timerTask;
+    }
+
+    /**
+     * @param timerTask The timerTask to set.
+     */
+    protected void setTimerTask(TimerListenerWrapper timerTask)
+    {
+        this.timerTask = timerTask;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/TimerListenerWrapper.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/TimerListenerWrapper.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/TimerListenerWrapper.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,111 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.timer;
+
+import java.util.TimerTask;
+
+import commonj.timers.Timer;
+import commonj.timers.TimerListener;
+
+public class TimerListenerWrapper extends TimerTask
+{
+    private Timer timer;
+    private TimerListener listener;
+    private TimerManagerImpl timerManager;
+    private boolean suspended = false;
+    private boolean expired = false;
+
+    /**
+     * @param timer
+     * @param timerManager
+     */
+    public TimerListenerWrapper(Timer timer, TimerManagerImpl timerManager)
+    {
+        this.timer = timer;
+        if(timer instanceof TimerImpl)
+        {
+            ((TimerImpl) timer).setTimerTask(this);
+        }
+        this.listener = timer.getTimerListener();
+        this.timerManager = timerManager;
+    }
+
+    public synchronized void suspend()
+    {
+        this.suspended = true;
+    }
+
+    public synchronized void resume()
+    {
+        this.suspended = false;
+        if(this.expired == true)
+        {
+            this.listener.timerExpired(timer);
+            if(this.timer.getPeriod() == 0)
+            {
+                this.timerManager.removeTask(this);
+            }
+            this.expired = false;
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Runnable#run()
+     */
+    public synchronized void run()
+    {
+        if(!this.suspended)
+        {
+            this.listener.timerExpired(timer);
+            if(this.timer.getPeriod() == 0)
+            {
+                this.timerManager.removeTask(this);
+            }
+        }
+        else
+        {
+            this.expired = true;
+        }
+    }
+
+    protected boolean stop()
+    {
+        return super.cancel();
+    }
+
+    public boolean cancel()
+    {
+        this.timerManager.removeTask(this);
+        return super.cancel();
+    }
+
+    /**
+     * @return Returns the listener.
+     */
+    protected TimerListener getListener()
+    {
+        return this.listener;
+    }
+
+    /**
+     * @return Returns the timer.
+     */
+    protected Timer getTimer()
+    {
+        return this.timer;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/TimerManagerImpl.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/TimerManagerImpl.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/timer/TimerManagerImpl.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,176 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.timer;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import commonj.timers.StopTimerListener;
+import commonj.timers.Timer;
+import commonj.timers.TimerListener;
+import commonj.timers.TimerManager;
+
+public class TimerManagerImpl implements TimerManager
+{
+    private int poolSize = 1;
+    private List taskList = new LinkedList();
+    private List timerPool = new ArrayList();
+    private int currentTimer = 0;
+
+    public TimerManagerImpl()
+    {
+        for(int i = 0; i < this.poolSize; i++)
+        {
+            timerPool.add(new java.util.Timer(true));
+        }
+    }
+
+    public synchronized void resume()
+    {
+        Iterator taskIterator = this.taskList.iterator();
+        while(taskIterator.hasNext())
+        {
+            ((TimerListenerWrapper) taskIterator.next()).resume();
+        }
+    }
+
+    public Timer schedule(TimerListener listener, Date firstTime, long period)
+    {
+        java.util.Timer timer =
+            (java.util.Timer) timerPool.get(this.currentTimer);
+        this.currentTimer = (this.currentTimer + 1)%this.poolSize;
+        Timer newTimer = new TimerImpl(listener, period);
+        TimerListenerWrapper task = new TimerListenerWrapper(newTimer, this);
+        this.taskList.add(task);
+        timer.schedule(task, firstTime, period);
+        return newTimer;
+    }
+
+    public Timer schedule(TimerListener listener, Date time)
+    {
+        java.util.Timer timer =
+            (java.util.Timer) timerPool.get(this.currentTimer);
+        this.currentTimer = (this.currentTimer + 1)%this.poolSize;
+        Timer newTimer = new TimerImpl(listener, 0);
+        TimerListenerWrapper task = new TimerListenerWrapper(newTimer, this);
+        this.taskList.add(task);
+        timer.schedule(task, time);
+        return newTimer;
+    }
+
+    public Timer schedule(TimerListener listener, long delay, long period)
+    {
+        java.util.Timer timer =
+            (java.util.Timer) timerPool.get(this.currentTimer);
+        this.currentTimer = (this.currentTimer + 1)%this.poolSize;
+        Timer newTimer = new TimerImpl(listener, period);
+        TimerListenerWrapper task = new TimerListenerWrapper(newTimer, this);
+        this.taskList.add(task);
+        timer.schedule(task, delay, period);
+        return newTimer;
+    }
+
+    public Timer schedule(TimerListener listener, long delay)
+    {
+        java.util.Timer timer =
+            (java.util.Timer) timerPool.get(this.currentTimer);
+        this.currentTimer = (this.currentTimer + 1)%this.poolSize;
+        Timer newTimer = new TimerImpl(listener, 0);
+        TimerListenerWrapper task = new TimerListenerWrapper(newTimer, this);
+        this.taskList.add(task);
+        timer.schedule(task, delay);
+        return newTimer;
+    }
+
+    public Timer scheduleAtFixedRate(TimerListener listener, Date firstTime,
+        long period)
+    {
+        java.util.Timer timer =
+            (java.util.Timer) timerPool.get(this.currentTimer);
+        this.currentTimer = (this.currentTimer + 1)%this.poolSize;
+        Timer newTimer = new TimerImpl(listener, period);
+        TimerListenerWrapper task = new TimerListenerWrapper(newTimer, this);
+        this.taskList.add(task);
+        timer.scheduleAtFixedRate(task, firstTime, period);
+        return newTimer;
+    }
+
+    public Timer scheduleAtFixedRate(TimerListener listener, long delay,
+        long period)
+    {
+        java.util.Timer timer =
+            (java.util.Timer) timerPool.get(this.currentTimer);
+        this.currentTimer = (this.currentTimer + 1)%this.poolSize;
+        Timer newTimer = new TimerImpl(listener, period);
+        TimerListenerWrapper task = new TimerListenerWrapper(newTimer, this);
+        this.taskList.add(task);
+        timer.scheduleAtFixedRate(task, delay, period);
+        return newTimer;
+    }
+
+    public synchronized void stop()
+    {
+        Iterator taskIterator = this.taskList.iterator();
+        TimerListenerWrapper task;
+        TimerListener listener;
+
+        while(taskIterator.hasNext())
+        {
+            task = (TimerListenerWrapper) taskIterator.next();
+            task.stop();
+            listener = task.getListener();
+            if(listener instanceof StopTimerListener)
+            {
+                ((StopTimerListener) listener).timerStop(task.getTimer());
+            }
+        }
+        this.taskList.clear();
+    }
+
+    public synchronized void suspend()
+    {
+        Iterator taskIterator = this.taskList.iterator();
+        while(taskIterator.hasNext())
+        {
+            ((TimerListenerWrapper) taskIterator.next()).suspend();
+        }
+    }
+
+    protected synchronized void removeTask(Object task)
+    {
+        this.taskList.remove(task);
+    }
+
+
+    public int getPoolSize()
+    {
+        return this.poolSize;
+    }
+
+    public void setPoolSize(int poolSize)
+    {
+        // don't allow shrinking of the pool
+        for(int i = this.poolSize; i < poolSize; i++)
+        {
+            timerPool.add(new java.util.Timer(true));
+        }
+        this.poolSize = poolSize;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/WorkEventImpl.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/WorkEventImpl.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/WorkEventImpl.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,74 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.work;
+
+import commonj.work.Work;
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+
+
+public class WorkEventImpl implements WorkEvent
+{
+    private WorkException exception;
+    private int type;
+    private Work work;   
+    
+    /**
+     * @param type
+     * @param work
+     */
+    public WorkEventImpl(int type, Work work)
+    {
+        this(null, type, work);
+    }
+    
+    /**
+     * @param exception
+     * @param type
+     * @param work
+     */
+    public WorkEventImpl(WorkException exception, int type, Work work)
+    {
+        this.exception = exception;
+        this.type = type;
+        this.work = work;
+    }
+    
+    /* (non-Javadoc)
+     * @see commonj.work.WorkEvent#getException()
+     */
+    public WorkException getException()
+    {
+        return this.exception;
+    }
+
+    /* (non-Javadoc)
+     * @see commonj.work.WorkEvent#getType()
+     */
+    public int getType()
+    {
+        return this.type;
+    }
+
+    /* (non-Javadoc)
+     * @see commonj.work.WorkEvent#getWork()
+     */
+    public Work getWork()
+    {
+        return this.work;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/WorkItemImpl.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/WorkItemImpl.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/WorkItemImpl.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,44 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.work;
+
+import commonj.work.WorkItem;
+
+public class WorkItemImpl implements WorkItem
+{
+    private int status = -1;
+
+    /* (non-Javadoc)
+     * @see commonj.work.WorkItem#getStatus()
+     */
+    public synchronized int getStatus()
+    {
+        return this.status;
+    }
+
+    /**
+     * @param status The status to set.
+     */
+    protected synchronized void setStatus(int status)
+    {
+        // only set status if new status is later in the sequence
+        if(status > this.status)
+        {
+            this.status = status;
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/WorkManagerImpl.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/WorkManagerImpl.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/impl/work/WorkManagerImpl.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,360 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.work;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
+
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
+import commonj.work.Work;
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+import commonj.work.WorkItem;
+import commonj.work.WorkListener;
+import commonj.work.WorkManager;
+import commonj.work.WorkRejectedException;
+
+public class WorkManagerImpl implements WorkManager
+{
+    protected static final int MAX_POOL_SIZE = 5;
+    private PooledExecutor pool;
+    private Map workItems = new HashMap();
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public WorkManagerImpl()
+    {
+        this(MAX_POOL_SIZE);
+    }
+
+    public WorkManagerImpl(int maxPoolSize)
+    {
+        this.pool = new PooledExecutor(maxPoolSize);
+    }
+
+    public void setMaximumPoolSize(int maxPoolSize)
+    {
+        this.pool.setMaximumPoolSize(maxPoolSize);
+    }
+
+    public int getMaximumPoolSize()
+    {
+        return this.pool.getMaximumPoolSize();
+    }
+
+    /* (non-Javadoc)
+     * @see commonj.work.WorkManager#schedule(commonj.work.Work, commonj.work.WorkListener)
+     */
+    public synchronized WorkItem schedule(Work work, WorkListener listener)
+        throws WorkException, IllegalArgumentException
+    {
+        WorkEvent event;
+
+        if(work == null)
+        {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullArgument", "work"));
+        }
+
+        WorkItem workItem = new WorkItemImpl();
+
+        this.workItems.put(work, workItem);
+
+        try
+        {
+            if(work.isDaemon())
+            {
+                Thread thread = new Thread(new WorkWrapper(work, listener));
+                thread.setDaemon(true);
+                thread.start();
+            }
+            else
+            {
+                this.pool.execute(new WorkWrapper(work, listener));
+            }
+        }
+        catch(Exception e)
+        {
+            event = new WorkEventImpl(WorkEvent.WORK_REJECTED, work);
+            this.processEvent(event);
+            if(listener != null)
+            {
+                listener.workRejected(event);
+            }
+
+            throw new WorkRejectedException(e);
+        }
+
+        event = new WorkEventImpl(WorkEvent.WORK_ACCEPTED, work);
+        this.processEvent(event);
+        if(listener != null)
+        {
+            listener.workAccepted(event);
+
+        }
+
+        return workItem;
+    }
+
+    /* (non-Javadoc)
+     * @see commonj.work.WorkManager#schedule(commonj.work.Work)
+     */
+    public synchronized WorkItem schedule(Work work) throws WorkException,
+        IllegalArgumentException
+    {
+        return this.schedule(work, null);
+    }
+
+    /* (non-Javadoc)
+     * @see commonj.work.WorkManager#waitForAll(java.util.Collection, long)
+     */
+    public boolean waitForAll(Collection workItems, long timeout)
+    {
+        Iterator workItemsIterator = workItems.iterator();
+        Object current;
+        WorkItem workItem;
+        int status;
+
+        if(timeout == WorkManager.IMMEDIATE)
+        {
+            while(workItemsIterator.hasNext())
+            {
+                current = workItemsIterator.next();
+                if(current instanceof WorkItem)
+                {
+                    status = ((WorkItem) current).getStatus();
+                    if(status != WorkEvent.WORK_COMPLETED &&
+                       status != WorkEvent.WORK_REJECTED)
+                    {
+                        return false;
+                    }
+                }
+            }
+        }
+        else if(timeout == WorkManager.INDEFINITE)
+        {
+            while(workItemsIterator.hasNext())
+            {
+                current = workItemsIterator.next();
+                if(current instanceof WorkItem)
+                {
+                    workItem = (WorkItem) current;
+                    synchronized(workItem)
+                    {
+                        status = workItem.getStatus();
+                        while(status != WorkEvent.WORK_COMPLETED &&
+                              status != WorkEvent.WORK_REJECTED)
+                        {
+                            try
+                            {
+                                workItem.wait();
+                            }
+                            catch(InterruptedException e)
+                            {
+                                // not sure if this is the right thing to do
+                                return false;
+                            }
+                            status = workItem.getStatus();
+                        }
+                    }
+                }
+            }
+        }
+        else
+        {
+            long absTimeout = System.currentTimeMillis() + timeout;
+            while(workItemsIterator.hasNext())
+            {
+                current = workItemsIterator.next();
+                if(current instanceof WorkItem)
+                {
+                    workItem = (WorkItem) current;
+                    synchronized(workItem)
+                    {
+                        status = workItem.getStatus();
+                        while(status != WorkEvent.WORK_COMPLETED &&
+                              status != WorkEvent.WORK_REJECTED)
+                        {
+                            if(timeout > 0)
+                            {
+                                try
+                                {
+                                    workItem.wait(timeout);
+                                }
+                                catch(InterruptedException e)
+                                {
+                                    // not sure if this is the right thing to do
+                                    return false;
+                                }
+                                timeout = absTimeout -
+				    System.currentTimeMillis();
+                            }
+                            else
+                            {
+                                return false;
+                            }
+
+                            status = workItem.getStatus();
+                        }
+                    }
+                }
+            }
+        }
+        return true;
+    }
+
+    /* (non-Javadoc)
+    * @see commonj.work.WorkManager#waitForAny(java.util.Collection, long)
+    */
+    public Collection waitForAny(Collection workItems, long timeout)
+    {
+        Iterator workItemsIterator = workItems.iterator();
+        Object current;
+        WorkItem workItem;
+        int status;
+        Collection result = new Vector();
+
+        if(timeout == WorkManager.IMMEDIATE)
+        {
+            while(workItemsIterator.hasNext())
+            {
+                current = workItemsIterator.next();
+                if(current instanceof WorkItem)
+                {
+                    workItem = (WorkItem) current;
+                    status = workItem.getStatus();
+                    if(status == WorkEvent.WORK_COMPLETED ||
+                       status == WorkEvent.WORK_REJECTED)
+                    {
+                        result.add(workItem);
+                    }
+                }
+            }
+        }
+        else if(timeout == WorkManager.INDEFINITE)
+        {
+            if(this.waitForAll(workItems, timeout))
+            {
+                return workItems;
+            }
+            else
+            {
+                return null;
+            }
+        }
+        else
+        {
+            long absTimeout = System.currentTimeMillis() + timeout;
+            while(workItemsIterator.hasNext())
+            {
+                current = workItemsIterator.next();
+                if(current instanceof WorkItem)
+                {
+                    workItem = (WorkItem) current;
+                    synchronized(workItem)
+                    {
+                        status = workItem.getStatus();
+                        while(status != WorkEvent.WORK_COMPLETED &&
+                              status != WorkEvent.WORK_REJECTED &&
+                              timeout > 0)
+                        {
+                            try
+                            {
+                                workItem.wait(timeout);
+                            }
+                            catch(InterruptedException e)
+                            {
+                                // not sure if this is the right thing to do
+                                return null;
+                            }
+
+                            timeout = absTimeout -
+				System.currentTimeMillis();
+                            status = workItem.getStatus();
+                        }
+
+                        if(status == WorkEvent.WORK_COMPLETED ||
+                           status == WorkEvent.WORK_REJECTED)
+                        {
+                            result.add(workItem);
+                        }
+                    }
+                }
+            }
+        }
+
+        return result;
+    }
+
+    protected synchronized void processEvent(WorkEvent event)
+    {
+        WorkItemImpl workItem =
+                (WorkItemImpl) this.workItems.get(event.getWork());
+        if(workItem != null)
+        {
+            int type = event.getType();
+            workItem.setStatus(type);
+            if(type == WorkEvent.WORK_COMPLETED ||
+               type == WorkEvent.WORK_REJECTED)
+            {
+                synchronized(workItem)
+                {
+                    workItem.notifyAll();
+                }
+                this.workItems.remove(event.getWork());
+            }
+        }
+    }
+
+    protected class WorkWrapper implements Runnable
+    {
+        private Work work;
+        private WorkListener listener;
+
+        public WorkWrapper(Work work, WorkListener listener)
+        {
+            this.work = work;
+            this.listener = listener;
+        }
+
+        /* (non-Javadoc)
+         * @see java.lang.Runnable#run()
+         */
+        public void run()
+        {
+            WorkEvent event =
+                    new WorkEventImpl(WorkEvent.WORK_STARTED, this.work);
+            processEvent(event);
+            if(this.listener != null)
+            {
+                this.listener.workStarted(event);
+            }
+
+            this.work.run();
+
+            event = new WorkEventImpl(WorkEvent.WORK_COMPLETED, this.work);
+            processEvent(event);
+            if(this.listener != null)
+            {
+                this.listener.workCompleted(event);
+            }
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/BasicBeanFactory.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/BasicBeanFactory.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/BasicBeanFactory.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,54 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.jndi;
+
+import java.util.Hashtable;
+
+import javax.naming.Name;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+public class BasicBeanFactory extends org.apache.naming.factory.BeanFactory {
+    
+    protected static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    /**
+     * Create a new Bean instance. If the created bean implements
+     * <code>Initializable</code> interface, the <code>initialize()</code>
+     * function will be called after the bean is created and all properties
+     * are set.
+     */
+    public Object getObjectInstance(Object obj, Name name, Context nameCtx,
+                                    Hashtable environment)
+        throws NamingException {
+        Object bean = super.getObjectInstance(obj, name, nameCtx, environment);
+        if (bean instanceof Initializable) {
+            try {
+                ((Initializable)bean).initialize();
+            } catch (Exception e) {
+                NamingException ex =
+                    new NamingException(i18n.getMessage("beanInitFailed"));
+                ex.setRootCause(e);
+                throw ex;
+            }
+        }
+        return bean;
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/BeanFactory.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/BeanFactory.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/BeanFactory.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,148 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.jndi;
+
+import java.util.Hashtable;
+
+import javax.naming.Name;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.apache.axis.AxisEngine;
+import org.apache.axis.MessageContext;
+import org.apache.axis.server.AxisServer;
+
+import org.globus.wsrf.security.SecurityManager;
+import org.globus.wsrf.impl.security.descriptor.ServiceSecurityConfig;
+
+import org.globus.wsrf.container.ServiceManager;
+import org.globus.gsi.jaas.JaasSubject;
+
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+ 
+import javax.security.auth.Subject;
+
+public class BeanFactory extends BasicBeanFactory {
+
+    /**
+     * Create a new Bean instance. If <code>obj</code> is of type
+     * {@link ServiceResourceRef ServiceResourceRef} the bean will be
+     * created and initialized with security credentials associated 
+     * with the current thread if the service associated with this bean
+     * has a security descriptor configured.
+     */
+    public Object getObjectInstance(Object obj, Name name, Context nameCtx,
+                                    Hashtable environment)
+        throws NamingException {
+        Subject subject = null;
+        MessageContext msgCtx = null;
+
+        if (obj instanceof ServiceResourceRef) {
+            ServiceResourceRef resource = (ServiceResourceRef)obj;
+            AxisEngine engine = resource.getAxisEngine();
+            String serviceName =  resource.getServiceName();
+            if (engine == null) {
+                throw new NamingException(i18n.getMessage("noServiceSet"));
+            }
+            if (serviceName == null) {
+                throw new NamingException(i18n.getMessage("noEngineSet"));
+            }
+
+            ServiceManager serviceManager = 
+                ServiceManager.getServiceManager((AxisServer)engine);
+            SecurityManager securityManager = 
+                SecurityManager.getManager();
+
+            try {
+                msgCtx = serviceManager.createMessageContext(serviceName);
+                ServiceSecurityConfig.initialize(msgCtx);
+                subject = securityManager.getServiceSubject(serviceName);
+            } catch (Exception e) {
+                NamingException ne = 
+                    new NamingException(i18n.getMessage("beanSecInitFailed"));
+                ne.setRootCause(e);
+                throw ne;
+            }
+        }
+
+        try {
+            if (subject == null) {
+                return getInstance(msgCtx, obj, name, nameCtx, environment);
+            } else {
+                GetInstanceAction action = 
+                    new GetInstanceAction(msgCtx, obj, name, 
+                                          nameCtx, environment);
+                return JaasSubject.doAs(subject, action);
+            } 
+        } catch (NamingException e) {
+            throw e;
+        } catch (PrivilegedActionException e) {
+            Exception cause = e.getException();
+            if (cause instanceof NamingException) {
+                throw (NamingException)cause;
+            } else {
+                NamingException nm = 
+                    new NamingException(i18n.getMessage("beanInitFailed"));
+                nm.setRootCause(cause);
+                throw nm;
+            }
+        } catch (Exception e) {
+            NamingException nm = 
+                new NamingException(i18n.getMessage("beanInitFailed"));
+            nm.setRootCause(e);
+            throw nm;
+        }
+    }
+
+    private Object getInstance(MessageContext msgCtx, Object obj, Name name,
+                               Context nameCtx, Hashtable environment)
+        throws NamingException {
+        MessageContext oldCtx = 
+            ServiceManager.HelperAxisEngine.getCurrentMessageContext();
+        ServiceManager.HelperAxisEngine.setCurrentMessageContext(msgCtx);
+        try {
+            return super.getObjectInstance(obj, name, nameCtx, environment);
+        } finally {
+            ServiceManager.HelperAxisEngine.setCurrentMessageContext(oldCtx);
+        }
+    }
+    
+    private class GetInstanceAction implements PrivilegedExceptionAction {
+
+        private MessageContext msgCtx;
+        private Object obj;
+        private Name name;
+        private Context nameCtx;
+        private Hashtable environment;
+
+        private GetInstanceAction(MessageContext msgCtx, Object obj, Name name,
+                                  Context nameCtx, Hashtable environment) {
+            this.msgCtx = msgCtx;
+            this.obj = obj;
+            this.name = name;
+            this.nameCtx = nameCtx;
+            this.environment = environment;
+        }
+
+        public Object run() throws Exception {
+            return getInstance(this.msgCtx, this.obj, this.name, 
+                               this.nameCtx, this.environment);
+        }
+    }
+    
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/Initializable.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/Initializable.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/Initializable.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,26 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.jndi;
+
+/**
+ * Used with {@link org.globus.wsrf.jndi.BeanFactory BeanFactory}. The initialize() method will
+ * be called if the bean implements this interface.
+ */
+public interface Initializable {
+
+    void initialize() throws Exception;
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/JNDIUtils.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/JNDIUtils.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/JNDIUtils.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,449 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.jndi;
+
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.StringTokenizer;
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import javax.naming.NamingEnumeration;
+import javax.naming.NameClassPair;
+
+import org.apache.naming.ContextBindings;
+import org.apache.naming.SynchronizedContext;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.AxisEngine;
+import org.apache.axis.MessageContext;
+import org.apache.axis.Constants;
+
+import org.globus.tools.DeployConstants;
+import org.globus.wsrf.config.ContainerConfig;
+import org.globus.wsrf.tools.jndi.JNDIConfigRuleSet;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+import org.xml.sax.SAXException;
+
+/**
+ * A utility class containing methods for setting up the JNDI environment and
+ * performing JNDI lookups
+ */
+public class JNDIUtils
+{
+    //TODO: most of these methods should be internal only
+    private static Log logger =
+        LogFactory.getLog(JNDIUtils.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    public static final String JNDI_CONFIG = "jndi-config.xml";
+
+    private static Context initialContext = null;
+
+    /**
+     * Configure JNDI with the Apache Tomcat naming service classes and create
+     * the comp and env contexts
+     *
+     * @return The initial context
+     * @throws Exception
+     */
+    public static Context initJNDI()
+        throws Exception
+    {
+        Context result = null;
+        Context compContext = null;
+
+        // set up naming
+
+        String value = "org.apache.naming";
+        String oldValue =
+            System.getProperty(javax.naming.Context.URL_PKG_PREFIXES);
+
+        if(oldValue != null)
+        {
+            if(oldValue.startsWith(value + ":"))
+            {
+                value = oldValue;
+            }
+            else
+            {
+                value = value + ":" + oldValue;
+            }
+        }
+
+        System.setProperty(javax.naming.Context.URL_PKG_PREFIXES, value);
+
+        value = System.getProperty(
+            javax.naming.Context.INITIAL_CONTEXT_FACTORY);
+
+        if(value == null)
+        {
+            System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
+                               "org.apache.naming.java.javaURLContextFactory");
+        }
+        else
+        {
+            logger.debug(i18n.getMessage("initialContextFactorySet", value));
+        }
+
+        Hashtable env = new Hashtable();
+        env.put(SynchronizedContext.SYNCHRONIZED, "true");
+
+        result = new InitialContext(env);
+        if(!ContextBindings.isClassLoaderBound())
+        {
+            ContextBindings.bindContext("wsrfContext", result);
+            ContextBindings.bindClassLoader("wsrfContext");
+        }
+
+        try
+        {
+            result.lookup("java:comp/env");
+        }
+        catch(NameNotFoundException e)
+        {
+            compContext = result.createSubcontext("comp");
+            compContext.createSubcontext("env");
+        }
+        return result;
+    }
+
+    /**
+     * Get the location of the JNDI configuration file from the deployment
+     * descriptor
+     *
+     * @param messageContext The message context to use for discovering
+     *                       deployment information
+     * @return Location of JNDI configuration file relative to the root of the
+     *         installation
+     */
+    public static String getJNDIConfigFileName(MessageContext messageContext)
+    {
+        String file = null;
+        if(messageContext != null)
+        {
+            AxisEngine engine = messageContext.getAxisEngine();
+            ContainerConfig config = ContainerConfig.getConfig(engine);
+            file = config.getOption(i18n.getMessage("jndiConfigFileOption"));
+        }
+        return (file == null) ? "etc/" + JNDI_CONFIG : file;
+    }
+
+    /**
+     * Parse the given JNDI configuration and populate the JNDI registry using
+     * the parsed configuration
+     *
+     * @param configInput The configuration stream to parse
+     * @throws Exception
+     */
+    public static void parseJNDIConfig(InputStream configInput)
+        throws Exception
+    {
+        parseJNDIConfig(new InitialContext(), configInput, null);
+    }
+
+    /**
+     * Parse the given JNDI configuration and populate the JNDI registry using
+     * the parsed configuration
+     *
+     * @param configInput The configuration stream to parse
+     * @throws Exception
+     */
+    public static void parseJNDIConfig(Context initContext, 
+                                       InputStream configInput,
+                                       AxisEngine engine)
+        throws NamingException, IOException, SAXException 
+    {
+
+        if (configInput == null)
+        {
+            throw new IllegalArgumentException(
+                i18n.getMessage("nullJNDIConfigInput"));
+        }
+
+        if (initContext == null)
+        {
+            throw new IllegalArgumentException();
+        }
+
+        Context envContext = (Context) initContext.lookup("java:comp/env");
+        Digester digester = new Digester();
+
+        // Don't do any validation for now
+        // TODO: Need to write a real schema for this stuff
+
+        digester.setNamespaceAware(true);
+        digester.setValidating(false);
+        digester.addRuleSet(new JNDIConfigRuleSet("jndiConfig/"));
+        digester.push(new NamingContext(envContext, engine));
+        digester.parse(configInput);
+        digester.clear();
+    }
+
+    /**
+     * Retrieves the named object on the specified context. The object returned
+     * must be of assignable from the type specified.
+     *
+     * @param context the context to perform lookup on
+     * @param name    the name of the object to lookup
+     * @param type    the expected type of the object returned
+     */
+    public static Object lookup(
+        Context context,
+        String name,
+        Class type)
+        throws NamingException
+    {
+        if(context == null)
+        {
+            throw new IllegalArgumentException(i18n.getMessage(
+                "nullArgument", "context"));
+        }
+        if(type == null)
+        {
+            throw new IllegalArgumentException(i18n.getMessage(
+                "nullArgument", "type"));
+        }
+        Object tmp = context.lookup(name);
+        if(type.isAssignableFrom(tmp.getClass()))
+        {
+            return tmp;
+        }
+        else
+        {
+            throw new NamingException(i18n.getMessage(
+                "expectedType", type.getName()));
+        }
+    }
+
+    private static class DirFilter implements FileFilter {
+        public boolean accept(File path) {
+            return path.isDirectory();
+        }
+    }
+
+    // multiple file configuration
+    public static synchronized Context initializeDir(MessageContext msgCtx) 
+        throws Exception 
+    {
+        if (initialContext == null)
+        {
+            Context context = initJNDI();
+
+            String configProfile = 
+                (String)msgCtx.getProperty(ContainerConfig.CONFIG_PROFILE);
+
+            String configFile = (configProfile == null) ? 
+                JNDI_CONFIG : configProfile + "-" + JNDI_CONFIG;
+
+            String dir =
+                (String)msgCtx.getProperty(Constants.MC_CONFIGPATH);
+
+            String configDir = (dir == null) ?
+                DeployConstants.CONFIG_BASE_DIR :
+                dir + File.separator + DeployConstants.CONFIG_BASE_DIR;
+            
+            File fDir = new File(configDir);
+            File [] dirs = fDir.listFiles(new DirFilter());
+            for (int i = 0; i < dirs.length; i++) 
+            {
+                processJNDIFile(context, dirs[i], 
+                                msgCtx.getAxisEngine(), configFile);
+            }
+            
+            initialContext = context;
+        }
+
+        return initialContext;
+    }
+
+    private static void processJNDIFile(Context context, 
+                                        File dir,
+                                        AxisEngine engine,
+                                        String configFile)
+        throws Exception 
+    {
+        File file = new File(dir, configFile);
+        if (!file.exists()) 
+        {
+            return;
+        }
+
+        logger.debug("Loading jndi configuration from file: " + file);
+
+        InputStream in = null;
+        try
+        {
+            in = new FileInputStream(file);
+            parseJNDIConfig(context, in, engine);
+        } 
+        catch (NamingException e)
+        {
+            throw e;
+        }
+        catch (Exception e)
+        {
+            NamingException ex = 
+                new NamingException(i18n.getMessage("jndiConfigParseError",
+                                                    file));
+            ex.setRootCause(e);
+            throw ex;
+        }
+        finally 
+        {
+            if (in != null) 
+            {
+                try 
+                {
+                    in.close();
+                } 
+                catch (IOException e) 
+                {
+                }
+            }
+        }
+    }
+
+    // single file configuration
+    public static synchronized Context initializeFile(MessageContext msgCtx) 
+        throws Exception 
+    {
+        if (initialContext == null)
+        {
+            Context context = initJNDI();
+
+            InputStream configInput;
+            String configFileName =
+                JNDIUtils.getJNDIConfigFileName(msgCtx);
+            try
+            {
+                String cfgDir = null;
+                if (msgCtx == null) 
+                {
+                    cfgDir = ContainerConfig.getGlobusLocation();
+                } 
+                else 
+                {
+                    cfgDir = (String)msgCtx.getProperty(Constants.MC_CONFIGPATH);
+                    if (cfgDir == null) 
+                    {
+                        cfgDir = ".";
+                    }
+                }
+                String file = cfgDir + File.separator + configFileName;
+                logger.debug(
+                        "Trying to load jndi configuration from file: " +
+                        file);
+
+                configInput = new FileInputStream(file);
+            }
+            catch (FileNotFoundException e)
+            {
+                logger.debug(
+                             "Trying to load jndi configuration from resource stream: " + configFileName);
+
+                configInput =
+                    JNDIUtils.class.getClassLoader().getResourceAsStream(
+                                                      configFileName
+                                                      );
+
+                if (configInput == null)
+                {
+                    throw new IOException(
+                               i18n.getMessage("jndiConfigNotFound"));
+                }
+            }
+
+            parseJNDIConfig(context, configInput, msgCtx.getAxisEngine());
+            
+            initialContext = context;
+        }
+
+        return initialContext;
+    }
+
+    public static String toString(Context ctx, String name) 
+        throws NamingException
+    {
+        StringBuffer buf = new StringBuffer();
+        toString(buf, ctx, name, "");
+        return buf.toString();
+    }
+        
+    private static void toString(StringBuffer buf, Context ctx, 
+                                 String name, String tab)
+        throws NamingException
+    {
+        buf.append(tab).append("context: ").append(name).append("\n");
+        NamingEnumeration list = ctx.list(name);
+        while (list.hasMore()) 
+        {
+            NameClassPair nc = (NameClassPair)list.next();
+            if (nc.getClassName().equals("org.apache.naming.NamingContext")) 
+            {
+                toString(buf, ctx, name + "/" + nc.getName(), tab + "  ");
+            } 
+            else 
+            {
+                buf.append(tab).append(" ").append(nc).append("\n");
+            }
+        }
+    }
+    
+    /**
+     * Create all intermediate subcontexts.
+     */
+    public static Context createSubcontexts(Context currentContext,
+                                            String name)
+        throws NamingException 
+    {
+        StringTokenizer tokenizer = new StringTokenizer(name, "/");
+
+        while(tokenizer.hasMoreTokens())
+        {
+            String token = tokenizer.nextToken();
+            if((!token.equals("")) && (tokenizer.hasMoreTokens()))
+            {
+                try
+                {
+                    currentContext = currentContext.createSubcontext(token);
+                }
+                catch(NamingException e)
+                {
+                    // Silent catch. Probably an object is already bound in
+                    // the context.
+                    currentContext = (Context) currentContext.lookup(token);
+                }
+            }
+        }
+
+        return currentContext;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/NamingContext.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/NamingContext.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/NamingContext.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,335 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.jndi;
+
+import java.util.Iterator;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.naming.Context;
+import javax.naming.LinkRef;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+import javax.naming.NameNotFoundException;
+
+import org.apache.naming.ResourceRef;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.tools.jndi.ConfigContext;
+import org.globus.wsrf.tools.jndi.Environment;
+import org.globus.wsrf.tools.jndi.Resource;
+import org.globus.wsrf.tools.jndi.ResourceLink;
+import org.globus.wsrf.tools.jndi.ResourceParameters;
+import org.globus.wsrf.utils.Resources;
+import org.globus.util.I18n;
+
+import org.apache.axis.AxisEngine;
+
+public class NamingContext
+{
+    private static Log logger =
+        LogFactory.getLog(NamingContext.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    private Context context;
+    private AxisEngine engine;
+
+    public NamingContext(Context context, AxisEngine engine)
+    {
+        this.context = context;
+        this.engine = engine;
+    }
+
+    public void addEnvironment(Environment environment)
+        throws IllegalArgumentException, NamingException
+    {
+        Object value = null;
+
+        // Instantiate a new instance of the correct object type, and
+        // initialize it.
+
+        String type = environment.getType();
+
+        try
+        {
+            if(type.equals("java.lang.String"))
+            {
+                value = environment.getValue();
+            }
+            else if(type.equals("java.lang.Byte"))
+            {
+                if(environment.getValue() == null)
+                {
+                    value = new Byte((byte) 0);
+                }
+                else
+                {
+                    value = Byte.decode(environment.getValue());
+                }
+            }
+            else if(type.equals("java.lang.Short"))
+            {
+                if(environment.getValue() == null)
+                {
+                    value = new Short((short) 0);
+                }
+                else
+                {
+                    value = Short.decode(environment.getValue());
+                }
+            }
+            else if(type.equals("java.lang.Integer"))
+            {
+                if(environment.getValue() == null)
+                {
+                    value = new Integer(0);
+                }
+                else
+                {
+                    value = Integer.decode(environment.getValue());
+                }
+            }
+            else if(type.equals("java.lang.Long"))
+            {
+                if(environment.getValue() == null)
+                {
+                    value = new Long(0);
+                }
+                else
+                {
+                    value = Long.decode(environment.getValue());
+                }
+            }
+            else if(type.equals("java.lang.Boolean"))
+            {
+                value = Boolean.valueOf(environment.getValue());
+            }
+            else if(type.equals("java.lang.Double"))
+            {
+                if(environment.getValue() == null)
+                {
+                    value = new Double(0);
+                }
+                else
+                {
+                    value = Double.valueOf(environment.getValue());
+                }
+            }
+            else if(type.equals("java.lang.Float"))
+            {
+                if(environment.getValue() == null)
+                {
+                    value = new Float(0);
+                }
+                else
+                {
+                    value = Float.valueOf(environment.getValue());
+                }
+            }
+            else if(type.equals("java.lang.Character"))
+            {
+                if(environment.getValue() == null)
+                {
+                    value = new Character((char) 0);
+                }
+                else
+                {
+                    if(environment.getValue().length() == 1)
+                    {
+                        value = new Character(environment.getValue().charAt(0));
+                    }
+                    else
+                    {
+                        throw new IllegalArgumentException();
+                    }
+                }
+            }
+            else
+            {
+                throw new IllegalArgumentException(
+                    i18n.getMessage("invalidType", type));
+            }
+        }
+        catch(NumberFormatException e)
+        {
+            String msg = i18n.getMessage("invalidValueForType",
+                                         new Object[]{environment.getValue(),
+                                                      type});
+            logger.error(msg, e);
+            throw new IllegalArgumentException(msg);
+        }
+        // Bind the object to the appropriate name
+        createSubcontexts(environment.getName());
+        this.context.bind(environment.getName(), value);
+        if(logger.isDebugEnabled())
+        {
+            logger.debug("Added environment entry with name: " +
+                         environment.getName());
+            logger.debug("value: " + value + " and type: " +
+                         environment.getType());
+        }
+    }
+
+    public void addResource(Resource resource)
+        throws NamingException
+    {
+        Reference reference = new ResourceRef(resource.getType(),
+                                              resource.getDescription(),
+                                              resource.getScope(),
+                                              resource.getAuth());
+        this.addParameters(reference, resource.getParameters());
+        this.createSubcontexts(resource.getName());
+        this.context.bind(resource.getName(), reference);
+        logger.debug("Added resource entry with name: " +
+                     resource.getName());
+    }
+
+    public void addServiceResource(Resource resource, String serviceName)
+        throws NamingException
+    {
+        Reference reference = new ServiceResourceRef(resource.getType(),
+                                                     resource.getDescription(),
+                                                     resource.getScope(),
+                                                     resource.getAuth(),
+                                                     this.engine,
+                                                     serviceName);
+        this.addParameters(reference, resource.getParameters());
+        this.createSubcontexts(resource.getName());
+        this.context.bind(resource.getName(), reference);
+        logger.debug("Added service resource entry with name: " +
+                     resource.getName());
+    }
+    
+    public void addResourceLink(ResourceLink resourceLink)
+        throws NamingException
+    {
+        LinkRef link = new LinkRef(resourceLink.getTarget());
+        this.createSubcontexts(resourceLink.getName());
+        this.context.bind(resourceLink.getName(), link);
+        if(logger.isDebugEnabled())
+        {
+            logger.debug("Added resource link with name: " +
+                         resourceLink.getName());
+            logger.debug("Pointing to: " +
+                         resourceLink.getTarget());
+        }
+    }
+
+    public void addSubContext(ConfigContext subContext)
+        throws NamingException
+    {
+        addService(subContext);
+    }
+
+    public void addService(ConfigContext subContext)
+        throws NamingException
+    {
+        String serviceName = subContext.getName();
+        Set names;
+        Iterator nameIterator;
+        NamingContext newContext;
+
+
+        Context servicesContext = null;
+        try 
+        {
+            servicesContext = (Context)this.context.lookup("services");
+        } 
+        catch (NameNotFoundException e) 
+        {
+            servicesContext = this.context.createSubcontext("services");
+        }
+
+        JNDIUtils.createSubcontexts(servicesContext, serviceName);
+
+        try
+        {
+            newContext = new NamingContext(
+                servicesContext.createSubcontext(serviceName),
+                this.engine);
+            logger.debug("Created new subcontext with name: " +
+                         serviceName);
+        }
+        catch(Exception e)
+        {
+            newContext = new NamingContext(
+                (Context) servicesContext.lookup(serviceName),
+                this.engine);
+            logger.debug("Adding entries to existing subcontext with name: " +
+                         serviceName);
+        }
+                
+        names = subContext.getEnvironmentNames();
+        nameIterator = names.iterator();
+
+        while(nameIterator.hasNext())
+        {
+            newContext.addEnvironment(
+                subContext.getEnvironment((String) nameIterator.next()));
+        }
+
+        names = subContext.getResourceNames();
+        nameIterator = names.iterator();
+
+        while(nameIterator.hasNext())
+        {
+            newContext.addServiceResource(
+                subContext.getResource((String) nameIterator.next()),
+                serviceName);
+        }
+
+        names = subContext.getResourceLinkNames();
+        nameIterator = names.iterator();
+
+        while(nameIterator.hasNext())
+        {
+            newContext.addResourceLink(
+                subContext.getResourceLink((String) nameIterator.next()));
+        }
+    }
+
+    private void createSubcontexts(String name)
+        throws NamingException
+    {
+        JNDIUtils.createSubcontexts(this.context, name);
+    }
+
+    private void addParameters(
+        Reference reference,
+        ResourceParameters parameters)
+    {
+        if(parameters != null)
+        {
+            Set names = parameters.getParameterNames();
+            Iterator nameIterator = names.iterator();
+            RefAddr parameter;
+            String parameterName;
+            while(nameIterator.hasNext())
+            {
+                parameterName = (String) nameIterator.next();
+                parameter = new StringRefAddr(parameterName,
+                                              parameters.getParameter(
+                                                  parameterName));
+                reference.add(parameter);
+            }
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/ServiceResourceRef.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/ServiceResourceRef.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/jndi/ServiceResourceRef.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,41 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.jndi;
+
+import org.apache.axis.AxisEngine;
+
+public class ServiceResourceRef extends org.apache.naming.ResourceRef {
+    
+    private AxisEngine engine;
+    private String name;
+
+    public ServiceResourceRef(String resourceClass, String description, 
+                              String scope, String auth,
+                              AxisEngine engine, String serviceName) {
+        super(resourceClass, description, scope, auth, null, null);
+        this.engine = engine;
+        this.name = serviceName;
+    }
+    
+    public AxisEngine getAxisEngine() {
+        return this.engine;
+    }
+    
+    public String getServiceName() {
+        return this.name;
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/query/ExpressionEvaluator.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/query/ExpressionEvaluator.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/query/ExpressionEvaluator.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,68 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.query;
+
+import org.globus.wsrf.ResourcePropertySet;
+
+import org.oasis.wsrf.properties.QueryExpressionType;
+
+/**
+ * An <code>ExpressionEvaluator</code> is used to implement a query expression
+ * evaluation of a <code>ResourcePropertySet</code>. An evaluator can be
+ * registered with a <code>QueryEngine</code>, which in turn calls the 
+ * evaluator when a matching expression is found.
+ *
+ * @see ResourcePropertySet
+ * @see QueryEngine
+ */
+public interface ExpressionEvaluator {
+
+    /**
+     * Evaluates the expression over a ResourcePropertySet and returns the 
+     * result.
+     *
+     * @param expression object passed by client representing query expression.
+     * @param resourcePropertySet ResourcePropertySet associated with resource.
+     *        The expression is evaluated against this set.
+     * @return the result of the evaluation which depends on the expression.
+     *         The results must be an xml serializable object in order to be 
+     *         passed back correctly to a remote client. 
+     *         The easiest way of achieving this is to model it as a Bean, or
+     *         simply return a <code>SOAPElment</code> or 
+     *         <code>DOM Element</code>. 
+     *         If the result object returned is null an empty query result
+     *         is returned.
+     * @throws UnsupportedQueryDialectException if query dialect is 
+     *         unsupported.
+     * @throws QueryEvaluationException if query evaluation fails.
+     * @throws InvalidQueryExpressionException if query expression is invalid.
+     * @throws QueryException if any other error
+     */
+    public Object evaluate(QueryExpressionType expression,
+                           ResourcePropertySet resourcePropertySet)
+        throws UnsupportedQueryDialectException,
+               QueryEvaluationException,
+               InvalidQueryExpressionException,
+               QueryException;
+    
+    /**
+     * Gets the list of dialects that this evaluator can handle.
+     *
+     * @return list of dialects supported by this evaluator.
+     */
+    public String[] getDialects();
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/query/InvalidQueryExpressionException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/query/InvalidQueryExpressionException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/query/InvalidQueryExpressionException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,59 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.query;
+
+/**
+ * This exception is raised when the query expression is invalid.
+ */
+public class InvalidQueryExpressionException extends QueryException {
+
+    /**
+     * Creates a InvalidQueryExpressionException without error message.
+     */
+    public InvalidQueryExpressionException() {
+    }
+
+    /**
+     * Creates a InvalidQueryExpressionException with a given error message.
+     *
+     * @param message error message
+     */
+    public InvalidQueryExpressionException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a InvalidQueryExpressionException with a given error message
+     * and nested exception.
+     *
+     * @param message error message
+     * @param exception nested exception/
+     */
+    public InvalidQueryExpressionException(String message,
+                                           Throwable exception) {
+        super(message, exception);
+    }
+
+    /**
+     * Creates a InvalidQueryExpressionException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public InvalidQueryExpressionException(Throwable exception) {
+        super("", exception);
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/query/QueryEngine.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/query/QueryEngine.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/query/QueryEngine.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,76 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.query;
+
+import org.globus.wsrf.ResourcePropertySet;
+import org.oasis.wsrf.properties.QueryExpressionType;
+
+/**
+ * The <code>QueryEngine</code> interface is used to map queries on the service
+ * data of a service to the appropriate <code>ExpressionEvaluators</code> and
+ * then return the result. <code>ExpressionEvaluators</code> can be
+ * preconfigured or dynamically added at runtime.
+ * @see ExpressionEvaluator
+ */
+public interface QueryEngine {
+
+    /**
+     * registers a new evaluator that can be used to evaluate queries on a
+     * service.
+     * @param evaluator implementation of evaluator to be used for evaluating
+     * queries
+     * specified in its XML Schema definition.
+     */
+    public void registerEvaluator(ExpressionEvaluator evaluator);
+
+    /**
+     * Executes a query against a resource property set. The appropraite
+     * ExpressionEvaluator is used for the query based on the dialect
+     * attribute.
+     *
+     * @param queryExpression query expression
+     * @param resourcePropertySet resource properties set to execute the query
+     *        against
+     * @return the result of the evaluation which depends on the expression.
+     *         The results must be an xml serializable object in order to be
+     *         passed back correctly to a remote client.
+     *         The easiest way of achieving this is to model it as a Bean, or
+     *         simply return a <code>SOAPElment</code> or
+     *         <code>DOM Element</code>.
+     *         If the result object returned is null an empty query result
+     *         is returned.
+     * @throws UnsupportedQueryDialectException if query dialect is
+     *         unsupported.
+     * @throws QueryEvaluationException if query evaluation fails.
+     * @throws InvalidQueryExpressionException if query expression is invalid.
+     * @throws QueryException if any other error
+     */
+    public Object executeQuery(QueryExpressionType queryExpression,
+                               ResourcePropertySet resourcePropertySet)
+        throws UnsupportedQueryDialectException,
+               QueryEvaluationException,
+               InvalidQueryExpressionException,
+               QueryException;
+
+    /**
+     * Gets the evaluator currently registered to handle an expression of the
+     * specified qualified name (from the top level element of the XML Schema
+     * definition of the expression)
+     * @return the matching expression evaluator or null if none was found
+     */
+    public ExpressionEvaluator getEvaluator(String dialect);
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/query/QueryEvaluationException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/query/QueryEvaluationException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/query/QueryEvaluationException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,59 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.query;
+
+/**
+ * This exception is raised when evaluation of a query fails.
+ */
+public class QueryEvaluationException extends QueryException {
+
+    /**
+     * Creates a QueryEvaluationException without error message.
+     */
+    public QueryEvaluationException() {
+    }
+
+    /**
+     * Creates a QueryEvaluationException with a given error message.
+     *
+     * @param message error message
+     */
+    public QueryEvaluationException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a QueryEvaluationException with a given error message and nested
+     * exception.
+     *
+     * @param message error message
+     * @param exception nested exception
+     */
+    public QueryEvaluationException(String message,
+                                    Throwable exception) {
+        super(message, exception);
+    }
+
+    /**
+     * Creates a QueryEvaluationException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public QueryEvaluationException(Throwable exception) {
+        super("", exception);
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/query/QueryException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/query/QueryException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/query/QueryException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,62 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.query;
+
+import org.globus.common.ChainedException;
+
+/**
+ * This is a basic exception raised by <code>QueryEngine</code> or 
+ * <code>ExpressionEvaluator</code>.
+ */
+public class QueryException extends ChainedException {
+
+    /**
+     * Creates a QueryException without error message.
+     */
+    public QueryException() {
+    }
+    
+    /**
+     * Creates a QueryException with a given error message.
+     *
+     * @param message error message
+     */
+    public QueryException(String message) {
+        super(message);
+    }
+    
+    /**
+     * Creates a QueryException with a given error message and nested
+     * exception.
+     *
+     * @param message error message
+     * @param exception nested exception/
+     */
+    public QueryException(String message,
+                          Throwable exception) {
+        super(message, exception);
+    }
+    
+    /**
+     * Creates a QueryException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public QueryException(Throwable exception) {
+        super("", exception);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/query/UnsupportedQueryDialectException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/query/UnsupportedQueryDialectException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/query/UnsupportedQueryDialectException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,59 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.query;
+
+/**
+ * This exception is raised if the given query dialect is unsupported.
+ */
+public class UnsupportedQueryDialectException extends QueryException {
+
+    /**
+     * Creates a UnsupportedQueryDialectException without error message.
+     */
+    public UnsupportedQueryDialectException() {
+    }
+    
+    /**
+     * Creates a UnsupportedQueryDialectException with a given error message.
+     *
+     * @param message error message
+     */
+    public UnsupportedQueryDialectException(String message) {
+        super(message);
+    }
+    
+    /**
+     * Creates a UnsupportedQueryDialectException with a given error message 
+     * and nested exception.
+     *
+     * @param message error message
+     * @param exception nested exception/
+     */
+    public UnsupportedQueryDialectException(String message,
+                                            Throwable exception) {
+        super(message, exception);
+    }
+    
+    /**
+     * Creates a UnsupportedQueryDialectException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public UnsupportedQueryDialectException(Throwable exception) {
+        super("", exception);
+    }
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/InvalidTopicExpressionException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/InvalidTopicExpressionException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/InvalidTopicExpressionException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,61 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.topicexpression;
+
+/**
+ * This exception is raised when the topic expression is invalid.
+ */
+public class InvalidTopicExpressionException extends TopicExpressionException
+{
+    /**
+     * Creates a InvalidTopicExpressionException without error message.
+     */
+    public InvalidTopicExpressionException()
+    {
+    }
+
+    /**
+     * Creates a InvalidTopicExpressionException with a given error message.
+     *
+     * @param message error message
+     */
+    public InvalidTopicExpressionException(String message)
+    {
+        super(message);
+    }
+
+    /**
+     * Creates a InvalidTopicExpressionException with a given error message
+     * and nested exception.
+     *
+     * @param message error message
+     * @param exception nested exception/
+     */
+    public InvalidTopicExpressionException(String message, Throwable exception)
+    {
+        super(message, exception);
+    }
+
+    /**
+     * Creates a InvalidTopicExpressionException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public InvalidTopicExpressionException(Throwable exception)
+    {
+        super(exception);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionEngine.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionEngine.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionEngine.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,105 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.topicexpression;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.globus.wsrf.TopicList;
+import org.oasis.wsn.TopicExpressionType;
+
+/**
+ * The <code>TopicExpressionEngine</code> interface is used to map queries on a
+ * topic list to the appropriate <code>TopicExpressionEvaluators</code> and then
+ * return the result. <code>TopicExpressionEvaluators</code> can be
+ * preconfigured or dynamically added at runtime.
+ *
+ * @see TopicExpressionEvaluator
+ */
+public interface TopicExpressionEngine
+{
+    /**
+     * registers a new evaluator that can be used to evaluate topic expressions
+     *
+     * @param evaluator implementation of evaluator to be used for evaluating
+     *                  topic expressions
+     */
+    public void registerEvaluator(TopicExpressionEvaluator evaluator);
+
+    /**
+     * Resolves a topic expression using the passed topic list. The appropraite
+     * TopicExpressionEvaluator is used based on the dialect element.
+     *
+     * @param topicExpression topic expression
+     * @param topicList       the topic list to apply the expression to
+     * @return the set of topics the expression evaluated to
+     * @throws UnsupportedTopicExpressionDialectException
+     *                                  if the topic expression dialect is not
+     *                                  supported
+     * @throws TopicExpressionResolutionException
+     *                                  if the expression could not be
+     *                                  evaluated
+     * @throws InvalidTopicExpressionException
+     *                                  if the topic expression is invalid
+     * @throws TopicExpressionException if any other error occurs
+     */
+    public Collection resolveTopicExpression(
+        TopicExpressionType topicExpression,
+        TopicList topicList) throws UnsupportedTopicExpressionDialectException,
+                                    TopicExpressionResolutionException,
+                                    InvalidTopicExpressionException,
+                                    TopicExpressionException;
+
+    /**
+     * Converts the expression from dialect specific form to a ordered list of
+     * QNames. This method throws an exception if the expression does not
+     * evaluate to a concrete topic path.
+     *
+     * @param topicExpression topic expression
+     * @return a list of QNames describing the concrete topic path
+     * @throws UnsupportedTopicExpressionDialectException
+     *                                  if the topic expression dialect is not
+     *                                  supported
+     * @throws TopicExpressionResolutionException
+     *                                  if the expression could not be
+     *                                  evaluated
+     * @throws InvalidTopicExpressionException
+     *                                  if the topic expression is invalid
+     * @throws TopicExpressionException if any other error occurs
+     */
+    public List getConcretePath(TopicExpressionType topicExpression)
+        throws UnsupportedTopicExpressionDialectException,
+               TopicExpressionResolutionException,
+               InvalidTopicExpressionException,
+               TopicExpressionException;
+
+    /**
+     * Gets the evaluator currently registered to handle a topic expression of
+     * the specified dialect.
+     *
+     * @return the matching topic expression evaluator or null if none was
+     *         found
+     */
+    public TopicExpressionEvaluator getEvaluator(String dialect);
+
+    /**
+     * Returns a list of URIs representing the registered topic expression
+     * dialects
+     *
+     * @return the list of supported dialects
+     */
+    public String[] getSupportedDialects();
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionEvaluator.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionEvaluator.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionEvaluator.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,102 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.topicexpression;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.globus.wsrf.TopicList;
+import org.oasis.wsn.TopicExpressionType;
+
+/**
+ * A <code>TopicExpressionEvaluator</code> is used to implement a topic
+ * expression evaluation against a <code>TopicList</code>. An evaluator can be
+ * registered with a <code>TopicExpressionEngine</code>, which in turn calls the
+ * evaluator when a matching expression is found.
+ *
+ * @see org.globus.wsrf.TopicList
+ * @see org.globus.wsrf.topicexpression.TopicExpressionEngine
+ */
+public interface TopicExpressionEvaluator
+{
+
+    /**
+     * Evaluates the expression over a TopicList and returns the result.
+     *
+     * @param expression object passed by client representing the topic
+     *                   expression
+     * @param topicList  topic list associated with the service/resource
+     * @return the result of the evaluation which depends on the expression.
+     * @throws UnsupportedTopicExpressionDialectException
+     *                                  if the topic expression dialect is not
+     *                                  supported
+     * @throws TopicExpressionResolutionException
+     *                                  if the expression could not be
+     *                                  evaluated
+     * @throws InvalidTopicExpressionException
+     *                                  if the topic expression is invalid
+     * @throws TopicExpressionException if any other error occurs
+     */
+    public Collection resolve(
+        TopicExpressionType expression,
+        TopicList topicList)
+        throws UnsupportedTopicExpressionDialectException,
+               TopicExpressionResolutionException,
+               InvalidTopicExpressionException,
+               TopicExpressionException;
+
+    /**
+     * Gets the URIs for the dialects that this evaluator can handle
+     *
+     * @return array of URIs supported by this evaluator
+     */
+    public String[] getDialects();
+
+    /**
+     * Converts the expression from dialect specific form to a ordered list of
+     * QNames. This method throws an exception if the expression does not
+     * evaluate to a concrete topic path.
+     *
+     * @param expression object passed by client representing the topic
+     *                   expression
+     * @return a list of QNames describing the concrete topic path
+     * @throws UnsupportedTopicExpressionDialectException
+     *                                  if the topic expression dialect is not
+     *                                  supported
+     * @throws InvalidTopicExpressionException
+     *                                  if the topic expression is invalid
+     * @throws TopicExpressionException if any other error occurs
+     */
+    public List getConcreteTopicPath(TopicExpressionType expression)
+        throws UnsupportedTopicExpressionDialectException,
+               InvalidTopicExpressionException,
+               TopicExpressionException;
+
+    /**
+     * Converts a topic path (list of QNames) to a dialect specific concrete
+     * topic expression.
+     *
+     * @param topicPath containing a list of QNames describing a concrete topic
+     *                  path
+     * @return dialect specific version of the topic path
+     * @throws InvalidTopicExpressionException
+     *                                  if the conrete topic path is invalid
+     * @throws TopicExpressionException if any other error occurs
+     */
+    public TopicExpressionType toTopicExpression(List topicPath)
+        throws InvalidTopicExpressionException,
+               TopicExpressionException;
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,64 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.topicexpression;
+
+import org.globus.common.ChainedException;
+
+/**
+ * This is a basic exception raised by <code>TopicExpressionEngine</code> or
+ * <code>TopicExpressionEvaluator</code>.
+ */
+public class TopicExpressionException extends ChainedException
+{
+    /**
+     * Creates a TopicExpressionException without error message.
+     */
+    public TopicExpressionException()
+    {
+    }
+
+    /**
+     * Creates a TopicExpressionException with a given error message.
+     *
+     * @param message error message
+     */
+    public TopicExpressionException(String message)
+    {
+        super(message);
+    }
+
+    /**
+     * Creates a TopicExpressionException with a given error message and nested
+     * exception.
+     *
+     * @param message error message
+     * @param exception nested exception/
+     */
+    public TopicExpressionException(String message, Throwable exception)
+    {
+        super(message, exception);
+    }
+
+    /**
+     * Creates a TopicExpressionException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public TopicExpressionException(Throwable exception)
+    {
+        super("", exception);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionResolutionException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionResolutionException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/TopicExpressionResolutionException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,63 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.topicexpression;
+
+/**
+ * This exception is raised when resolution of a topic expression fails.
+ */
+public class TopicExpressionResolutionException extends TopicExpressionException
+{
+    /**
+     * Creates a TopicExpressionResolutionException without error message.
+     */
+    public TopicExpressionResolutionException()
+    {
+    }
+
+    /**
+     * Creates a TopicExpressionResolutionException with a given error message.
+     *
+     * @param message error message
+     */
+    public TopicExpressionResolutionException(String message)
+    {
+        super(message);
+    }
+
+    /**
+     * Creates a TopicExpressionResolutionException with a given error message
+     * and nested exception.
+     *
+     * @param message   error message
+     * @param exception nested exception
+     */
+    public TopicExpressionResolutionException(
+        String message,
+        Throwable exception)
+    {
+        super(message, exception);
+    }
+
+    /**
+     * Creates a TopicExpressionResolutionException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public TopicExpressionResolutionException(Throwable exception)
+    {
+        super(exception);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/UnsupportedTopicExpressionDialectException.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/UnsupportedTopicExpressionDialectException.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/topicexpression/UnsupportedTopicExpressionDialectException.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,65 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.topicexpression;
+
+/**
+ * This exception is raised if the given topic expression dialect is
+ * unsupported.
+ */
+public class UnsupportedTopicExpressionDialectException
+    extends TopicExpressionException
+{
+    /**
+     * Creates a UnsupportedQueryDialectException without error message.
+     */
+    public UnsupportedTopicExpressionDialectException()
+    {
+    }
+
+    /**
+     * Creates a UnsupportedQueryDialectException with a given error message.
+     *
+     * @param message error message
+     */
+    public UnsupportedTopicExpressionDialectException(String message)
+    {
+        super(message);
+    }
+
+    /**
+     * Creates a UnsupportedQueryDialectException with a given error message
+     * and nested exception.
+     *
+     * @param message error message
+     * @param exception nested exception/
+     */
+    public UnsupportedTopicExpressionDialectException(
+        String message,
+        Throwable exception)
+    {
+        super(message, exception);
+    }
+
+    /**
+     * Creates a UnsupportedQueryDialectException from a nested exception.
+     *
+     * @param exception nested exception
+     */
+    public UnsupportedTopicExpressionDialectException(Throwable exception)
+    {
+        super(exception);
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/AddressingUtils.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/AddressingUtils.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/AddressingUtils.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,110 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils;
+
+import java.net.URL;
+
+import javax.xml.soap.SOAPElement;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.message.addressing.Address;
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.axis.message.addressing.ReferencePropertiesType;
+
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.container.ServiceHost;
+import org.globus.util.I18n;
+
+/**
+ * Utility class for construction WS-Addressing endpoint references and for
+ * discovering the base address of a container
+ */
+public class AddressingUtils {
+
+    static Log logger =
+        LogFactory.getLog(AddressingUtils.class.getName());
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    /**
+     * Create a endpoint reference from the given parameters
+     *
+     * @param address URL for the service
+     * @param key Resource identifier. May be null
+     * @return The endpoint reference
+     * @throws Exception
+     */
+    public static EndpointReferenceType
+        createEndpointReference(String address, ResourceKey key)
+        throws Exception {
+        EndpointReferenceType reference = new EndpointReferenceType();
+        if (key != null) {
+            ReferencePropertiesType referenceProperties =
+                new ReferencePropertiesType();
+
+            SOAPElement elem = key.toSOAPElement();
+
+            AnyHelper.setAny(referenceProperties, elem);
+
+            reference.setProperties(referenceProperties);
+        }
+
+        reference.setAddress(new Address(address));
+
+        return reference;
+    }
+
+    /**
+     * Create a endpoint reference using the current service's address and the
+     * given resource identifier
+     *
+     * @param key Resource identifier. May be null
+     * @return The endpoint reference
+     * @throws Exception
+     */
+    public static EndpointReferenceType
+        createEndpointReference(ResourceKey key)
+        throws Exception {
+        return createEndpointReference(ResourceContext.getResourceContext(),
+                                       key);
+    }
+
+    /**
+     * Create a endpoint reference using the current service's address, as
+     * specified by the resource context, and the given resource identifier
+     *
+     * @param context The resource context used for obtaining a URL for the
+     *                current service
+     * @param key     The resource identifier
+     * @return The constructed endpoint reference
+     * @throws Exception
+     */
+    public static EndpointReferenceType
+        createEndpointReference(ResourceContext context, ResourceKey key)
+        throws Exception {
+        if (context == null) {
+            throw new IllegalArgumentException(i18n.getMessage(
+                "nullArgument", "context"));
+        }
+        URL baseURL = ServiceHost.getBaseURL();
+        String serviceURI = baseURL.toString() + context.getService();
+        return createEndpointReference(serviceURI, key);
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/AnyHelper.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/AnyHelper.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/AnyHelper.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,350 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils;
+
+import java.io.Writer;
+import java.io.StringWriter;
+import java.io.StringReader;
+import java.util.List;
+
+import javax.xml.soap.SOAPElement;
+
+import org.apache.axis.MessageContext;
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.message.Text;
+import org.apache.axis.encoding.AnyContentType;
+import org.apache.axis.encoding.SerializationContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.config.ContainerConfig;
+
+import org.xml.sax.InputSource;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Document;
+
+/**
+ * The <code>AnyHelper</code> is a utility that provides common functions
+ * for working with <code>MessageElement</code> and beans with
+ * <code>AnyContentType</code> class.
+ * <b>Do not used this class for serialization or deserialization of
+ * objects.</b>
+ * Use {@link org.globus.wsrf.encoding.ObjectSerializer ObjectSerializer} and
+ * {@link org.globus.wsrf.encoding.ObjectDeserializer ObjectDeserializer} for
+ * that purposes instead.
+ */
+public class AnyHelper {
+    static Log logger = LogFactory.getLog(AnyHelper.class.getName());
+
+    /**
+     * Populates a SOAP MessageElement array with a single object.
+     * @param obj object to be serialized as a text node
+     * @return content of any element as a SOAP MessageElement array
+     */
+    public static MessageElement[] toText(Object obj) {
+        MessageElement[] result = new MessageElement[1];
+        result[0] = new MessageElement(new Text(obj.toString()));
+        return result;
+    }
+
+    // -------------------------------------------
+
+    /**
+     * Populates a SOAP MessageElement array with an array of arbitrary
+     * objects.
+     * @param obj array of objects to be serialized in the any element
+     * @return content of any element as a SOAP MessageElement array
+     */
+    public static MessageElement[] toAnyArray(Object[] obj) {
+        MessageElement[] result = new MessageElement[obj.length];
+        for (int i = 0; i < obj.length; i++) {
+            result[i] = toAny(obj[i]);
+        }
+        return result;
+    }
+
+    /**
+     * Populates a SOAP MessageElement array with a single object.
+     * @param obj object to be serialized in the any element
+     * @return content of any element as a SOAP MessageElement array
+     */
+    public static MessageElement[] toAnyArray(Object obj) {
+        MessageElement[] result = new MessageElement[1];
+        result[0] = toAny(obj);
+        return result;
+    }
+
+    /**
+     * Populates a SOAP MessageElement array with a single DOM element.
+     * @param element element to be inserted in the any element
+     * @return content of any element as a SOAP MessageElement array
+     */
+    public static MessageElement[] toAnyArray(Element element) {
+        MessageElement[] result = {new MessageElement(element)};
+        return result;
+    }
+
+    /**
+     * Populates a SOAP MessageElement with an arbitrary
+     * object, and wraps it inside of a value element with an xsi:type
+     * attribute. This is similar to using the xsd:any in the same way you
+     * would use xsd:anyType objects.
+     * @param obj object to be serialized in the any element
+     * @return content of any element as a SOAP MessageElement
+     */
+    public static MessageElement toAnyTypeElement(Object obj) {
+        MessageElement messageElement =
+            new MessageElement(Constants.CORE_NS, "value", obj);
+        messageElement.setType(org.apache.axis.Constants.XSD_ANYTYPE);
+        return messageElement;
+    }
+
+    /**
+     * Populates a SOAP MessageElement with an arbitrary
+     * object.
+     * @see #toAnyTypeElement(Object)
+     * @param obj object to be serialized in the any element.
+     * @return content of any element as a SOAP MessageElement
+     */
+    public static MessageElement toAny(Object obj) {
+        if (obj == null) {
+            return null;
+        }
+
+        if (obj instanceof MessageElement) {
+            return (MessageElement)obj;
+        } else if (obj instanceof Element) {
+            return new MessageElement((Element) obj);
+        }
+
+        return toAnyTypeElement(obj);
+    }
+
+    // ------------------------
+
+    public static MessageElement getParent(MessageElement element) {
+        return (element == null) ?
+            null :
+            (MessageElement)element.getParentElement();
+    }
+
+    public static MessageElement getParent(MessageElement [] elements) {
+        return (elements != null && elements.length > 0) ?
+            getParent(elements[0]) :
+            null;
+    }
+
+    public static MessageElement getParent(AnyContentType any) {
+        return (any != null) ? getParent(any.get_any()) : null;
+    }
+
+    public static void setAny(AnyContentType object, SOAPElement value) {
+        if (value == null || object == null) {
+            return;
+        }
+        if (!(value instanceof MessageElement)) {
+            throw new IllegalArgumentException();
+        }
+        object.set_any( new MessageElement[]{(MessageElement)value} );
+    }
+
+    public static void setAny(AnyContentType object, SOAPElement [] values) {
+        if (values == null || object == null) {
+            return;
+        }
+        MessageElement [] me = null;
+        if (values instanceof MessageElement[]) {
+            me = (MessageElement[])values;
+        } else {
+            me = new MessageElement[values.length];
+            for (int i=0;i<values.length;i++) {
+                if (values[i] instanceof MessageElement) {
+                    me[i] = (MessageElement)values[i];
+                } else {
+                    throw new IllegalArgumentException();
+                }
+            }
+        }
+        object.set_any(me);
+    }
+
+    public static void setAny(AnyContentType object, List values) {
+        if (values == null) {
+            return;
+        }
+        Object obj;
+        MessageElement [] v = new MessageElement[values.size()];
+        for (int i=0;i<values.size();i++) {
+            obj = values.get(i);
+            if (obj instanceof MessageElement) {
+                v[i] = (MessageElement)obj;
+            } else {
+                throw new IllegalArgumentException();
+            }
+        }
+        object.set_any( v );
+    }
+
+    public static void write(Writer writer, MessageElement element)
+        throws Exception {
+        MessageContext messageContext = ContainerConfig.getContext();
+        SerializationContext context =
+            new SerializationContext(writer, messageContext);
+        context.setPretty(true);
+        element.output(context);
+    }
+
+    // ********* toString **********
+
+    /**
+     * Converts a SOAP MessageElement to an XML String representation
+     * @param element SOAP MessageElement to be converted
+     * @return String in XML format representing the input
+     */
+    public static String toString(MessageElement element)
+        throws Exception {
+        if (element == null) {
+            return null;
+        }
+        StringWriter writer = new StringWriter();
+        write(writer, element);
+        writer.flush();
+        return writer.toString();
+    }
+
+    /**
+     * Array version of {@link #toString(MessageElement element) toString}
+     */
+    public static String[] toString(MessageElement[] elements)
+        throws Exception {
+        if (elements == null) {
+            return null;
+        }
+        String[] result = new String[elements.length];
+        for (int i = 0; i < elements.length; i++) {
+            result[i] = toString(elements[i]);
+        }
+        return result;
+    }
+
+    /**
+     *
+     */
+    public static String toSingleString(MessageElement[] elements)
+        throws Exception {
+        if (elements == null) {
+            return null;
+        }
+        MessageContext messageContext = ContainerConfig.getContext();
+        StringWriter writer = new StringWriter();
+        SerializationContext context =
+            new SerializationContext(writer, messageContext);
+        context.setPretty(true);
+        for (int i = 0; i < elements.length; i++) {
+            elements[i].output(context);
+        }
+        writer.flush();
+        return writer.toString();
+    }
+
+    /**
+     *
+     */
+    public static String toSingleString(AnyContentType any)
+        throws Exception {
+        return (any == null) ? null : toSingleString(any.get_any());
+    }
+
+    /**
+     * Converts type containing any element to a String,
+     * representing the parent MessageElement.
+     * @see #toString(MessageElement element)
+     */
+    public static String getFirstParentAsString(AnyContentType any)
+        throws Exception {
+        return toString(getParent(any));
+    }
+
+    // ****** toElement ********
+
+    /**
+     * Converts a SOAP MessageElement to a DOM Element representation
+     * @param element SOAP MessageElement to be converted
+     * @return DOM Element representing the input
+     * @throws Exception if the DOM Element could not be created
+     */
+    public static Element toElement(MessageElement element)
+        throws Exception {
+        String str = toString(element);
+        if (str == null) {
+            return null;
+        }
+        StringReader reader = new StringReader(str);
+        Document doc = XmlUtils.newDocument(new InputSource(reader));
+        return (doc == null) ? null : doc.getDocumentElement();
+    }
+
+    /**
+     * Array version of {@link #toElement(MessageElement element) toElement}
+     */
+    public static Element[] toElement(MessageElement[] elements)
+        throws Exception {
+        if (elements == null) {
+            return null;
+        }
+        Element[] result = new Element[elements.length];
+        for (int i = 0; i < elements.length; i++) {
+            result[i] = toElement(elements[i]);
+        }
+        return result;
+    }
+
+    /**
+     * Converts type containing any element to an array of DOM Elements.
+     * @see #toElement(MessageElement element)
+     */
+    public static Element[] toElement(AnyContentType any)
+        throws Exception {
+        if (any == null) {
+            return null;
+        }
+        return toElement(any.get_any());
+    }
+
+    /**
+     * Converts type containing any element to a single DOM Element,
+     * representing the parent MessageElement.
+     * @see #toElement(MessageElement element)
+     */
+    public static Element getFirstParentAsElement(AnyContentType any)
+        throws Exception {
+        return toElement(getParent(any));
+    }
+
+    /**
+     * Converts type containing any element to a single DOM Element.
+     * @see #toElement(MessageElement element)
+     */
+    public static Element getFirstAsElement(AnyContentType any)
+        throws Exception {
+        Element[] values = toElement(any);
+        return (values != null && values.length > 0) ? values[0] : null;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/ContextUtils.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/ContextUtils.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/ContextUtils.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/FaultHelper.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/FaultHelper.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/FaultHelper.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,462 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils;
+
+import org.oasis.wsrf.faults.BaseFaultType;
+import org.oasis.wsrf.faults.BaseFaultTypeDescription;
+import org.oasis.wsrf.faults.BaseFaultTypeErrorCode;
+
+import org.apache.axis.Constants;
+import org.apache.axis.utils.JavaUtils;
+import org.apache.axis.types.URI;
+
+import org.globus.util.I18n;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.util.Calendar;
+
+import org.w3c.dom.Element;
+
+/**
+ * This class provides convenience functions around BaseFault API. It also 
+ * provides a common way of including stack traces with Faults. A stack trace
+ * of a Fault is added as a chained BaseFault with an error code dialect
+ * attribute set to {@link #STACK_TRACE STACK_TRACE}. A regular Java 
+ * exception is automatically converted into a BaseFault with an error code
+ * dialect attribute set to {@link #EXCEPTION EXCEPTION}.
+ */
+public class FaultHelper {
+
+    private static final String LS = 
+        System.getProperty("line.separator");
+
+    /**
+     * Stack trace error code URI
+     */
+    public static final URI STACK_TRACE;
+
+    /**
+     * Exception error code URI
+     */
+    public static final URI EXCEPTION;
+
+    private static I18n i18n = I18n.getI18n(Resources.class.getName());
+
+    static {
+        try {
+            STACK_TRACE = new URI("http://www.globus.org/fault/stacktrace");
+            EXCEPTION = new URI("http://www.globus.org/fault/exception");
+        } catch(Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+    private BaseFaultType fault;
+    
+    /**
+     * Creates <code>FaultHelper</code> with a fault.
+     * If the fault contains a stack trace it will be automatically converted
+     * into a chained BaseFault with an error code dialect attribute set to
+     * set to {@link #STACK_TRACE STACK_TRACE}.
+     *
+     * @param fault fault
+     */
+    public FaultHelper(BaseFaultType fault) {
+        this(fault, true);
+    }
+
+    /**
+     * Creates <code>FaultHelper</code> with a fault.
+     *
+     * @param fault fault
+     * @param convertStackTrace if true and if the fault contains a stack trace
+     *        it will be automatically converted into a chained BaseFault with
+     *        an error code dialect attribute set to  set to 
+     *        {@link #STACK_TRACE STACK_TRACE}.
+     */
+    public FaultHelper(BaseFaultType fault, boolean convertStackTrace) {
+        if (fault == null) {
+            throw new IllegalArgumentException(i18n.getMessage(
+                    "nullArgument", "fault"));
+        }
+        this.fault = fault;
+        if (convertStackTrace) {
+            addStackTraceFault();
+        }
+        // add timestamp automatically if not set
+        if (this.fault.getTimestamp() == null) {
+            this.fault.setTimestamp(Calendar.getInstance());
+        }
+    }
+
+    /**
+     * Gets the fault.
+     */
+    public BaseFaultType getFault() {
+        return this.fault;
+    }
+    
+    /**
+     * Returns all the descriptions of the fault as a simple string.
+     */
+    public String getDescriptionAsString() {
+        BaseFaultTypeDescription [] desc = this.fault.getDescription();
+        if (desc == null) {
+            return null;
+        }
+        StringBuffer buf = new StringBuffer();
+        for (int i=0;i<desc.length;i++) {
+            buf.append(desc[i].get_value());
+            if (i+1<desc.length) {
+                buf.append(" / ");
+            }
+        }
+        return buf.toString();
+    }
+
+    /**
+     * Returns descriptions of the fault.
+     *
+     * @return the descriptions. Might be null.
+     */
+    public String[] getDescription() {
+        BaseFaultTypeDescription [] desc = this.fault.getDescription();
+        if (desc == null) {
+            return null;
+        }
+        String [] description = new String[desc.length];
+        for (int i=0;i<description.length;i++) {
+            description[i] = desc[i].get_value();
+        }
+        return description;
+    }
+
+    /**
+     * Sets the description of the fault. 
+     *
+     * @param description the new description of the fault.
+     */
+    public void setDescription(String description) {
+        setDescription((description == null) ? 
+                       null : new String [] {description});
+    }
+
+    /**
+     * Sets the description of the fault. 
+     *
+     * @param description the new descriptions of the fault.
+     */
+    public void setDescription(String[] description) {
+        BaseFaultTypeDescription [] desc = null;
+        if (description != null) {
+            desc = new BaseFaultTypeDescription[description.length];
+            for (int i=0;i<description.length;i++) {
+                desc[i] = new BaseFaultTypeDescription(description[i]);
+            }
+        }
+        this.fault.setDescription(desc);
+    }
+
+    /**
+     * Adds a description to the description list of the fault.
+     *
+     * @param description the description to add.
+     */
+    public void addDescription(String description) {
+        if (description == null) {
+            throw new IllegalArgumentException(i18n.getMessage(
+                "nullArgument", "description"));
+        }
+        BaseFaultTypeDescription [] desc = this.fault.getDescription();
+        BaseFaultTypeDescription [] newDesc = null;
+        if (desc == null) {
+            newDesc = new BaseFaultTypeDescription[1];
+        } else {
+            newDesc = new BaseFaultTypeDescription[desc.length + 1];
+            System.arraycopy(desc, 0, newDesc, 0, desc.length);
+        }
+        newDesc[newDesc.length - 1] = 
+            new BaseFaultTypeDescription(description);
+        this.fault.setDescription(newDesc);
+    }
+
+    /**
+     * Adds a fault cause to the fault.
+     *
+     * @param exception the exception to add as a cause of this fault.
+     *                  If the exception is of BaseFault type then it is
+     *                  just added as is as a fault cause. Otherwise, the 
+     *                  exception is converted into a new BaseFault and then
+     *                  added as a fault cause. The new BaseFault is created
+     *                  with an error code dialect attribute set to 
+     *                  {@link #EXCEPTION EXCEPTION}.
+     */
+    public void addFaultCause(Throwable exception) {
+        addFaultCause( toBaseFault(exception) );
+    }
+
+    private void addFaultCause(BaseFaultType fault) {
+        BaseFaultType [] cause = this.fault.getFaultCause();
+        BaseFaultType [] newCause = null;
+        if (cause == null) {
+            newCause = new BaseFaultType [1];
+        } else {
+            newCause = new BaseFaultType [cause.length+1];
+            System.arraycopy(cause, 0, newCause, 0, cause.length);
+        }
+        newCause[newCause.length - 1] = fault;
+        this.fault.setFaultCause(newCause);
+    }
+
+    private void addStackTraceFault() {
+        // check if stack trace fault is already present
+        BaseFaultType [] cause = this.fault.getFaultCause();
+        if (cause != null) {
+            for (int i=0;i<cause.length;i++) {
+                BaseFaultTypeErrorCode errorCode = cause[i].getErrorCode();
+                if (errorCode != null && 
+                    STACK_TRACE.equals(errorCode.getDialect())) {
+                    // already defined, quit
+                    return;
+                }
+            }
+        }
+
+        Element stackElement = this.fault.lookupFaultDetail(
+                                 Constants.QNAME_FAULTDETAIL_STACKTRACE);
+        if (stackElement == null) {
+            return;
+        }
+        // remove SOAP details stack entry
+        this.fault.removeFaultDetail(Constants.QNAME_FAULTDETAIL_STACKTRACE);
+
+        BaseFaultType stackFault = new BaseFaultType();
+        BaseFaultTypeErrorCode errorCode = new BaseFaultTypeErrorCode();
+        errorCode.setDialect(STACK_TRACE);
+        errorCode.set_any(AnyHelper.toText(this.fault.getClass().getName()));
+        stackFault.setErrorCode(errorCode);
+        
+        BaseFaultTypeDescription [] desc = new BaseFaultTypeDescription[1];
+        String stack = stackElement.getFirstChild().getNodeValue();
+        desc[0] = new BaseFaultTypeDescription(stack);
+        stackFault.setDescription(desc);
+        
+        stackFault.setTimestamp(Calendar.getInstance());
+
+        // add stack trace fault
+        addFaultCause(stackFault);
+    }
+
+    /**
+     * Converts exception to a BaseFault.
+     *
+     * @param exception the exception to convert.
+     * @return If the exception is of BaseFault type then it is returned
+     *         as is. Otherwise, a new BaseFault with an error code dialect
+     *         attribute set to {@link #EXCEPTION EXCEPTION}.
+     */
+    public static BaseFaultType toBaseFault(Throwable exception) {
+        BaseFaultType fault = null;
+        if (exception instanceof BaseFaultType) {
+            // will add the FaultCase with stack trace
+            FaultHelper helper = new FaultHelper((BaseFaultType)exception);
+            fault = (BaseFaultType)exception;
+        } else {
+            // convert to fault with exception dialect
+            fault = new BaseFaultType();
+            
+            String tmp = null;
+
+            BaseFaultTypeErrorCode errorCode = 
+                new BaseFaultTypeErrorCode();
+            errorCode.setDialect(EXCEPTION);
+            tmp = exception.getMessage();
+            if (tmp != null) {
+                errorCode.set_any(AnyHelper.toText(tmp));
+            }
+            fault.setErrorCode(errorCode);
+            
+            BaseFaultTypeDescription [] desc = 
+                new BaseFaultTypeDescription[1];
+            tmp = JavaUtils.stackToString(exception);
+            desc[0] = new BaseFaultTypeDescription(tmp);
+            fault.setDescription(desc);
+
+            fault.setTimestamp(Calendar.getInstance());
+        }
+        return fault;
+    }
+
+    /**
+     * Gets the error message of the exception.
+     *
+     * @param exception if exception is of type <code>BaseFaultType</code>
+     *                  {@link #getMessage() getMessage()} is
+     *                  called to get the error message. Otherwise, 
+     *                  <code>getMessage</code> operation is called on the
+     *                  exception.
+     */
+    public static String getMessage(Throwable exception) {
+        if (exception instanceof BaseFaultType) {
+            FaultHelper faultHelper = 
+                new FaultHelper((BaseFaultType)exception, false);
+            return faultHelper.getMessage();
+        } else {
+            return exception.getMessage();
+        }
+    }
+
+    /**
+     * Gets the stack trace of the exception.
+     *
+     * @param exception if exception is of type <code>BaseFaultType</code>
+     *                  {@link #printStackTrace() printStackTrace()} is
+     *                  called to get the error message. Otherwise, 
+     *                  <code>printStackTrace</code> operation is called on the
+     *                  exception.
+     */
+    public static void printStackTrace(Throwable exception) {
+        if (exception instanceof BaseFaultType) {
+            exception.printStackTrace();
+            // Disabled becuase it omits client stack info
+            /* 
+            FaultHelper faultHelper = 
+                new FaultHelper((BaseFaultType)exception, false);
+            faultHelper.printStackTrace();
+            */
+        } else {
+            exception.printStackTrace();
+        }
+    }
+
+    /**
+     * Prints stack trace of the fault to <code>System.err</code>.
+     * See {@link #getStackTrace() getStackTrace()} for more information.
+     */
+    public void printStackTrace() {
+        printStackTrace(System.err);
+    }
+    
+    /**
+     * Writes stack trace of the fault to stream.
+     * See {@link #getStackTrace() getStackTrace()} for more information.
+     */
+    public void printStackTrace(PrintStream s) {
+        s.println(getStackTrace());
+    }
+    
+    /**
+     * Writes stack trace of the fault to writer.
+     * See {@link #getStackTrace() getStackTrace()} for more information.   
+     */
+    public void printStackTrace(PrintWriter s) {
+        s.println(getStackTrace());
+    }
+    
+    /**
+     * Gets error message of the fault.
+     *
+     * @return If the fault has error code dialect of {@link #STACK_TRACE
+     *         STACK_TRACE} null is returned. If the fault has error code
+     *         dialect of {@link #EXCEPTION EXCEPTION} the exception error
+     *         message is returned. Otherwise, the error message is composed
+     *         of all descriptions of the fault and descriptions of the chained
+     *         faults.
+     */
+    public String getMessage() {
+        BaseFaultTypeErrorCode errorCode =
+            this.fault.getErrorCode();
+        if (errorCode != null) {
+            if (STACK_TRACE.equals(errorCode.getDialect())) {
+                return null;
+            } else if (EXCEPTION.equals(errorCode.getDialect())) {
+                try {
+                    return AnyHelper.toSingleString(errorCode.get_any());
+                } catch (Exception e) {
+                    return null;
+                }
+            }
+            // fall through
+        }
+        StringBuffer buf = new StringBuffer();
+        buf.append(this.fault.getClass().getName());
+        String desc = getDescriptionAsString();
+        if (desc != null) {
+            buf.append(": ").append(desc);
+        }
+        BaseFaultType [] cause = this.fault.getFaultCause();
+        if (cause != null) {
+            boolean wroteCauseBy = false;
+            int j = 0;
+            for (int i=0;i<cause.length;i++) {
+                desc = getMessage(cause[i]);
+                if (desc == null) {
+                    continue;
+                }
+                if (!wroteCauseBy) {
+                    buf.append(i18n.getMessage("causedBy") + "[");
+                    wroteCauseBy = true;
+                }
+                buf.append(String.valueOf(j++)).append(": ").append(desc);
+            }
+            if (wroteCauseBy) {
+                buf.append("]");
+            }
+        }
+        return buf.toString();
+    }
+
+    /**
+     * Gets stack trace of the fault. Note, this stack trace only contains
+     * information sent from server. It does not contain client stack 
+     * trace information.
+     *
+     * @return stack trace of the fault. It includes any chained faults.
+     */
+    public String getStackTrace() {
+        StringBuffer buf = new StringBuffer();
+        buf.append(this.fault.getClass().getName());
+        String desc = getDescriptionAsString();
+        if (desc != null) {
+            buf.append(": ").append(desc);
+        }
+        if (this.fault.getTimestamp() != null) {
+            buf.append(LS).append(i18n.getMessage("timestamp"));
+            buf.append(this.fault.getTimestamp().getTime().toString());
+        }
+        if (this.fault.getOriginator() != null) {
+            buf.append(LS).append(i18n.getMessage("originator"));
+            buf.append(this.fault.getOriginator().toString());
+        }
+        BaseFaultType [] cause = this.fault.getFaultCause();
+        BaseFaultTypeErrorCode errorCode = null;
+        if (cause != null) {
+            FaultHelper helper = null;
+            for (int i=0;i<cause.length;i++) {
+                helper = new FaultHelper(cause[i], false);
+                errorCode = cause[i].getErrorCode();
+                if (STACK_TRACE.equals(errorCode.getDialect())) {
+                    buf.append(LS).append(helper.getDescriptionAsString());
+                    continue;
+                }
+                buf.append(LS).append(i18n.getMessage("causedBy01"));
+                buf.append(helper.getStackTrace());
+            }
+        }
+        return buf.toString();
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/FilePersistenceHelper.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/FilePersistenceHelper.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/FilePersistenceHelper.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,252 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.container.ServiceHost;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.ResourceKey;
+import org.globus.util.I18n;
+
+/**
+ * This helper contains common functions for managing persistent information
+ * stored as files.
+ */
+public class FilePersistenceHelper {
+
+    private static I18n i18n = 
+        I18n.getI18n(Resources.class.getName());
+    
+    public static final String SERVER_ID = 
+        Constants.CONTAINER_PROPERTY + ".server.id";
+    
+    private static final String FILE_PERSISTENCE_DIR =
+        System.getProperty("user.home") + File.separatorChar +
+        ".globus" + File.separatorChar + "persisted";
+    
+    private static Log logger =
+        LogFactory.getLog(FilePersistenceHelper.class.getName());
+    
+    protected Class beanClass;
+    protected File storageDir;
+    protected String fileSuffix;
+
+    private static String getServerID() {
+        String id = System.getProperty(SERVER_ID);
+        if (id == null) {
+            try {
+                id = ServiceHost.getDefaultHost();
+            } catch (IOException e) {
+                id = "localhost";
+            }
+        } 
+        return id;
+    }
+
+    private static String getDefaultStorageDir(Class beanClass) 
+        throws IOException {
+        if (beanClass == null) {
+            return null;
+        }
+        String fullClassName = beanClass.getName();
+        String className = fullClassName.substring(
+                      beanClass.getPackage().getName().length() + 1);
+        
+        String dir = FILE_PERSISTENCE_DIR + File.separatorChar +  
+            getServerID() + File.separatorChar + className;
+
+        File baseDir = new File(FILE_PERSISTENCE_DIR);
+        File storageDir = new File(dir);
+        if (!storageDir.getCanonicalPath().startsWith(baseDir.getCanonicalPath())) {
+            throw new IOException(i18n.getMessage("invalidStorageDir", dir));
+        }
+        
+        return dir;
+    }
+
+    /**
+     * Creates FilePersistenceHelper with default storage directory based on
+     * the beanClass name and specified suffix.
+     */
+    public FilePersistenceHelper(Class beanClass, 
+                                 String suffix) 
+        throws IOException {
+        this(beanClass, getDefaultStorageDir(beanClass), suffix);
+    }
+
+    /**
+     * Creates FilePersistenceHelper with specific storage directory and
+     * file suffix.
+     */
+    public FilePersistenceHelper(Class beanClass, 
+                                 String storageDir, 
+                                 String suffix) 
+        throws IOException {
+        if (beanClass == null) {
+            throw new IllegalArgumentException(
+                    i18n.getMessage("nullArgument", "beanClass"));
+        }
+        if (storageDir == null) {
+            throw new IllegalArgumentException(
+                    i18n.getMessage("nullArgument", "storageDir"));
+        }
+        if (suffix == null) {
+            throw new IllegalArgumentException(
+                    i18n.getMessage("nullArgument", "suffix"));
+        }
+        this.beanClass = beanClass;
+        this.fileSuffix = suffix;
+        setStorageDirectory(storageDir);
+    }
+
+    protected void setStorageDirectory(String strDir) 
+        throws IOException {
+        File dir = new File(strDir);
+        if (!dir.exists()) {
+            if (!dir.mkdirs()) {
+                throw new IOException(i18n.getMessage("storDirFailed", dir));
+            }
+        } else {
+            if (!dir.canWrite() || !dir.canRead()) {
+                throw new IOException(i18n.getMessage("storDirPerm", dir));
+            }
+        }
+        this.storageDir = dir;
+    }
+
+    public File getStorageDirectory() {
+        return this.storageDir;
+    }
+
+    public String getFileSuffix() {
+        return this.fileSuffix;
+    }
+
+    public Class getBeanClass() {
+        return this.beanClass;
+    }
+
+    /**
+     * Create a file object based on the key supplied in parameter.
+     * The file name will follow the format:<p>
+     * file name :== (class name)_(key scalar value).xml<p>
+     * where:
+     * <ul>
+     * <li>(class name) is class name of the implementation resource bean.</li>
+     * <li>(key scalar value) is the toString value of the key passed in
+     *     parameter. If the key is an instance of ResourceKey, its value is
+     *     the result of key.getValue().</li>
+     *
+     * @param key the key of the object
+     * @return File
+     */
+    public File getKeyAsFile(Object key) {
+        if (logger.isDebugEnabled()) {
+            logger.debug("Type of key is: " + key.getClass().getName());
+        }
+        Object keyValue = key;
+        if (keyValue instanceof ResourceKey) {
+            //this is ugly! Key business is messy. Must make it less ambiguous.
+            keyValue = ((ResourceKey)key).getValue();
+        }
+        
+        File file = new File(getStorageDirectory(), 
+                             keyValue + this.fileSuffix);
+        if (logger.isDebugEnabled()) {
+            logger.debug("File used for persistence: " + 
+                         file.getAbsolutePath());
+        }
+        return file;
+    }
+
+    public void remove(Object key)
+        throws ResourceException {
+        File f = getKeyAsFile(key);
+        if (logger.isDebugEnabled()) {
+            logger.debug("Deleting state file for: " + key);
+        }
+        f.delete();
+    }
+
+    /**
+     * This function returns the keys of the objects that have been stored.
+     * This should be used by the home in order to recover state,
+     * by listing all the stored object keys and adding them to the
+     * map of resources. The consumer code must test for null.
+     *
+     * @return List the list of key values
+     */
+    public List list()
+        throws IOException {
+        logger.debug("Loading the list of resource keys");
+
+        //read list of persistence resource files
+        File persistenceDirectory = getStorageDirectory();
+        File [] keyFiles = 
+            persistenceDirectory.listFiles(new Filter(this.fileSuffix));
+        List keyValueList = null;
+        if (keyFiles != null) {
+            keyValueList = new ArrayList(keyFiles.length);
+            for (int i = 0; i < keyFiles.length; i++) {
+                String fileName = keyFiles[i].getName();
+                int keyEnd = fileName.lastIndexOf(this.fileSuffix);
+                String keyValue = fileName.substring(0, keyEnd);
+                keyValueList.add(keyValue);
+            }
+        } else {
+            logger.debug("Persistence directory does not exist yet");
+            keyValueList = new ArrayList(0);
+        }
+
+        return keyValueList;
+    }
+
+    /**
+     * Removes all stored objects from file system.
+     */
+    public void removeAll()
+        throws IOException {
+        File persistenceDirectory = getStorageDirectory();
+        File [] keyFiles = 
+            persistenceDirectory.listFiles(new Filter(this.fileSuffix));
+        for (int i = 0; i < keyFiles.length; i++) {
+            keyFiles[i].delete();
+        }
+    }
+
+    private static class Filter implements FilenameFilter {
+
+        private String suffix;
+
+        public Filter(String suffix) {
+            this.suffix = suffix;
+        }
+
+        public boolean accept(File dir, String name) {
+            return (name.endsWith(this.suffix));
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/PerformanceLog.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/PerformanceLog.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/PerformanceLog.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,96 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils;
+
+import org.globus.wsrf.encoding.ObjectSerializer;
+import org.globus.wsrf.types.profiling.Timestamp;
+import org.globus.wsrf.types.profiling.TimestampType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class PerformanceLog {
+
+    private ThreadLocal local = new ThreadLocal();
+    private boolean fullEnabled = false;
+    private boolean shortEnabled = false;
+    private Log logger;
+
+    public PerformanceLog(String loggerName) {
+        this.logger = LogFactory.getLog(loggerName);
+
+        if (logger.isDebugEnabled()) {
+            if (
+                "full".equalsIgnoreCase(
+                        System.getProperty("org.globus.wsrf.performance.log")
+                    )
+            ) {
+                this.fullEnabled = true;
+            } else {
+                this.shortEnabled = true;
+            }
+        }
+    }
+
+    public boolean enabled() {
+        return (this.fullEnabled || this.shortEnabled);
+    }
+
+    public void start() {
+        if (!enabled()) {
+            return;
+        }
+
+        local.set(new Long(System.currentTimeMillis()));
+    }
+
+    public void stop(String operation) {
+        if (!enabled()) {
+            return;
+        }
+
+        long stop = System.currentTimeMillis();
+        Long startLong = (Long) local.get();
+
+        if (startLong == null) {
+            return;
+        }
+
+        long start = startLong.longValue();
+        String threadName = Thread.currentThread().getName();
+
+        if (this.shortEnabled) {
+            logger.debug(
+                "[" + operation + "][" + threadName + "]" + "[" +
+                Long.toString(stop - start) + "]"
+            );
+        } else {
+            TimestampType timestampType = new TimestampType();
+            Timestamp timestamp = new Timestamp();
+            timestampType.setTimestamp(timestamp);
+            timestamp.setStartTime(start);
+            timestamp.setEndTime(stop);
+            timestamp.setThreadID(threadName);
+            timestamp.setOperation(operation);
+
+            try {
+                logger.debug(ObjectSerializer.toString(timestampType));
+            } catch (Exception e) {
+                logger.error("Serialization error", e);
+            }
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/Resources.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/Resources.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/Resources.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,479 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils;
+
+import java.util.ListResourceBundle;
+
+/**
+ * English translations of error messages.
+ */
+public class Resources extends ListResourceBundle
+{
+    public Object[][] getContents()
+    {
+        return contents;
+    }
+
+    static final Object[][] contents =
+        {
+            {"configError", "{0} not configured correctly"},
+            {"configFileError", "Configuration file {0} not found"},
+            {"consumerError", "Failed to contact consumer {0}"},
+            {"schemaPathNotFound", "Path to schema was not found"},
+            {"noDeserializer", "Could not find deserializer for: {0}"},
+            {
+                "rpSerializationError",
+                "Failed to serialize resource property {0}"
+            },
+            {
+                "invalidQueryExpressionDialect",
+                "Invalid query expression dialect"
+            },
+            {
+                "noQueryString",
+                "No query string specified"
+            },
+            {
+                "unsupportedXpathReturn",
+                "Unsupported XPath result return type ''{0}''"
+            },
+            {
+                "unsupportedQueryReturnType",
+                "Unsupported query return type ''{0}''"
+            },
+            {
+                "queryFailed",
+                "Failed to execute query"
+            },
+            {
+                "containerPropertiesNotSpecified",
+                "Container properties must be specified"
+            },
+            {
+                "containerClassError",
+                "Class {0} must be an instance of SerivceContainer"
+            },
+            {
+                "startServer",
+                "Starting SOAP server at: {0} \nWith the following services:\n"
+            },
+            {
+                "stopServer",
+                "Stopped SOAP Axis server at: {0}                         "
+            },
+            {
+                "nodeliver",
+                "Exception occurred during notification delivery, msg={0} "
+            },
+            {
+                "initialContextFactorySet",
+                "INITIAL_CONTEXT_FACTORY already set to {0}"
+            },
+            {"jndiConfigFileOption", "jndiConfigFile"},
+            {"nullJNDIConfigInput", "JNDI config input stream is null"},
+            {
+                "jndiConfigNotFound",
+                "Could not find JNDI configuration file"
+            },
+            {
+                "jndiConfigParseError",
+                "Failed to read ''{0}'' JNDI configuration file"
+            },
+            {"expectedType", "Expected object of type ''{0}''"},
+            {"invalidType", "Invalid type ''{0}''"},
+            {"invalidResourceType", "Resource object ''{0}'' must implement Resource interface"},
+            {
+                "invalidValueForType",
+                "Invalid value ''{0}'' for type ''{1}''"
+            },
+            {
+                "cantConvertType",
+                "Unable to convert {0} to {1}"
+            },
+            {
+                "failedToConvert",
+                "Data conversion failed: {0}"
+            },
+            {
+                "unsupportedType",
+                "Type not supported"
+            },
+            {"nullArgument", "Argument {0} is null"},
+            {"causedBy", " caused by "},
+            {"causedBy01", "Caused by: "},
+            {"timestamp", "Timestamp: "},
+            {"originator", "Originator: "},
+            {
+                "notificationConsumerHomeLookupFailure",
+                "Failed to acquire notification consumer home instance from registry"
+            },
+            {
+                "notificationConsumerNotListening",
+                "Notification Consumer must be in listening state when invoking this operation"
+            },
+            {
+                "notificationConsumerArgumentMismatch",
+                "There must be an equal number of topic paths and callbacks"
+            },
+            {
+                "topicEngineConfigError",
+                "Failed to get engine instance"
+            },
+            {
+                "topicEngineInitError",
+                "Failed to initialize topic expression engine"
+            },
+            {
+                "invalidSimpleTopicPath",
+                "Topic path either null or not of size 1"
+            },
+            {
+                "addingSubTopicToReference",
+                "Can''t add sub topics to a reference topic"
+            },
+            {
+                "contextNotMessageContext",
+                "{0} must be a Axis MessageContext"
+            },
+            {
+                "reflectionRPMembersNotInitialized",
+                "Object or propertyName not set"
+            },
+            {
+                "modifyReadOnly",
+                "Cannot modify read-only property"
+            },
+            {
+                "resourceInitError",
+                "Failed to initialize resource"
+            },
+            {
+                "queryEngineInitError",
+                "Failed to initialize query expression engine"
+            },
+            {
+                "queryEngineLookupError",
+                "Failed to initialize query engine"
+            },
+            {
+                "unsupportedQueryDialect",
+                "Query dialect not supported: {0}"
+            },
+            {
+                "rpNotElement",
+                "The Schema type for the resource property set has a" +
+                " field called ''{0}'' that is not an element. This is " +
+                "forbidden by the WS-ResourceProperties specification, " +
+                "section 4.2, item 3"
+            },
+            {
+                "resourceClassConfigError",
+                "Resource class not configured"
+            },
+            {
+                "resourceKeyConfigError",
+                "Resource key name not configured"
+            },
+            {
+                "invalidResourceClass",
+                "Resource class must implement {0} interface"
+            },
+            {
+                "backingFileNotFound",
+                "File {0} for resource {1} was not found"
+            },
+            {
+                "resourceLoadFailed",
+                "Failed to load the resource"
+            },
+            {
+                "resourceStoreFailed",
+                "Failed to store the resource"
+            },
+            {
+                "noQuery",
+                "Empty query"
+            },
+            {
+                "noRPName",
+                "Empty resource property name"
+            },
+            {
+                "noRPNames",
+                "Empty resource property names"
+            },
+            {
+                "eprCreationFailed",
+                "Failed to create endpoint reference"
+            },
+            {
+                "resourceDisoveryFailed",
+                "Failed to acquire resource"
+            },
+            {
+                "emptyTopicExpression",
+                "Empty topic expression"
+            },
+            {
+                "emptyConsumerReference",
+                "Empty consumer reference"
+            },
+            {
+                "topicExpressionResolutionFailed",
+                "Failed to resolve topic expression to a set of concrete topics"
+            },
+            {
+                "subscriptionRemoveFailed",
+                "Failed to remove subscription resource"
+            },
+            {
+                "subscriptionCreateFailed",
+                "Failed to create subscription resource"
+            },
+            {
+                "subscriptionFindFailed",
+                "Failed to acquire subscription resource with key ''{0}''"
+            },
+            {
+                "notifyCallbackError",
+                "Failed to invoke notify callback for notification"
+            },
+            {
+                "notificationFailed",
+                "Failed to send notification for subscription with key ''{0}''"
+            },
+            {
+                "notificationSerializationError",
+                "Failed to serialize notification message"
+            },
+            {
+                "resourceRemoveFailed",
+                "Failed to remove resource"
+            },
+            {
+                "rpsNotSupported",
+                "Resource does not implement ResourceProperties interface"
+            },
+            {
+                "rltNotSupported",
+                "Resource does not implement ResourceLifetime interface"
+            },
+            {
+                "noTerminationTimeRP",
+                "No termination time resource property"
+            },
+            {
+                "messageLoggingError",
+                "Failed to log SOAPEnvelope"
+            },
+            {
+                "notImplemented",
+                "Not implemented"
+            },
+            {
+                "genericSerializationError",
+                "Serialziation failed"
+            },
+            {
+                "genericDeserializationError",
+                "Deserialziation failed"
+            },
+            {
+                "noDialectSerializer",
+                "Couldn''t find serializer factory for ''{0}'' dialect"
+            },
+            {
+                "noDialectDeserializer",
+                "Couldn''t find deserializer factory for ''{0}'' dialect"
+            },
+            {
+                "noServiceName",
+                "Service name must be specified since no path was found"
+            },
+            {
+                "buildURLError",
+                "Could not reconstruct URL"
+            },
+            {
+                "noTypeDesc",
+                "The ''{0}'' bean does not have type description information"
+            },
+            {
+                "illegalReferenceType",
+                "The reference type ''{0}'' is neither 0 (hard), 1 (soft) or 2 (weak)"
+            },
+            {
+                "noToHeader",
+                "The WS-Addressing ''To'' request header is missing"
+            },
+            {
+                "secureNotificationSetupFailed",
+                "Failed to set up the notification security descriptor"
+            },
+            {
+                "secureSubscriptionSetupFailed",
+                "Failed to set up the subscription security descriptor"
+            },
+            {
+              "noTopicList",
+              "Notification producer WS-Resource does not implement the correct java interface"
+            },
+            {
+                "filename00",
+                "File name is: {0}"
+            },
+            {
+                "filename01",
+                "{0}: requested file name = ''{1}''"
+            },
+            {
+                "params00",
+                "Parameters are: {0}"
+            },
+            {
+                "serverFault00",
+                "HTTP server fault"
+            },
+            {
+                "unexpectedEOS00",
+                "Unexpected end of stream"
+            },
+            {
+                "badRequest00",
+                "Cannot handle non-GET, non-POST, non-HEAD request"
+            },
+            {
+                "unsupportedHTTPMajor",
+                "Unsupported HTTP major version"
+            },
+            {
+                "unsupportedHTTMinor",
+                "Unsupported HTTP minor version"
+            },
+            {
+                "malformedHTTPVersion",
+                "Malformed HTTP version information"
+            },
+            {
+                "noMsgContext",
+                "MessageContext not associated with the thread"
+            },
+            {
+                "noTargetServiceSet",
+                "Target service not set"
+            },
+            {
+                "noServiceSet",
+                "Service not set"
+            },
+            {
+                "noEngineSet",
+                "Engine not set"
+            },
+            {
+                "applicationScopeNeeded",
+                "Service ''{0}'' must be deployed with application scope"
+            },
+            {
+                "containerInitError",
+                "Container failed to initialize"
+            },
+            {
+                "containerStopError",
+                "Container failed to stop"
+            },
+            {
+                "beanInitFailed",
+                "Bean initialization failed"
+            },
+            {
+                "beanSecInitFailed",
+                "Bean security initialization failed"
+            },
+            {
+                "typeOrClassRequired",
+                "type or Java class required"
+            },
+            {
+                "storDirFailed",
+                "Failed to create storage directory: ''{0}''"
+            },
+            {
+                "storDirPerm",
+                "No permissions to read and/or write to storage directory: ''{0}''"
+            },
+            {
+                "noTransURL",
+                "Transport URL property not set"
+            },
+            {
+                "hardShutdownNotSupported",
+                "Hard shutdown not supported"
+            },
+            {
+                "shutdownFailure",
+                "Shutdown failed"
+            },
+            {
+                "failedInitService",
+                "Failed to initialize ''{0}'' service"
+            },
+            {
+                "invalidStorageDir",
+                "Invalid storage directory ''{0}''"
+            },
+            {
+              "noValidCreds",
+              "Secure container requires valid credentials"
+            },
+            {
+                "requestFailed",
+                "Error processing request"
+            },
+            {
+                "invalidWebRoot",
+                "Invalid web root path"
+            },
+            {
+                "noHostname",
+                "Failed to get host name"
+            },
+            {
+                "general",
+                "Mystery error"
+            },
+            {
+                "errorClosingInputStream",
+                "Error closing input stream"
+            },
+            {
+                "errorClosingOutputStream",
+                "Error closing output stream"
+            },
+            {
+                "errorClosingSocket",
+                "Error closing socket"
+            },
+            {
+                "errorWritingResponse",
+                "Error writing response"
+            },
+            {
+                "unexpectedError",
+                "Unexpected Error"
+            }
+        };
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/SubscriptionPersistenceUtils.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/SubscriptionPersistenceUtils.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/SubscriptionPersistenceUtils.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,163 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.globus.wsrf.Topic;
+import org.globus.wsrf.TopicList;
+import org.globus.wsrf.TopicListener;
+import org.globus.wsrf.impl.SimpleSubscriptionTopicListener;
+
+/**
+ *
+ */
+public class SubscriptionPersistenceUtils
+{
+    /**
+     * Serialize any registered subscription topic listeners of type
+     * SimpleSubscriptionListener to the provided output stream.
+     *
+     * @param topicList The topic list on which the listeners are registered
+     * @param oos       The output stream
+     * @throws IOException If writing to the output stream failed
+     */
+    public static void storeSubscriptionListeners(
+        TopicList topicList,
+        ObjectOutputStream oos)
+        throws IOException
+    {
+        Map topicListenerTable = getListenerToTopicsTable(topicList);
+
+        oos.writeObject(topicListenerTable);
+    }
+
+    /**
+     * Return a table of listeners and their corresponding topics. <p>
+     * This function is used to flatten an input tree of topics into a form that
+     * is simpler to persist (for instance, it is called by
+     * {@link #storeSubscriptionListeners(org.globus.wsrf.TopicList,java.io.ObjectOutputStream) storeSubscriptionListeners()}).
+     * <p>
+     * Each key is of type
+     * {@link org.globus.wsrf.impl.SimpleSubscriptionTopicListener
+     * SimpleSubscriptionTopicListener}
+     * and is mapped to a {@link java.util.List List} of topic paths.
+     * Each topic path is a {@link java.util.List List} of
+     * {@link javax.xml.namespace.QName QName} objects.
+     * @param topicList TopicList The topic list on which the listeners
+     *                  are registered
+     * @return Map The map of listeners to topics
+     */
+    public static Map getListenerToTopicsTable(TopicList topicList) {
+        Map topicListenerTable = new HashMap();
+        Iterator topicIterator = topicList.topicIterator();
+        while(topicIterator.hasNext())
+        {
+            addSubscriptionListenersToTable((Topic) topicIterator.next(),
+                                       topicListenerTable);
+        }
+        return topicListenerTable;
+    }
+
+    /**
+     * Gather all registered topic listeners for the topic and all of its
+     * subtopics (recursive) and drop them into the provided table, which
+     * maps topics to their listeners.
+     *
+     * @param topic              The topic to process
+     * @param topicListenerTable The table into which to insert the discovered
+     *                           listeners
+     */
+    private static void addSubscriptionListenersToTable(
+        Topic topic,
+        Map topicListenerTable)
+    {
+        Iterator topicListenerIterator = topic.topicListenerIterator();
+        List topicPath = topic.getTopicPath();
+        while(topicListenerIterator.hasNext())
+        {
+            TopicListener listener = (TopicListener)
+                topicListenerIterator.next();
+            if(listener instanceof SimpleSubscriptionTopicListener)
+            {
+                List topics;
+                if((topics = (List) topicListenerTable.get(listener)) == null)
+                {
+                    topics = new ArrayList();
+                    topics.add(topicPath);
+                    topicListenerTable.put(listener, topics);
+                }
+                else
+                {
+                    topics.add(topicPath);
+                }
+            }
+        }
+        Iterator topicIterator = topic.topicIterator();
+        while(topicIterator.hasNext())
+        {
+            addSubscriptionListenersToTable((Topic) topicIterator.next(),
+                                            topicListenerTable);
+        }
+    }
+
+    /**
+     * Deserialize the table containing the registered subscription related
+     * topic listeners and reregister said listeners in the provided topic
+     * list.
+     *
+     * @param topicList The topic list on which to register the deserialized
+     *                  listeners
+     * @param ois       The input stream from which to read the table of
+     *                  listeners
+     * @throws IOException            If there was a IO error when reading from
+     *                                the input stream
+     * @throws ClassNotFoundException If the class of the object being read
+     *                                could not be found
+     */
+    public static void loadSubscriptionListeners(
+        TopicList topicList,
+        ObjectInputStream ois)
+        throws IOException, ClassNotFoundException
+    {
+        Map topicListenerTable = (Map) ois.readObject();
+        Iterator topicListenerIterator =
+            topicListenerTable.entrySet().iterator();
+        Map.Entry tableEntry;
+        TopicListener listener;
+        Iterator topicIterator;
+        Topic topic;
+
+        while(topicListenerIterator.hasNext())
+        {
+            tableEntry = (Map.Entry) topicListenerIterator.next();
+            listener = (TopicListener) tableEntry.getKey();
+            topicIterator = ((List) tableEntry.getValue()).iterator();
+            while(topicIterator.hasNext())
+            {
+                topic = topicList.getTopic((List) topicIterator.next());
+                topic.addTopicListener(listener);
+            }
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/XmlPersistenceHelper.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/XmlPersistenceHelper.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/XmlPersistenceHelper.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,273 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils;
+
+import java.io.Writer;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.xml.sax.InputSource;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.impl.ReflectionResource;
+import org.globus.wsrf.encoding.ObjectDeserializationContext;
+import org.globus.wsrf.encoding.ObjectSerializer;
+import org.globus.util.I18n;
+
+/**
+ * This helper is used to persist a {@link ReflectionResource
+ * ReflectionResource}
+ * by serializing the resource implementation JavaBean used in constructing the
+ * ReflectionResource. The result of storing the resource is an XML
+ * file that corresponds exactly to the XML Schema Resource document defined
+ * for this resource. Future versions will offer alternative modes of
+ * persistence.<p>
+ * <p>
+ * <p>
+ * Usage:
+ * <p>
+ * Use this helper on the model of
+ * {@link org.globus.wsrf.impl.PersistentReflectionResource
+ * PersistentReflectionResource}
+ * <p>
+ *
+ * @see ReflectionResource
+ * @see org.globus.wsrf.impl.PersistentReflectionResource
+ * @see org.globus.wsrf.impl.ResourceHomeImpl
+ * @see org.globus.wsrf.PersistentResource
+ * @see org.globus.wsrf.RemoveCallback
+ */
+public class XmlPersistenceHelper extends FilePersistenceHelper {
+
+    private static I18n i18n =
+        I18n.getI18n(Resources.class.getName());
+
+    private static Log logger =
+        LogFactory.getLog(XmlPersistenceHelper.class.getName());
+
+    private static final String FILE_SUFFIX = ".xml";
+
+    public XmlPersistenceHelper(Class beanClass)
+        throws IOException {
+        super(beanClass, FILE_SUFFIX);
+    }
+
+    /**
+     * Loads and initialize the resource.
+     *
+     * @param key the key of the potentially new resource
+     * @param resource the new resource to load.
+     *        Its key and implementation bean are null.
+     *        They will be set by a call from this method to
+     *        resource.initialize().
+     * @see org.globus.wsrf.PersistentResource
+     */
+    public void load(Object key, ReflectionResource resource)
+        throws ResourceException {
+        logger.debug("Loading the resource from an XML file");
+
+        File resourceFile = getKeyAsFile(key);
+        if (!resourceFile.exists()) {
+            logger.debug(
+                i18n.getMessage(
+                    "backingFileNotFound",
+                    new Object[]{resourceFile.getPath(), key}));
+            throw new NoSuchResourceException();
+        }
+
+        QName resourceElementQName;
+        Object loadedResourceBean;
+
+        FileInputStream in = null;
+        try {
+            in = new FileInputStream(resourceFile);
+
+            ObjectDeserializationContext deserializer
+                = new ObjectDeserializationContext(new InputSource(in),
+                                                   this.beanClass);
+
+            deserializer.parse();
+
+            loadedResourceBean = deserializer.getValue();
+            resourceElementQName = deserializer.getQName();
+        } catch (Exception e) {
+            throw new ResourceException(i18n.getMessage("resourceLoadFailed"),
+                                        e);
+        } finally {
+            if (in != null) {
+                try {
+                    in.close();
+                } catch (IOException ee) {}
+            }
+        }
+
+        resource.initialize(loadedResourceBean, resourceElementQName, key);
+    }
+
+    /**
+     * Store the resource into an XML document (current implementation).
+     * The name of the file is governed by {@link #getKeyAsFile(Object)
+     * getKeyAsFile()}.
+     *
+     * This stores the state of the implementation JavaBean. If some resource
+     * properties have been implemented with something else (for instance
+     * getters and setters from another object) they will not be
+     * persisted with the current state. This is not a problem if their state
+     * is immutable after initial creation, as their values will be set by
+     * {@link ReflectionResource#initialize(Object, QName, Object) initialize},
+     * ReflectionResource.initialize()} which is called by
+     * this method.
+     * (TODO: persist based on each RP?)
+     *
+     * @param resource the resource to store the state of.
+     * @throws ResourceException if the resource could not be stored
+     * @see #getKeyAsFile(Object) getKeyAsFile()
+     * @see org.globus.wsrf.PersistentResource
+     */
+    public void store(ReflectionResource resource)
+        throws ResourceException {
+        store(resource.getID(),
+              resource.getResourceBean(),
+              resource.getResourcePropertySet().getName());
+    }
+
+    /**
+     * Removes the resource from persistent storage.
+     *
+     * @param resource the resource to remove from storage.
+     * @throws ResourceException if the resource could not be removed.
+     * @see org.globus.wsrf.RemoveCallback
+     */
+    public void remove(ReflectionResource resource)
+        throws ResourceException {
+        Class resourceBean = resource.getResourceBean().getClass();
+        if (!this.beanClass.isAssignableFrom(resourceBean)) {
+            throw new IllegalArgumentException(
+                        i18n.getMessage("expectedType", this.beanClass));
+        }
+        remove(resource.getID());
+    }
+
+    /**
+     * Loads and returns the object of the given key from the persistent
+     * storage.
+     *
+     * @param key key of object to load.
+     * @return loaded Object instance.
+     * @throws ResourceException If the object cannot be loaded from file.
+     */
+    public Object load(Object key)
+        throws ResourceException {
+        logger.debug( "Loading object by deserializing an XML file");
+
+        File resourceFile = getKeyAsFile(key);
+        if (!resourceFile.exists()) {
+            logger.debug(
+                i18n.getMessage(
+                "backingFileNotFound",
+                new Object[] {resourceFile.getPath(), key}));
+            throw new NoSuchResourceException();
+        }
+
+        Object loadedBean;
+
+        FileInputStream in = null;
+        try {
+            in = new FileInputStream(resourceFile);
+
+            ObjectDeserializationContext deserializer
+                = new ObjectDeserializationContext(new InputSource(in),
+                                                   this.beanClass);
+            deserializer.parse();
+
+            loadedBean = deserializer.getValue();
+        } catch (Exception e) {
+            throw new ResourceException(i18n.getMessage("resourceLoadFailed"),
+                                        e);
+        } finally {
+            if (in != null) {
+                try {
+                    in.close();
+                } catch (IOException ee) {}
+            }
+        }
+
+        return loadedBean;
+    }
+
+    /**
+     * Stores the object of the given key to persistent storage.
+     * <br><b>Note:</b> Calls to this function must be synchronized on
+     * per key basis.
+     *
+     * @param key key of object.
+     * @param object object to persist.
+     * @param topElementQName the top element name of the XML object.
+     * @throws ResourceException If the object cannot be saved to a file.
+     */
+    public void store(Object key, Object object, QName topElementQName)
+        throws ResourceException {
+        if (!this.beanClass.isAssignableFrom(object.getClass())) {
+            throw new IllegalArgumentException(
+                        i18n.getMessage("expectedType", this.beanClass));
+        }
+
+        logger.debug("Storing object to an XML file");
+
+        Writer writer = null;
+        File tmpFile = null;
+        try {
+            tmpFile = File.createTempFile("xph", ".tmp",
+                                          getStorageDirectory());
+            writer = new BufferedWriter(new FileWriter(tmpFile));
+
+            ObjectSerializer.serialize(writer,
+                                       object,
+                                       topElementQName);
+        } catch (Exception e) {
+            if (tmpFile != null) {
+                tmpFile.delete();
+            }
+            throw new ResourceException(
+                     i18n.getMessage("resourceStoreFailed"), e);
+        } finally {
+            if (writer != null) {
+                try {
+                    writer.close();
+                } catch (Exception ee) {}
+            }
+        }
+
+        File file = getKeyAsFile(key);
+        if (file.exists()) {
+            file.delete();
+        }
+        if (!tmpFile.renameTo(file)) {
+            file.delete();
+            throw new ResourceException(
+                     i18n.getMessage("resourceStoreFailed"));
+        }
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/XmlUtils.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/XmlUtils.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/XmlUtils.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,236 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import org.apache.axis.utils.XMLUtils;
+
+public class XmlUtils {
+
+    private static Log log =
+        LogFactory.getLog(XmlUtils.class.getName());
+
+    private static DocumentBuilderFactory dbf = getDOMFactory();
+
+    private static DocumentBuilderFactory getDOMFactory() {
+        DocumentBuilderFactory dbf;
+
+        try {
+            dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+        } catch (Exception e) {
+            log.error("", e);
+            dbf = null;
+        }
+
+        return (dbf);
+    }
+
+    /**
+     * Get an empty new Document
+     * @return Document
+     * @throws ParserConfigurationException if construction problems occur
+     */
+    public static Document newDocument()
+        throws ParserConfigurationException {
+        synchronized (dbf) {
+            return dbf.newDocumentBuilder().newDocument();
+        }
+    }
+
+    public static Document newDocument(InputSource inp)
+        throws ParserConfigurationException,
+               SAXException,
+               IOException {
+        DocumentBuilder db;
+
+        synchronized (dbf) {
+            db = dbf.newDocumentBuilder();
+        }
+
+        db.setErrorHandler(new XMLUtils.ParserErrorHandler());
+        return db.parse(inp);
+    }
+
+    public static Document newDocument(InputStream inp)
+        throws ParserConfigurationException,
+               SAXException,
+               IOException {
+        return newDocument(new InputSource(inp));
+    }
+
+    public static Document newDocument(String uri)
+        throws ParserConfigurationException,
+               SAXException,
+               IOException {
+        // call the authenticated version as there might be
+        // username/password info embeded in the uri.
+        return newDocument(uri, null, null);
+    }
+
+    /**
+     * Create a new document from the given URI, use the username and password
+     * if the URI requires authentication.
+     */
+    public static Document newDocument(String uri,
+                                       String username,
+                                       String password)
+        throws ParserConfigurationException,
+               SAXException,
+               IOException {
+        InputSource ins = getInputSourceFromURI(uri, username, password);
+
+        Document doc = null;
+
+        try {
+            doc = newDocument(ins);
+        } finally {
+            if (ins.getByteStream() != null) {
+                ins.getByteStream().close();
+            } else if (ins.getCharacterStream() != null) {
+                ins.getCharacterStream().close();
+            }
+        }
+
+        return doc;
+    }
+
+    /**
+      * Utility to get the bytes at a protected uri
+      *
+      * This will retrieve the URL if a username and password are provided.
+      * The java.net.URL class does not do Basic Authentication, so we have to
+      * do it manually in this routine.
+      *
+      * If no username is provided, we create an InputSource from the uri
+      * and let the InputSource go fetch the contents.
+      *
+      * @param uri the resource to get
+      * @param username basic auth username
+      * @param password basic auth password
+      */
+    private static InputSource getInputSourceFromURI(String uri,
+                                                     String username,
+                                                     String password)
+        throws IOException {
+        URL wsdlurl = null;
+
+        try {
+            wsdlurl = new URL(uri);
+        } catch (MalformedURLException e) {
+            // we can't process it, it might be a 'simple' foo.wsdl
+            // let InputSource deal with it
+            return new InputSource(uri);
+        }
+
+        // if no authentication, just let InputSource deal with it
+        if ((username == null) && (wsdlurl.getUserInfo() == null)) {
+            return new InputSource(uri);
+        }
+
+        // if this is not an HTTP{S} url, let InputSource deal with it
+        if (!wsdlurl.getProtocol().startsWith("http")) {
+            return new InputSource(uri);
+        }
+
+        URLConnection connection = wsdlurl.openConnection();
+
+        // Does this work for https???
+        if (!(connection instanceof HttpURLConnection)) {
+            // can't do http with this URL, let InputSource deal with it
+            return new InputSource(uri);
+        }
+
+        HttpURLConnection uconn = (HttpURLConnection) connection;
+        String userinfo = wsdlurl.getUserInfo();
+        uconn.setRequestMethod("GET");
+        uconn.setAllowUserInteraction(false);
+        uconn.setDefaultUseCaches(false);
+        uconn.setDoInput(true);
+        uconn.setDoOutput(false);
+        uconn.setInstanceFollowRedirects(true);
+        uconn.setUseCaches(false);
+
+        // username/password info in the URL overrides passed in values
+        String auth = null;
+
+        if (userinfo != null) {
+            auth = userinfo;
+        } else if (username != null) {
+            auth = (password == null) ? username : (username + ":" + password);
+        }
+
+        if (auth != null) {
+            uconn.setRequestProperty(
+                "Authorization",
+                "Basic " +
+                XMLUtils.base64encode(auth.getBytes(XMLUtils.getEncoding()))
+            );
+        }
+
+        uconn.connect();
+
+        return new InputSource(uconn.getInputStream());
+    }
+
+    public static String toString(Document doc) {
+        return XMLUtils.DocumentToString(doc);
+    }
+
+    public static String toString(Element element) {
+        return XMLUtils.ElementToString(element);
+    }
+    /**
+     *
+     * Utility function for getting the first child element from a element
+     *
+     * @param element The parent element
+     * @return The first child element if one was found, null otherwise
+     */
+    public static Element getFirstChildElement(Element element) {
+        for (
+            Node currentChild = element.getFirstChild();
+            currentChild != null;
+            currentChild = currentChild.getNextSibling()
+            ) {
+                if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
+                    return (Element) currentChild;
+                }
+            }
+
+        return null;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/Cache.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/Cache.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/Cache.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,29 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils.cache;
+
+public interface Cache {
+    
+    public void update(Object obj);
+    
+    public void remove(Object obj);
+    
+    public void clear();
+    
+    public int getSize();
+    
+}

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/LRUCache.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/LRUCache.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/LRUCache.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,224 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils.cache;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.jndi.Initializable;
+
+import commonj.timers.Timer;
+import commonj.timers.TimerListener;
+import commonj.timers.TimerManager;
+
+/**
+ * LRU cache implementation. The most recently used move to the end of the
+ * list while the least recently used stay at the beginning of the list.
+ * The least recently used (within a timeout period) are removed periodically.
+ */
+public class LRUCache
+    implements Initializable, TimerListener, Cache {
+    
+    // default 5 min timeout
+    private static final int DEFAULT_TIMEOUT = 1000 * 60 * 5;
+
+    // default 2 min delay
+    private static final int DEFAULT_DELAY = 1000 * 60 * 2;
+    
+    private static Log logger =
+        LogFactory.getLog(LRUCache.class.getName());
+
+    private Map cache;
+    private LinkedNodeList list;
+    private TimerManager timerManager;
+    private Timer timer;
+
+    private long timeout = -1;
+    private long delay = -1;
+    private boolean initialized = false;
+
+    public LRUCache() {
+        this.cache = new HashMap();
+        this.list = new LinkedNodeList();
+    }
+    
+    public void setTimeout(long timeout) {
+        this.timeout = timeout;
+    }
+
+    public long getTimeout() {
+        return this.timeout;
+    }
+
+    public void setDelay(long delay) {
+        this.delay = delay;
+    }
+
+    public long getDelay() {
+        return this.delay;
+    }
+
+    public synchronized void initialize() throws Exception {
+        if (this.initialized) {
+            return;
+        }
+        if (this.timeout == -1) {
+            this.timeout = DEFAULT_TIMEOUT;
+        }
+
+        if (this.delay == -1) {
+            this.delay = DEFAULT_DELAY;
+        }
+
+        Context initialContext = new InitialContext();
+        this.timerManager = 
+            (TimerManager)initialContext.lookup(Constants.DEFAULT_TIMER);
+        
+        this.initialized = true;
+    }
+
+    private synchronized void resetTimer() {
+        this.timer = null;
+    }
+    
+    private synchronized void scheduleTimer() {
+        if (this.timer == null) {
+            this.timer = this.timerManager.schedule(this, this.delay);
+            logger.debug("scheduling timer");
+        }
+    }
+
+    public void update(Object resource) {
+        if (logger.isDebugEnabled()) {
+            logger.debug("update: " + resource);
+        }
+        synchronized(resource) {
+            long currTime = System.currentTimeMillis();
+            LinkedNodeList.Node node = 
+                (LinkedNodeList.Node)this.cache.get(resource);
+            if (node == null) {
+                Entry entry = new Entry(resource, currTime);
+                node = this.list.createNode(entry);
+                this.list.add(node);
+                this.cache.put(resource, node);
+            } else {
+                ((Entry)node.getValue()).setAccessTime(currTime);
+                this.list.moveToEnd(node); 
+            }
+        }
+        if (this.timer == null) {
+            scheduleTimer();
+        }
+    }
+    
+    public void remove(Object resource) {
+        if (logger.isDebugEnabled()) {
+            logger.debug("remove: " + resource);
+        }
+        synchronized(resource) {
+            LinkedNodeList.Node node = 
+                (LinkedNodeList.Node)this.cache.get(resource);
+            this.list.remove(node);
+            this.cache.remove(resource);
+            node.setValue(null);
+        }
+    }
+    
+    public synchronized void clear() {
+        this.cache.clear();
+        this.list.clear();
+    }
+
+    public int getSize() {
+        return this.cache.size();
+    }
+
+    public void cleanExpired() {
+        logger.debug("cleaning cache");
+
+        Iterator iter = null;
+        List expiredResources = null;
+
+        synchronized(this.list) {
+            iter = this.list.iterator();
+            expiredResources = new LinkedList();
+            long currTime = System.currentTimeMillis();
+            while(iter.hasNext()) {
+                LinkedNodeList.Node n = (LinkedNodeList.Node)iter.next();
+                Entry entry = (Entry)n.getValue();
+                if (currTime - entry.getAccessTime() > this.timeout) {
+                    expiredResources.add(entry.getResource());
+                } else {
+                    break;
+                }
+            }
+        }
+
+        iter = expiredResources.iterator();
+        while(iter.hasNext()) {
+            remove(iter.next());
+        }
+
+        resetTimer();
+        if (!this.list.isEmpty()) {
+            scheduleTimer();
+        }
+    }
+
+    public void timerExpired(Timer timer) {
+        cleanExpired();
+    }
+
+    private static class Entry {
+
+        private long time;
+        private Object resource;
+
+        public Entry(Object resource, long time) {
+            this.time = time;
+            this.resource = resource;
+        }
+
+        public void setResource(Object resource) {
+            this.resource = resource;
+        }
+        
+        public Object getResource() {
+            return this.resource;
+        }
+
+        public void setAccessTime(long time) {
+            this.time = time;
+        }
+        
+        public long getAccessTime() {
+            return this.time;
+        }
+    }
+    
+}
+
+    

Added: incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/LinkedNodeList.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/LinkedNodeList.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/globus/wsrf/utils/cache/LinkedNodeList.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,268 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils.cache;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Special purpose double linked list implementation. 
+ * <b>Not for general use</b>
+ */
+public class LinkedNodeList {
+    
+    private Node head;
+    private Node tail;
+    private int size;
+
+    public Node createNode() {
+        return new Node();
+    }
+
+    public Node createNode(Object value) {
+        return new Node(value);
+    }
+
+    /**
+     * Removes node from the list and adds it to the end of the list.
+     */
+    public synchronized void moveToEnd(Node node) {
+        if (node != this.tail) {
+            remove(node);
+            add(node);
+        }
+    }
+    
+    public int computeSize() {
+        int i = 0;
+        Node n = this.head;
+        while( n != null ) {
+            n = n.next;
+            i++;
+        }
+        return i;
+    }
+
+    /**
+     * When iterating must synchronize on the LinkedNodeList instance.
+     */
+    public Iterator reverseIterator() {
+        return new NodeIterator(this.tail, false);
+    }
+
+    // --------- GENERAL LIST METHODS -------------
+
+    /**
+     * When iterating must synchronize on the LinkedNodeList instance.
+     */
+    public Iterator iterator() {
+        return new NodeIterator(this.head, true);
+    }
+
+    public synchronized void clear() {
+        this.head = this.tail = null;
+    }
+
+    public boolean isEmpty() {
+        return (this.head == null);
+    }
+
+    public int size() {
+        return this.size;
+    }
+
+    /**
+     * Adds a node to the end of the list.
+     */
+    public synchronized void add(Node node) {
+        if (this.tail == null) {
+            if (this.head != null) {
+                throw new RuntimeException();
+            }
+            this.tail = this.head = node;
+            node.previous = node.next = null;
+        } else {
+            if (this.tail.next != null) {
+                throw new RuntimeException();
+            }
+            Node oldTail = this.tail;
+            Node newTail = node;
+            
+            oldTail.next = newTail;
+            
+            newTail.next = null;
+            newTail.previous = oldTail;
+                
+            this.tail = newTail;
+        }
+        this.size++;
+    }
+    
+    /**
+     * Returns the first node in the list.
+     */
+    public Node getFirst() {
+        return (this.head == null) ? null : this.head;
+    }
+
+    /**
+     * Returns the last node in the list.
+     */
+    public Node getLast() {
+        return (this.tail == null) ? null : this.tail;
+    }
+
+    /**
+     * Removes and returns the first node in the list.
+     */
+    public synchronized Node removeFirst() {
+        if (this.head == null) {
+            return null;
+        }
+        Node oldHead = this.head;
+        remove(this.head);
+        return oldHead;
+    }
+
+    /**
+     * Removes and returns the last node in the list.
+     */
+    public synchronized Node removeLast() {
+        if (this.tail == null) {
+            return null;
+        }
+        Node oldTail = this.tail;
+        remove(this.tail);
+        return oldTail;
+    }
+    
+    /**
+     * Removes the node from the list.
+     */
+    public synchronized void remove(Node node) {
+        Node nextNode = node.next;
+        Node prevNode = node.previous;
+        
+        if (nextNode == null && prevNode == null) {
+            if (node != this.tail && node != this.head) {
+                throw new RuntimeException();
+            }
+            this.head = this.tail = null;
+        } else if (nextNode != null && prevNode != null) {
+            prevNode.next = nextNode;
+            nextNode.previous = prevNode;
+        } else if (nextNode != null && prevNode == null) {
+            if (node != this.head) {
+                throw new RuntimeException();
+            } 
+            nextNode.previous = null;
+            this.head = nextNode;
+        } else if (nextNode == null && prevNode != null) {
+            if (node != this.tail) {
+                throw new RuntimeException();
+            }
+            prevNode.next = null;
+            this.tail = prevNode;
+        }
+        this.size--;
+        node.next = node.previous = null;
+    }
+    
+    public String toString() {
+        StringBuffer buf = new StringBuffer();
+        int i = 0;
+        Node n = this.head;
+        if (n == null) {
+            buf.append("<empty>");
+        } else {
+            while( n != null ) {
+                buf.append("[" + i + "]: ").append(n).append("\r\n");
+                n = n.next;
+                i++;
+            }
+        }
+        return buf.toString();
+    }
+
+    public static class Node {
+
+        Node next;
+        Node previous;
+        Object value;
+
+        public Node() {}
+
+        public Node(Object value) {
+            this.value = value;
+        }
+
+        public void setValue(Object value) {
+            this.value = value;
+        }
+
+        public Object getValue() {
+            return this.value;
+        }
+
+        public Node getNext() {
+            return this.next;
+        }
+
+        public Node getPrevious() {
+            return this.previous;
+        }
+    }
+
+    private static class NodeIterator implements Iterator {
+        
+        private Node currentNode;
+        private boolean forward;
+        
+        public NodeIterator(Node startNode, boolean forward) {
+            this.currentNode = startNode;
+            this.forward = forward;
+        }
+        
+        public boolean hasNext() {
+            return (this.currentNode == null) ? false : true;
+        }
+        
+        public Object next() {
+            Node node = this.currentNode;
+            if (node == null) {
+                throw new NoSuchElementException();
+            }
+            if (this.forward) {
+                this.currentNode = this.currentNode.next;
+            } else {
+                this.currentNode = this.currentNode.previous;
+            }
+            return node;
+        }
+        
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+        
+    }
+    
+}
+
+    

Added: incubator/apollo/globus/core/source/src/org/oasis/AnyListType.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/oasis/AnyListType.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/oasis/AnyListType.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,46 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.oasis;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+public interface AnyListType {
+
+    /**
+     * Iterator over values.
+     */
+    Iterator iterator();
+
+    /**
+     * Returns element name associated with the 
+     * given type.
+     */
+    QName getElementName(Class type);
+    
+    /**
+     * Returns class for the given element name
+     */
+    Class getType(QName elementName);
+    
+    void add(Object value);
+    
+    int size();
+    
+    Object get(int index);
+    
+}

Added: incubator/apollo/globus/core/source/src/org/oasis/DialectDependentType.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/oasis/DialectDependentType.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/oasis/DialectDependentType.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,30 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.oasis;
+
+import org.apache.axis.types.URI;
+
+public interface DialectDependentType
+{
+    URI getDialect();
+
+    void setDialect(URI dialect);
+
+    Object getValue();
+
+    void setValue(Object value);
+
+}

Added: incubator/apollo/globus/core/source/src/org/oasis/wsn/TopicExpressionType.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/oasis/wsn/TopicExpressionType.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/oasis/wsn/TopicExpressionType.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,113 @@
+/**
+ * TopicExpressionType.java
+ *
+ */
+
+package org.oasis.wsn;
+
+import java.io.Serializable;
+
+import org.apache.axis.encoding.SimpleType;
+import org.apache.axis.types.URI;
+
+import org.oasis.DialectDependentType;
+
+public class TopicExpressionType implements SimpleType, 
+                                            DialectDependentType,
+                                            Serializable
+{
+    
+    public static final String NAMESPACE =
+        "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
+    
+    public static final String DIALECT_ATTR = 
+        "Dialect";
+
+    private URI dialect;  // attribute
+    private Object value;
+
+    public TopicExpressionType()
+    {
+        this((URI)null, null);
+    }
+
+    public TopicExpressionType(String dialect, Object value) 
+        throws URI.MalformedURIException
+    {
+        this(new URI(dialect), value);
+    }
+
+    public TopicExpressionType(URI dialect, Object value)
+    {
+        this.value = value;
+        this.dialect = dialect;
+    }
+
+    /**
+     * Gets the dialect value for this TopicExpressionType.
+     *
+     * @return dialect
+     */
+    public URI getDialect()
+    {
+        return dialect;
+    }
+
+    /**
+     * Sets the dialect value for this TopicExpressionType.
+     *
+     * @param dialect
+     */
+    public void setDialect(String dialect)
+        throws URI.MalformedURIException
+    {
+        setDialect(new URI(dialect));
+    }
+
+    /**
+     * Sets the dialect value for this TopicExpressionType.
+     *
+     * @param dialect
+     */
+    public void setDialect(URI dialect)
+    {
+        this.dialect = dialect;
+    }
+
+    public Object getValue()
+    {
+        return value;
+    }
+
+    public void setValue(Object value)
+    {
+        this.value = value;
+    }
+
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+            new org.apache.axis.description.TypeDesc(TopicExpressionType.class,
+                                                     true);
+
+    static
+    {
+        typeDesc.setXmlType(new javax.xml.namespace.QName(
+                                     NAMESPACE,
+                                     "TopicExpressionType"));
+        org.apache.axis.description.AttributeDesc attrField =
+                new org.apache.axis.description.AttributeDesc();
+        attrField.setFieldName("dialect");
+        attrField.setXmlName(new javax.xml.namespace.QName("", DIALECT_ATTR));
+        attrField.setXmlType(new javax.xml.namespace.QName(
+                "http://www.w3.org/2001/XMLSchema", "anyURI"));
+        typeDesc.addFieldDesc(attrField);
+    }
+
+    /**
+     * Return type metadata object
+     */
+    public static org.apache.axis.description.TypeDesc getTypeDesc()
+    {
+        return typeDesc;
+    }
+}

Added: incubator/apollo/globus/core/source/src/org/oasis/wsrf/properties/QueryExpressionType.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/oasis/wsrf/properties/QueryExpressionType.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/oasis/wsrf/properties/QueryExpressionType.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,111 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.oasis.wsrf.properties;
+
+import java.io.Serializable;
+
+import org.apache.axis.encoding.SimpleType;
+import org.apache.axis.types.URI;
+
+import org.oasis.DialectDependentType;
+
+public class QueryExpressionType 
+    implements Serializable, 
+               SimpleType,
+               DialectDependentType {
+
+    public static final String NAMESPACE =
+        "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
+    
+    public static final String DIALECT_ATTR = 
+        "Dialect";
+
+    private URI dialect;  // attribute
+    private Object value;
+    
+    public QueryExpressionType() {
+    }
+
+    public QueryExpressionType(String dialect, Object value) 
+        throws URI.MalformedURIException {
+        this(new URI(dialect), value);
+    }
+    
+    public QueryExpressionType(URI dialect, Object value) {
+        this.dialect = dialect;
+        this.value = value;
+    }
+
+    /**
+     * Gets the dialect value for this QueryExpressionType.
+     * 
+     * @return dialect
+     */
+    public URI getDialect() {
+        return dialect;
+    }
+
+    /**
+     * Sets the dialect value for this QueryExpressionType.
+     *
+     * @param dialect
+     */
+    public void setDialect(String dialect)
+        throws URI.MalformedURIException
+    {
+        setDialect(new URI(dialect));
+    }
+
+    /**
+     * Sets the dialect value for this QueryExpressionType.
+     * 
+     * @param dialect
+     */
+    public void setDialect(URI dialect) {
+        this.dialect = dialect;
+    }
+
+    public Object getValue() {
+        return this.value;
+    }
+
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+        new org.apache.axis.description.TypeDesc(QueryExpressionType.class, true);
+
+    static {
+        typeDesc.setXmlType(new javax.xml.namespace.QName(
+                                    NAMESPACE,
+                                    "QueryExpressionType"));
+        org.apache.axis.description.AttributeDesc attrField = new org.apache.axis.description.AttributeDesc();
+        attrField.setFieldName("dialect");
+        attrField.setXmlName(new javax.xml.namespace.QName("", DIALECT_ATTR));
+        attrField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "anyURI"));
+        typeDesc.addFieldDesc(attrField);
+    }
+
+    /**
+     * Return type metadata object
+     */
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {
+        return typeDesc;
+    }
+
+}

Added: incubator/apollo/globus/core/source/src/org/oasis/wsrf/properties/SetResourceProperties_Element.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/source/src/org/oasis/wsrf/properties/SetResourceProperties_Element.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/source/src/org/oasis/wsrf/properties/SetResourceProperties_Element.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,122 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.oasis.wsrf.properties;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.io.Serializable;
+
+import org.oasis.AnyListType;
+
+import javax.xml.namespace.QName;
+
+public class SetResourceProperties_Element implements AnyListType, Serializable {
+    
+    private static final String PROPERTIES_NS =
+        "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
+    
+    private QName INSERT_NAME = 
+        new QName(PROPERTIES_NS, "Insert");
+
+    private QName DELETE_NAME = 
+        new QName(PROPERTIES_NS, "Delete");
+
+    private QName UPDATE_NAME = 
+        new QName(PROPERTIES_NS, "Update");
+
+    private List values;
+    
+    public SetResourceProperties_Element() {
+        this.values = new ArrayList();
+    }
+    
+    public void add(Object value) {
+        if (value instanceof DeleteType ||
+            value instanceof InsertType ||
+            value instanceof UpdateType) {
+            values.add(value);
+        } else {
+            throw new IllegalArgumentException();
+        }
+    }
+
+    public int size() {
+        return this.values.size();
+    }
+
+    public Object get(int index) {
+        return this.values.get(index);
+    }
+
+    public Iterator iterator() {
+        return values.iterator();
+    } 
+    
+    public QName getElementName(Class clazz) {
+        if (clazz == DeleteType.class) {
+            return DELETE_NAME;
+        } else if (clazz == InsertType.class) {
+            return INSERT_NAME;
+        } else if (clazz == UpdateType.class) {
+            return UPDATE_NAME;
+        } else {
+            return null;
+        }
+    }
+
+    public Class getType(QName elementName) {
+        if (elementName.equals(DELETE_NAME)) {
+            return DeleteType.class;
+        } else if (elementName.equals(INSERT_NAME)) {
+            return InsertType.class;
+        } else if (elementName.equals(UPDATE_NAME)) {
+            return UpdateType.class;
+        } else {
+            return null;
+        }
+    }
+
+    public void setInsert(InsertType insert) {
+        this.values.clear();
+        this.values.add(insert);
+    }
+
+    public void setUpdate(UpdateType update) {
+        this.values.clear();
+        this.values.add(update);
+    }
+
+    public void setDelete(DeleteType delete) {
+        this.values.clear();
+        this.values.add(delete);
+    }
+
+    // Type metadata
+    private static org.apache.axis.description.TypeDesc typeDesc =
+        new org.apache.axis.description.TypeDesc(SetResourceProperties_Element.class, true);
+
+    static {
+        typeDesc.setXmlType(new QName(PROPERTIES_NS, 
+                                      ">SetResourceProperties"));
+    }
+    
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {
+        return typeDesc;
+    }
+
+}
+

Added: incubator/apollo/globus/core/test/base/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/base/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/base/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_test_base" basedir=".">
+
+    <description>
+        Targets for building basic testing infrastucture
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+    
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="../../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="base.name" value="wsrf_test"/>
+    <property name="package.name" value="globus_${base.name}"/>
+    <property name="gar.name" value="${package.name}.gar"/>
+    <property name="jar.name" value="${base.name}.jar"/>
+    <property name="build.dir"  location="build"/>
+    <property name="build.dest" location="build/classes"/>
+    <property name="build.lib.dir" location="build/lib"/>
+    <property name="java.debug" value="on"/>
+    <property name="java.deprecation" value="true"/>
+    <property name="build.packages" location=
+        "${deploy.dir}/share/globus_wsrf_common/build-packages.xml"/>
+
+    <property name="garjars.id" value="garjars"/>
+    <fileset dir="${build.lib.dir}" id="garjars"/>
+
+    <property name="garshare.id" value="garshare"/>
+    <fileset dir="share" id="garshare"/>
+
+    <target name="init">
+        <mkdir dir="${build.dir}"/>
+        <mkdir dir="${build.dest}"/>
+        <mkdir dir="${build.lib.dir}"/>
+        <copy todir="${build.lib.dir}"> 
+          <fileset dir="lib"/>
+        </copy>
+    </target>
+
+    <target name="compile" depends="init">
+        <javac srcdir="src" destdir="${build.dest}" 
+               debug="${java.debug}" deprecation="${java.deprecation}">
+            <include name="**/*.java"/>
+            <classpath>
+                <pathelement location="${stubs.dest}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+                <fileset dir="./lib">
+                    <include name="*.jar"/>
+                </fileset>
+            </classpath>
+        </javac>
+    </target>
+
+    <target name="jar" depends="compile">
+        <jar destfile="${build.lib.dir}/${jar.name}" basedir="${build.dest}"/>
+    </target>
+
+    <target name="dist" depends="jar">
+        <ant antfile="${build.packages}" target="makeGar">
+            <reference refid="${garjars.id}"/>  
+            <reference refid="${garshare.id}"/>  
+        </ant>
+    </target>
+
+    <target name="deploy" depends="dist">
+        <ant antfile="${build.packages}" target="deployGar"/>
+    </target>  
+
+    <target name="undeploy">
+        <ant antfile="${build.packages}" target="undeployGar">
+            <property name="gar.id" value="${package.name}"/>
+        </ant>
+    </target>
+
+   <target name="all" depends="deploy"/>
+
+   <target name="clean">
+        <delete dir="tmp"/>
+        <delete dir="${build.dir}"/>
+        <delete file="${gar.name}"/>
+   </target>
+
+</project>

Added: incubator/apollo/globus/core/test/base/lib/junit.LICENSE
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/base/lib/junit.LICENSE?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/base/lib/junit.LICENSE	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+<HEAD>
+<TITLE>Common Public License - v 1.0</TITLE>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</HEAD>
+
+<BODY BGCOLOR="#FFFFFF" VLINK="#800000">
+
+
+<P ALIGN="CENTER"><B>Common Public License - v 1.0</B>
+<P><B></B><FONT SIZE="3"></FONT>
+<P><FONT SIZE="3"></FONT><FONT SIZE="2">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT").  ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"><B>1.  DEFINITIONS</B></FONT>
+<P><FONT SIZE="2">"Contribution" means:</FONT>
+
+<UL><FONT SIZE="2">a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and<BR CLEAR="LEFT">
+b) in the case of each subsequent Contributor:</FONT></UL>
+
+
+<UL><FONT SIZE="2">i)	 	changes to the Program, and</FONT></UL>
+
+
+<UL><FONT SIZE="2">ii)		additions to the Program;</FONT></UL>
+
+
+<UL><FONT SIZE="2">where such changes and/or additions to the Program originate from and are distributed by that particular Contributor.  </FONT><FONT SIZE="2">A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf.  </FONT><FONT SIZE="2">Contributions do not include additions to the Program which:  (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.  </FONT></UL>
+
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">"Contributor" means any person or entity that distributes the Program.</FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.  </FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2">"Program" means the Contributions distributed in accordance with this Agreement.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.</FONT>
+<P><FONT SIZE="2"><B></B></FONT>
+<P><FONT SIZE="2"><B>2.  GRANT OF RIGHTS</B></FONT>
+
+<UL><FONT SIZE="2"></FONT><FONT SIZE="2">a)	</FONT><FONT SIZE="2">Subject to the terms of this Agreement, each Contributor hereby grants</FONT><FONT SIZE="2"> Recipient a non-exclusive, worldwide, royalty-free copyright license to</FONT><FONT SIZE="2" COLOR="#FF0000"> </FONT><FONT SIZE="2">reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.</FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT><FONT SIZE="2">b) 	Subject to the terms of this Agreement, each Contributor hereby grants </FONT><FONT SIZE="2">Recipient a non-exclusive, worldwide,</FONT><FONT SIZE="2" COLOR="#008000"> </FONT><FONT SIZE="2">royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form.  This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents.  The patent license shall not apply to any other combinations which include the Contribution.  No hardware per se is licensed hereunder.   </FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT></UL>
+
+
+<UL><FONT SIZE="2">c)	Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity.  Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise.  As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any.  For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.</FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT></UL>
+
+
+<UL><FONT SIZE="2">d)	Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. </FONT></UL>
+
+
+<UL><FONT SIZE="2"></FONT></UL>
+
+<P><FONT SIZE="2"><B>3.  REQUIREMENTS</B></FONT>
+<P><FONT SIZE="2"><B></B>A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:</FONT>
+
+<UL><FONT SIZE="2">a)	it complies with the terms and conditions of this Agreement; and</FONT></UL>
+
+
+<UL><FONT SIZE="2">b)	its license agreement:</FONT></UL>
+
+
+<UL><FONT SIZE="2">i)	effectively disclaims</FONT><FONT SIZE="2"> on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; </FONT></UL>
+
+
+<UL><FONT SIZE="2">ii) 	effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; </FONT></UL>
+
+
+<UL><FONT SIZE="2">iii)</FONT><FONT SIZE="2">	states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and</FONT></UL>
+
+
+<UL><FONT SIZE="2">iv)	states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.</FONT><FONT SIZE="2" COLOR="#0000FF"> </FONT><FONT SIZE="2" COLOR="#FF0000"></FONT></UL>
+
+
+<UL><FONT SIZE="2" COLOR="#FF0000"></FONT><FONT SIZE="2"></FONT></UL>
+
+<P><FONT SIZE="2">When the Program is made available in source code form:</FONT>
+
+<UL><FONT SIZE="2">a)	it must be made available under this Agreement; and </FONT></UL>
+
+
+<UL><FONT SIZE="2">b)	a copy of this Agreement must be included with each copy of the Program.  </FONT></UL>
+
+<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT>
+<P><FONT SIZE="2" COLOR="#0000FF"><STRIKE></STRIKE></FONT><FONT SIZE="2">Contributors may not remove or alter any copyright notices contained within the Program.  </FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.  </FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"><B>4.  COMMERCIAL DISTRIBUTION</B></FONT>
+<P><FONT SIZE="2">Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like.  While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors.   Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering.  The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement.  In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations.  The Indemnified Contributor may participate in any such claim at its own expense.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">For example, a Contributor might include the Program in a commercial product offering, Product X.  That Contributor is then a Commercial Contributor.  If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone.  Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.</FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2" COLOR="#0000FF"></FONT>
+<P><FONT SIZE="2" COLOR="#0000FF"></FONT><FONT SIZE="2"><B>5.  NO WARRANTY</B></FONT>
+<P><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is</FONT><FONT SIZE="2"> solely responsible for determining the appropriateness of using and distributing </FONT><FONT SIZE="2">the Program</FONT><FONT SIZE="2"> and assumes all risks associated with its exercise of rights under this Agreement</FONT><FONT SIZE="2">, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, </FONT><FONT SIZE="2">programs or equipment, and unavailability or interruption of operations</FONT><FONT SIZE="2">.  </FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"><B>6.  DISCLAIMER OF LIABILITY</B></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2">EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES </FONT><FONT SIZE="2">(INCLUDING WITHOUT LIMITATION LOST PROFITS),</FONT><FONT SIZE="2"> 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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"><B>7.  GENERAL</B></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2">If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed.  In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. </FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance.  If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable.  However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.  </FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2">Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted  and may only be modified in the following manner. The Agreement Steward reserves the right to </FONT><FONT SIZE="2">publish new versions (including revisions) of this Agreement from time to </FONT><FONT SIZE="2">time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward.   IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity.  </FONT><FONT SIZE="2">Each new version of the Agreement will be given a distinguishing version number.  The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new </FONT><FONT SIZE="2">version.  </FONT><FONT SIZE="2">Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, </FONT><FONT SIZE="2">by implication, estoppel or otherwise</FONT><FONT SIZE="2">.</FONT><FONT SIZE="2">  All rights in the Program not expressly granted under this Agreement are reserved.</FONT>
+<P><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2">This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose.  Each party waives its rights to a jury trial in any resulting litigation.</FONT>
+<P><FONT SIZE="2"></FONT><FONT SIZE="2"></FONT>
+<P><FONT SIZE="2"></FONT>
+
+</BODY>
+
+</HTML>
\ No newline at end of file

Added: incubator/apollo/globus/core/test/base/lib/junit.jar
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/base/lib/junit.jar?view=auto&rev=124127
==============================================================================
Binary file. No diff available.

Added: incubator/apollo/globus/core/test/base/pkgdata/filelist
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/base/pkgdata/filelist?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/base/pkgdata/filelist	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,5 @@
+etc/globus_packages/globus_wsrf_test/undeploy.xml
+lib/wsrf_test.jar
+lib/junit.jar
+share/licenses/junit.LICENSE
+share/globus_wsrf_test/runtests.xml

Added: incubator/apollo/globus/core/test/base/pkgdata/pkg_data_src.gpt
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/base/pkgdata/pkg_data_src.gpt?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/base/pkgdata/pkg_data_src.gpt	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE gpt_package_metadata SYSTEM "package.dtd">
+
+<gpt_package_metadata Format_Version="0.01" Name="globus_java_ws_core_test_base">
+
+    <Aging_Version Age="0" Major="0" Minor="1"/>
+    <Description>
+        The Java WS Core Testing package
+    </Description>
+    <Functional_Group>Core</Functional_Group>
+    <Version_Stability Release="alpha" />
+
+    <src_pkg >
+
+        <Source_Dependencies Type="compile" >
+            <Dependency Name="globus_java_ws_core" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+        </Source_Dependencies>
+
+        <Build_Environment >
+            <cflags ></cflags>
+            <external_includes ></external_includes>
+            <pkg_libs ></pkg_libs>
+            <external_libs ></external_libs>
+        </Build_Environment>
+
+        <With_Flavors build="no" />
+
+        <Version_Label>0.1</Version_Label>
+
+        <Build_Instructions>
+            <Build_Step>ant deploy -Ddeploy.dir=INSTALLDIR_GPTMACRO</Build_Step>
+        </Build_Instructions>
+
+    </src_pkg >
+
+</gpt_package_metadata>

Added: incubator/apollo/globus/core/test/base/share/runtests.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/base/share/runtests.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/base/share/runtests.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,140 @@
+<?xml version="1.0"?>
+
+<project default="runServer" name="globus_wsrf_test_base" basedir=".">
+
+    <description>
+        Targets for executing tests with binary installations.
+        Make sure GLOBUS_LOCATION env. variable is properly set.
+        Then execute ant -f runtests.xml -Dtests.jar=&lt;jar file&gt;
+        (where &lt;jar file&gt; contains test classes)
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+    
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="abs.deploy.dir" location="${deploy.dir}"/>
+
+    <property name="test.dir" value="tests"/>
+    <property name="tests.dir" value="${test.dir}/classes"/>
+
+    <property name="junit.reports.dir" 
+              location="${test.dir}/test-reports"/>
+    <property name="junit.html.reports.dir" 
+              location="${test.dir}/test-reports-html"/>
+    <property name="junit.haltonfailure" value="true"/>
+    <property name="junit.test.format" value="xml"/>
+    <property name="junit.timeout" value="600000"/>
+    <property name="junit.jvmarg" value="-Dignore" />
+
+    <property name="test.server.url" 
+              value="http://localhost:8080/wsrf/services/"/>
+
+    <target name="init">
+      <fail message="Must specify tests jar file (-Dtests.jar=&lt;jar&gt;)" 
+            unless="tests.jar"/>
+      <mkdir dir="${test.dir}"/>
+      <delete dir="${tests.dir}"/>
+      <mkdir dir="${tests.dir}"/>
+      <unjar src="${tests.jar}" dest="${tests.dir}"/>
+    </target>
+
+    <target name="runServer" 
+            description="Executes tests contained in a jar file 
+                         (in internal container)"
+            depends="init">
+      <property name="server.arg" 
+                value="-Dweb.server.url=${test.server.url}" />
+      <antcall target="runTests"/>
+      <antcall target="runSecurityTests"/>
+    </target>
+
+    <target name="run" 
+            description="Executes tests contained in a jar file 
+                         (in external container)"
+            depends="init">
+      <property name="server.arg" value="-Dignore" />
+      <antcall target="runTests"/>
+      <antcall target="runSecurityTests"/>
+    </target>
+
+    <target name="runTests" unless="securityTestsOnly">
+      <patternset id="package.fileset">
+         <include name="**/PackageTests.class" />
+      </patternset>
+      <antcall target="_runCustomTests">
+          <reference refid="package.fileset" torefid="test.fileset"/>
+      </antcall>
+      <patternset id="post.package.fileset">
+         <include name="**/PostPackageTests.class" />
+      </patternset>
+      <antcall target="_runCustomTests">
+          <reference refid="post.package.fileset" torefid="test.fileset"/>
+      </antcall>
+    </target>
+
+    <target name="runSecurityTests" unless="basicTestsOnly">
+      <patternset id="security.fileset">
+         <include name="**/SecurityTests.class" />
+      </patternset>
+      <antcall target="_runCustomTests">
+          <reference refid="security.fileset" torefid="test.fileset"/>
+      </antcall>
+      <patternset id="post.security.fileset">
+         <include name="**/PostSecurityTests.class" />
+      </patternset>
+      <antcall target="_runCustomTests">
+          <reference refid="post.security.fileset" torefid="test.fileset"/>
+      </antcall>
+    </target>
+
+   <target name="_runCustomTests">
+      <mkdir dir="${junit.reports.dir}" />
+      <junit printsummary="yes" 
+             haltonfailure="${junit.haltonfailure}" 
+             fork="yes" 
+             timeout="${junit.timeout}">
+            <sysproperty key="org.globus.wsrf.container.webroot" 
+                value="${abs.deploy.dir}"/>
+            <sysproperty key="GLOBUS_LOCATION" 
+                value="${abs.deploy.dir}"/>
+            <classpath>
+                <pathelement location="${abs.deploy.dir}"/>
+                <fileset dir="${abs.deploy.dir}/lib">
+                    <include name="*.jar"/>
+                </fileset>
+            </classpath>
+        <formatter type="${junit.test.format}" />
+        <batchtest todir="${junit.reports.dir}">
+         <fileset dir="${tests.dir}">
+            <patternset refid="test.fileset"/>
+         </fileset>
+        </batchtest>
+        <jvmarg value="-Djava.endorsed.dirs=${abs.deploy.dir}/endorsed"/>
+        <jvmarg value="${server.arg}" />
+        <jvmarg line="${junit.jvmarg}" />
+      </junit>
+    </target>
+
+
+   <target name="generateTestReport"
+           description="Generates html report of test results. Must be executed after test are executed">
+       <delete dir= "${junit.html.reports.dir}"/>
+       <mkdir dir = "${junit.html.reports.dir}"/>
+       <junitreport todir="${junit.reports.dir}">
+          <fileset dir="${junit.reports.dir}">
+            <include name="TEST-*.xml"/>
+          </fileset>
+          <report format="frames" todir="${junit.html.reports.dir}"/>
+      </junitreport>
+   </target>
+
+</project>

Added: incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/GSITestContainer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/GSITestContainer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/GSITestContainer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,52 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.test;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.axis.util.Util;
+import org.globus.wsrf.container.ServiceContainer;
+
+public class GSITestContainer extends TestContainer {
+    static Log logger = LogFactory.getLog(GSITestContainer.class.getName());
+
+    protected static final String SECURE_WEB_SERVER_URL = 
+        "secure.web.server.url";
+
+    static {
+        Util.registerTransport();
+    }
+
+    protected String getPropertySeverUrl() {
+        return System.getProperty(SECURE_WEB_SERVER_URL);
+    }
+
+    public GSITestContainer()
+    {
+        super();
+        this.properties.put(ServiceContainer.CLASS,
+                            "org.globus.wsrf.container.GSIServiceContainer");
+    }
+
+    public GSITestContainer(String containerConfigFile)
+    {
+        super(containerConfigFile);
+        this.properties.put(ServiceContainer.CLASS,
+                            "org.globus.wsrf.container.GSIServiceContainer");
+    }
+
+}

Added: incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/GridTestCase.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/GridTestCase.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/GridTestCase.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,38 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.test;
+
+import junit.framework.TestCase;
+
+public class GridTestCase extends TestCase
+{
+    protected static TestContainer TEST_CONTAINER = null;
+
+    public GridTestCase(String name)
+    {
+        super(name);
+    }
+
+    public static void setTestServer(TestContainer testContainer)
+    {
+        GridTestCase.TEST_CONTAINER = testContainer;
+    }
+
+    protected void setUp() throws Exception
+    {
+        assertTrue(GridTestCase.TEST_CONTAINER != null);
+    }
+}

Added: incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/GridTestSuite.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/GridTestSuite.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/GridTestSuite.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,90 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.test;
+
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+public class GridTestSuite extends TestSuite
+{
+    public static int timeout =  1000 * 60 * 2;
+
+    protected TestContainer testContainer;
+    private String testClassPattern;
+    private String containerConfigFile;
+
+    public GridTestSuite(String name)
+    {
+        this(name, null);
+    }
+
+    public GridTestSuite(String name, String containerConfigFile)
+    {
+        super(name);
+        this.testClassPattern =
+            System.getProperty("org.globus.wsrf.test.pattern");
+        this.containerConfigFile = containerConfigFile;
+    }
+
+    public void addTestSuite(Class testClass)
+    {
+        if((this.testClassPattern != null) &&
+           (!this.testClassPattern.equals("*")))
+        {
+            if(testClass.getName().indexOf(this.testClassPattern) == -1)
+            {
+                return;
+            }
+        }
+
+        super.addTestSuite(testClass);
+    }
+
+    public void run(TestResult result)
+    {
+        if(this.containerConfigFile == null)
+        {
+            this.testContainer = new TestContainer();
+        }
+        else
+        {
+            this.testContainer =
+                new TestContainer(this.containerConfigFile);
+        }
+
+        try
+        {
+            this.testContainer.start();
+            GridTestCase.setTestServer(this.testContainer);
+            super.run(result);
+        }
+        catch(Exception e)
+        {
+            result.addError(this, e);
+        }
+        finally
+        {
+            try
+            {
+                this.testContainer.stop();
+            }
+            catch (Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+    }
+}

Added: incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/TestContainer.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/TestContainer.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/base/src/org/globus/wsrf/test/TestContainer.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,160 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.test;
+
+import java.net.InetAddress;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.container.ServiceContainer;
+
+public class TestContainer
+{
+    protected ServiceContainer server = null;
+    protected Map properties = null;
+
+    protected String baseURL;
+    protected String webServerURL = null;
+
+    protected static final String WEB_SERVER_URL = 
+        "web.server.url";
+
+    private boolean collocated;
+
+    private static Log logger = 
+        LogFactory.getLog(TestContainer.class.getName());
+
+    public TestContainer()
+    {
+        this.properties = new HashMap();
+        this.properties.put(ServiceContainer.MAIN_THREAD,
+                            Boolean.FALSE);
+    }
+
+    public TestContainer(String containerConfigFile)
+    {
+        this();
+        this.properties.put(ServiceContainer.SERVER_CONFIG,
+                            containerConfigFile);
+    }
+
+    public boolean isCollocated()
+    {
+        return this.collocated;
+    }
+
+    protected String getPropertySeverUrl() {
+        return System.getProperty(WEB_SERVER_URL);
+    }
+
+    public void start() throws Exception
+    {
+        this.webServerURL = getPropertySeverUrl();
+
+        if(this.webServerURL == null)
+        {
+            if(server == null)
+            {
+                this.collocated = true;
+                this.server =
+                    ServiceContainer.createContainer(this.properties);
+                logger.debug("Starting standalone container at:" +
+                             this.server.getURLString());
+            }
+
+            this.baseURL = this.server.getURLString();
+        }
+        else
+        {
+            this.collocated = false;
+            this.baseURL = getIP(this.webServerURL);
+            logger.debug(
+                "Starting test using server container at:" + this.baseURL);
+        }
+    }
+
+    public void stop() throws Exception
+    {
+        if(this.webServerURL == null && this.server != null)
+        {
+            this.server.stop();
+        }
+    }
+
+    public String getBaseURL()
+    {
+        return this.baseURL;
+    }
+
+    public int getPort()
+    {
+        int port = 0;
+
+        try
+        {
+            port = new URL(this.baseURL).getPort();
+        }
+        catch(Exception e)
+        {
+        }
+
+        return port;
+    }
+
+    public String getHost()
+    {
+        try
+        {
+            return new URL(this.baseURL).getHost();
+        }
+        catch(Exception e)
+        {
+            return "localhost";
+        }
+    }
+
+    public String getIP(String urlString) throws Exception
+    {
+        URL url = new URL(urlString);
+        String host = url.getHost();
+        String ipHost = null;
+
+        if(host.equals("localhost") || host.equals("127.0.0.1"))
+        {
+            ipHost = InetAddress.getLocalHost().getHostAddress();
+        }
+        else
+        {
+            try
+            {
+                ipHost = InetAddress.getByName(host).getHostAddress();
+            }
+            catch(Exception e)
+            {
+                // assume ip-address was used
+                ipHost = host;
+            }
+        }
+
+        url = new URL(url.getProtocol(), ipHost,
+                      url.getPort(), url.getPath());
+        return url.toExternalForm();
+    }
+}

Added: incubator/apollo/globus/core/test/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_core_test" basedir=".">
+
+    <description>
+        Targets for testing the core
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+    
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="sample.dir" location="../samples"/>
+
+    <target name="init">
+        <ant dir="${sample.dir}" target="deploy"/>
+    </target>
+
+    <target name="compile">
+        <!-- have to deploy base otherwise rest won't compile -->
+        <ant dir="base" target="deploy"/>
+        <ant dir="interop" target="compile"/>
+        <ant dir="unit" target="compile"/>
+    </target>
+
+    <target name="deploy" depends="init">
+        <ant dir="base" target="deploy"/>
+        <ant dir="interop" target="deploy"/>
+        <ant dir="unit" target="deploy"/>
+    </target>
+
+   <target name="clean">
+        <ant dir="base" target="clean"/>
+        <ant dir="interop" target="clean"/>
+        <ant dir="unit" target="clean"/>
+    </target>
+
+   <target name="test">
+        <ant dir="interop" target="test"/>
+        <ant dir="unit" target="test"/>
+    </target>
+
+   <target name="testServer">
+        <ant dir="interop" target="testServer"/>
+        <ant dir="unit" target="testServer"/>
+    </target>
+
+   <target name="all" depends="compile"/>
+
+</project>

Added: incubator/apollo/globus/core/test/interop/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,217 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_test_interop" basedir=".">
+    <description>
+        WSRF InterOp Test Implementation
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+    
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="../../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="base.name" value="wsrf_test_interop"/>
+    <property name="package.name" value="globus_${base.name}"/>
+    <property name="gar.name" value="${package.name}.gar"/>
+    <property name="jar.name" value="${base.name}.jar"/>
+    <property name="stubs.jar.name" value="${base.name}_stubs.jar"/>
+    <property name="build.dir"  location="build"/>
+    <property name="build.dest" location="build/classes"/>
+    <property name="build.lib.dir" location="build/lib"/>
+    <property name="stubs.dir" location="build/stubs"/>
+    <property name="stubs.src" location="build/stubs/src"/>
+    <property name="stubs.dest" location="build/stubs/classes"/>
+    <property name="build.packages" location=
+        "${deploy.dir}/share/globus_wsrf_common/build-packages.xml"/>
+    <property name="build.stubs" location=
+        "${deploy.dir}/share/globus_wsrf_tools/build-stubs.xml"/>
+    <property name="java.debug" value="on"/>
+    <property name="java.deprecation" value="true"/>
+
+    <property name="junit.reports.dir" value="test-reports"/>
+    <property name="junit.haltonfailure" value="true"/>
+    <property name="junit.timeout" value="600000"/>
+    <property name="junit.jvmarg" value="-Dignore" />
+
+    <property name="test.server.url" 
+              value="http://localhost:8080/wsrf/services/"/>
+
+    <property name="schema.src"   location="${deploy.dir}/share/schema"/>
+    <property name="schema.dest"  location="${build.dir}/schema"/>
+
+    <property name="garjars.id" value="garjars"/>
+    <fileset dir="${build.lib.dir}" id="garjars"/>
+
+    <property name="garschema.id" value="garschema"/>
+    <fileset dir="${schema.dest}" includes="core/tests/interop/*" 
+        id="garschema"/>
+
+    <target name="init">
+        <mkdir dir="${build.dir}"/>
+        <mkdir dir="${build.dest}"/>
+        <mkdir dir="${build.lib.dir}"/>
+
+        <mkdir dir="${stubs.dir}"/>
+        <mkdir dir="${stubs.src}"/>
+        <mkdir dir="${stubs.dest}"/>
+
+        <mkdir dir="${schema.dest}"/>
+        <copy toDir="${schema.dest}">
+            <fileset dir="${schema.src}" casesensitive="yes">
+                <include name="core/tests/interop/**/*"/>
+                <include name="wsrf/**/*"/>
+                <include name="ws/**/*"/>
+            </fileset>
+        </copy>
+
+        <available property="stubs.present" type="dir" 
+            file="${stubs.src}/com/widgets" />
+
+        <condition property="compiler.jvmarg" value="-source 1.4">
+          <equals arg1="${ant.java.version}" arg2="1.5"/>
+        </condition>
+        <condition property="compiler.jvmarg" value="">
+         <not>
+           <isset property="${compiler.jvmarg}"/>
+         </not>
+        </condition>
+    </target>
+
+    <target name="stubs" unless="stubs.present" depends="init">
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/tests/interop"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+            <property name="wsdl.file" 
+                value="notification_consumer_factory_service.wsdl"/>
+        </ant>        
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/tests/interop"/>
+            <property name="wsdl.file" 
+                value="widget_service.wsdl"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+        </ant>
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/tests/interop"/>
+            <property name="wsdl.file" 
+                value="widget_notification_service.wsdl"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+        </ant>
+    </target>
+    
+    <target name="compileStubs" depends="stubs">
+        <javac srcdir="${stubs.src}" destdir="${stubs.dest}"
+            debug="${java.debug}"  deprecation="${java.deprecation}">
+            <include name="**/*.java"/>
+            <classpath>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+    </target>
+
+    <target name="compile" depends="compileStubs">
+        <javac srcdir="src" destdir="${build.dest}"
+            debug="${java.debug}" deprecation="${java.deprecation}">
+            <include name="**/*.java"/>
+            <classpath>
+                <pathelement location="${stubs.dest}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+    </target>
+
+    <target name="jarStubs" depends="compileStubs">
+        <jar destfile="${build.lib.dir}/${stubs.jar.name}" 
+            basedir="${stubs.dest}"/>
+    </target>
+
+    <target name="jar" depends="compile">
+        <jar destfile="${build.lib.dir}/${jar.name}" basedir="${build.dest}"/>
+    </target>
+
+    <target name="dist" depends="jarStubs, jar">
+        <ant antfile="${build.packages}" target="makeGar">
+            <reference refid="${garjars.id}"/>  
+            <reference refid="${garschema.id}"/>  
+        </ant>            
+    </target>
+
+    <target name="clean">
+        <delete dir="tmp"/>
+        <delete dir="${build.dir}"/>
+        <delete file="${gar.name}"/>
+        <delete dir="${junit.reports.dir}"/>
+    </target>
+
+    <target name="deploy" depends="dist">
+        <ant antfile="${build.packages}" target="deployGar">
+            <property name="noSchema" value="true"/>
+        </ant>
+    </target>  
+
+    <target name="undeploy">
+        <ant antfile="${build.packages}" target="undeployGar">
+            <property name="gar.id" value="${package.name}"/>
+        </ant>
+    </target>
+
+    <target name="all" depends="deploy"/>
+
+    <target name="test" depends="compile">
+      <antcall target="runTests">
+        <param name="server.arg" value="-Dignore" />
+      </antcall>
+    </target>
+
+    <target name="testServer" depends="compile">
+      <antcall target="runTests">
+        <param name="server.arg" value="-Dweb.server.url=${test.server.url}" />
+      </antcall>
+    </target>
+
+    <target name="runTests">
+        <mkdir dir="${junit.reports.dir}" />
+        <junit printsummary="yes" 
+            haltonfailure="${junit.haltonfailure}" 
+            fork="yes" 
+            timeout="${junit.timeout}">
+           <sysproperty key="GLOBUS_LOCATION" value="${deploy.dir}"/>
+            <classpath>
+                <pathelement location="${build.dest}"/>
+                <pathelement location="${deploy.dir}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                </fileset>
+            </classpath>
+            <formatter type="xml" />
+            <batchtest todir="${junit.reports.dir}">
+                <fileset dir="${build.dest}">
+                    <include name="**/PackageTests.class" />
+                </fileset>
+            </batchtest>
+            <jvmarg value="-Djava.endorsed.dirs=${deploy.dir}/endorsed"/>
+            <jvmarg value="${server.arg}" />
+            <jvmarg line="${junit.jvmarg}" />
+        </junit>
+    </target>
+    
+</project>

Added: incubator/apollo/globus/core/test/interop/deploy-jndi-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/deploy-jndi-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/deploy-jndi-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jndiConfig xmlns="http://wsrf.globus.org/jndi/config">
+    <service name="WidgetService">
+        <resource
+            name="home"
+            type="org.globus.interop.widget.WidgetHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.interop.widget.Widget</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://www.globus.org/namespaces/2004/06/core}WidgetKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+    <service name="WidgetNotificationService">
+        <resource
+            name="home"
+            type="org.globus.wsrf.impl.ServiceResourceHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+</jndiConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/test/interop/deploy-server.wsdd
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/deploy-server.wsdd?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/deploy-server.wsdd	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment name="defaultServerConfig" 
+    xmlns="http://xml.apache.org/axis/wsdd/" 
+    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <service name="WidgetService" provider="Handler"
+        use="literal" style="document">
+        <parameter name="allowedMethodsClass" 
+                   value="com.widgets.WidgetPortType"/>
+        <parameter name="handlerClass" 
+                   value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className" 
+            value="org.globus.interop.widget.WidgetService"/>
+        <wsdlFile>share/schema/core/tests/interop/widget_service.wsdl</wsdlFile>
+        <parameter name="scope" value="Application"/>
+        <parameter name="providers" value="
+             DestroyProvider SetTerminationTimeProvider
+             GetRPProvider GetMRPProvider SetRPProvider QueryRPProvider
+         "/>
+
+    </service>
+
+    <service name="NotificationConsumerFactoryService" provider="Handler" 
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="handlerClass" 
+                   value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className" 
+            value="org.globus.interop.notification.NotificationConsumerFactoryService"/>
+        <wsdlFile>share/schema/core/tests/interop/notification_consumer_factory_service.wsdl</wsdlFile>
+    </service>
+
+    <service name="WidgetNotificationService" provider="Handler"
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="scope" value="Application"/>
+        <parameter name="loadOnStartup" value="true"/>
+        <parameter name="providers" value="
+             GetRPProvider SubscribeProvider GetCurrentMessageProvider
+         "/>
+        <parameter name="handlerClass" 
+                   value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className" 
+            value="org.globus.interop.widget.WidgetNotificationService"/>
+        <wsdlFile>share/schema/core/tests/interop/widget_notification_service.wsdl</wsdlFile>
+    </service>
+
+</deployment>

Added: incubator/apollo/globus/core/test/interop/pkgdata/filelist
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/pkgdata/filelist?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/pkgdata/filelist	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,6 @@
+etc/globus_packages/globus_wsrf_test_interop/undeploy.xml
+etc/globus_wsrf_test_interop/jndi-config.xml
+etc/globus_wsrf_test_interop/server-config.wsdd
+lib/wsrf_test_interop.jar
+lib/wsrf_test_interop_stubs.jar
+

Added: incubator/apollo/globus/core/test/interop/pkgdata/pkg_data_src.gpt
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/pkgdata/pkg_data_src.gpt?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/pkgdata/pkg_data_src.gpt	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE gpt_package_metadata SYSTEM "package.dtd">
+
+<gpt_package_metadata Format_Version="0.01" Name="globus_java_ws_core_test_interop">
+
+    <Aging_Version Age="0" Major="0" Minor="1"/>
+    <Description>
+        The Java WS Core Interop Testing package
+    </Description>
+    <Functional_Group>Core</Functional_Group>
+    <Version_Stability Release="alpha" />
+
+    <src_pkg >
+
+        <Source_Dependencies Type="compile" >
+            <Dependency Name="globus_java_ws_core_test_base" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+        </Source_Dependencies>
+
+        <Build_Environment >
+            <cflags ></cflags>
+            <external_includes ></external_includes>
+            <pkg_libs ></pkg_libs>
+            <external_libs ></external_libs>
+        </Build_Environment>
+
+        <With_Flavors build="no" />
+
+        <Version_Label>0.1</Version_Label>
+
+        <Build_Instructions>
+            <Build_Step>ant deploy -Ddeploy.dir=INSTALLDIR_GPTMACRO</Build_Step>
+        </Build_Instructions>
+
+    </src_pkg >
+
+</gpt_package_metadata>

Added: incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/NotificationCallback.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/NotificationCallback.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/NotificationCallback.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,44 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.interop.notification;
+
+import java.util.List;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.NotifyCallback;
+
+public class NotificationCallback implements NotifyCallback
+{
+    static Log logger = 
+        LogFactory.getLog(NotificationCallback.class.getName());
+    
+    /* (non-Javadoc)
+     * @see org.globus.wsrf.NotifyCallback#deliver(java.util.List, org.apache.axis.message.addressing.EndpointReferenceType, java.lang.Object)
+     */
+    public void deliver(List topicPath,
+                        EndpointReferenceType producer,
+                        Object message)
+    {
+        logger.debug("Topic path: " + topicPath.toString());
+        logger.debug("Message: " + message);
+        logger.debug("From: " + producer.getAddress());
+    }
+
+}

Added: incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/NotificationConsumerFactoryService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/NotificationConsumerFactoryService.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/NotificationConsumerFactoryService.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,49 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.interop.notification;
+
+import java.rmi.RemoteException;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.core.tests.interop.CreateNotificationConsumer;
+
+public class NotificationConsumerFactoryService
+{
+
+    public EndpointReferenceType createNotificationConsumer(
+        CreateNotificationConsumer arg0) throws RemoteException
+    {
+        EndpointReferenceType consumerReference = null;
+        NotificationConsumerManager manager =
+            NotificationConsumerManager.getInstance();
+
+        try
+        {
+            manager.startListening();
+            consumerReference =
+                manager.createNotificationConsumer(new NotificationCallback());
+        }
+        catch(Exception e)
+        {
+            throw new RemoteException("", e);
+        }
+
+        return consumerReference;
+    }
+
+}

Added: incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/client/Notify.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/client/Notify.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/src/org/globus/interop/notification/client/Notify.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,75 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.interop.notification.client;
+
+import org.apache.axis.message.addressing.Address;
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.globus.interop.widget.WidgetNotificationService;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.core.notification.Consumer;
+import org.globus.wsrf.core.notification.service.NotificationConsumerServiceAddressingLocator;
+import org.globus.wsrf.core.tests.interop.NotificationConsumerFactory;
+import org.globus.wsrf.core.tests.interop.CreateNotificationConsumer;
+import org.globus.wsrf.core.tests.interop.service.NotificationConsumerFactoryServiceAddressingLocator;
+import org.oasis.wsn.NotificationMessageHolderType;
+import org.oasis.wsn.TopicExpressionType;
+
+public class Notify
+{
+    public static void main(String [] args)
+    {
+        NotificationConsumerFactoryServiceAddressingLocator factoryLocator =
+            new NotificationConsumerFactoryServiceAddressingLocator();
+
+        NotificationConsumerServiceAddressingLocator consumerLocator =
+            new NotificationConsumerServiceAddressingLocator();
+
+        try
+        {
+            EndpointReferenceType endpoint = new EndpointReferenceType();
+            endpoint.setAddress(new Address(args[0]));
+            NotificationConsumerFactory factoryPort =
+                factoryLocator.getNotificationConsumerFactoryPort(endpoint);
+            EndpointReferenceType consumer =
+                factoryPort.createNotificationConsumer(
+                    new CreateNotificationConsumer());
+            Consumer consumerPort =
+                consumerLocator.getConsumerPort(consumer);
+
+            org.oasis.wsn.Notify notification = new org.oasis.wsn.Notify();
+            NotificationMessageHolderType[] message = {new NotificationMessageHolderType()};
+
+            EndpointReferenceType producerEndpoint =
+                new EndpointReferenceType();
+            Address producerAddress = new Address("http://localhost/client");
+            producerEndpoint.setAddress(producerAddress);
+
+            TopicExpressionType topic = new TopicExpressionType(
+                WSNConstants.SIMPLE_TOPIC_DIALECT,
+                WidgetNotificationService.TEST_TOPIC);
+            message[0].setProducerReference(producerEndpoint);
+            message[0].setMessage("test");
+            message[0].setTopic(topic);
+            notification.setNotificationMessage(message);
+            consumerPort.notify(notification);
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+}

Added: incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/Widget.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/Widget.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/Widget.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,112 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.interop.widget;
+
+import java.util.Calendar;
+
+import javax.xml.namespace.QName;
+
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.ResourceIdentifier;
+import org.globus.wsrf.ResourceProperties;
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.ResourceLifetime;
+import org.globus.wsrf.impl.ReflectionResourceProperty;
+import org.globus.wsrf.impl.SimpleResourcePropertySet;
+import org.globus.wsrf.impl.SimpleResourcePropertyMetaData;
+
+/**
+ * Resource Implementation
+ */
+public class Widget
+    implements Resource,
+               ResourceProperties,
+               ResourceIdentifier,
+               ResourceLifetime {
+
+    public static final QName RP_SET =
+        new QName("http://widgets.com", "Widget");
+
+    public static final QName FOO =
+        new QName("http://widgets.com", "foo");
+
+    private ResourcePropertySet propSet;
+
+    // this is the only persistent field
+    private Calendar terminationTime = null;
+    private String [] strings = null;
+    private Object key = null;
+    
+    protected void initialize(Object key) {
+        if (key== null) {
+            throw new IllegalArgumentException("id is requried");
+        }
+        this.key = key;
+        this.propSet = new SimpleResourcePropertySet(RP_SET);
+        ResourceProperty prop = null;
+
+        try {
+            prop = new ReflectionResourceProperty(SimpleResourcePropertyMetaData.TERMINATION_TIME, this);
+            this.propSet.add(prop);
+
+            prop =
+                new ReflectionResourceProperty(SimpleResourcePropertyMetaData.CURRENT_TIME,
+                                               this);
+            this.propSet.add(prop);
+
+            prop =
+                new ReflectionResourceProperty(FOO, "Foo", this);
+            this.propSet.add(prop);
+        } catch (Exception e) {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+
+    public Object create() {
+        // this will work only in memory
+        initialize(String.valueOf(hashCode()));
+        return this.key;
+    }
+    
+    public Object getID() {
+        return this.key;
+    }
+
+    public ResourcePropertySet getResourcePropertySet() {
+        return this.propSet;
+    }
+
+    public void setTerminationTime(Calendar time) {
+        this.terminationTime = time;
+    }
+
+    public Calendar getTerminationTime() {
+        return this.terminationTime;
+    }
+
+    public Calendar getCurrentTime() {
+        return Calendar.getInstance();
+    }
+
+    public String[] getFoo() {
+        return this.strings;
+    }
+
+    public void setFoo(String [] values) {
+        this.strings = values;
+    }
+}

Added: incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/WidgetHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/WidgetHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/WidgetHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,36 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.interop.widget;
+
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.impl.ResourceHomeImpl;
+import org.globus.wsrf.impl.SimpleResourceKey;
+
+/**
+ * Widget home implementation.
+ */
+public class WidgetHome extends ResourceHomeImpl {
+
+    public Widget create()
+        throws Exception {
+        Widget w = new Widget();
+        Object realKey = w.create();
+        ResourceKey key = new SimpleResourceKey(keyTypeName, realKey);
+        add(key, w);
+        return w;
+    }
+
+}

Added: incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/WidgetNotificationService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/WidgetNotificationService.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/WidgetNotificationService.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,109 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.interop.widget;
+
+import java.rmi.RemoteException;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.ResourceProperties;
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.Topic;
+import org.globus.wsrf.TopicList;
+import org.globus.wsrf.TopicListAccessor;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.impl.SimpleResourcePropertySet;
+import org.globus.wsrf.impl.SimpleTopic;
+import org.globus.wsrf.impl.SimpleTopicList;
+import org.globus.wsrf.utils.XmlUtils;
+import org.oasis.wsn.ResourceUnknownFaultType;
+import com.widgets.GenerateNotification;
+import com.widgets.GenerateNotificationResponse;
+
+public class WidgetNotificationService implements Resource,
+                                                  ResourceProperties,
+                                                  TopicListAccessor
+{
+    public static final QName RP_SET =
+        new QName("http://widgets.com", "WidgetNotification");
+    public static final QName TEST_TOPIC =
+        new QName("http://widgets.com", "TestTopic");
+
+    private TopicList topicList;
+    private ResourcePropertySet propSet;
+
+    public WidgetNotificationService()
+    {
+        this.propSet = new SimpleResourcePropertySet(RP_SET);
+        this.topicList = new SimpleTopicList(this);
+        this.topicList.addTopic(new SimpleTopic(TEST_TOPIC));
+    }
+
+    public GenerateNotificationResponse generateNotification(
+        GenerateNotification request)
+        throws RemoteException,
+               ResourceUnknownFaultType
+    {
+        Object resource = null;
+        try
+        {
+            resource = ResourceContext.getResourceContext().getResource();
+        }
+        catch(RemoteException e)
+        {
+            throw e;
+        }
+        catch(Exception e)
+        {
+            throw new RemoteException("", e);
+        }
+        TopicList topicList;
+        Element message;
+
+        topicList = ((TopicListAccessor) resource).getTopicList();
+        List topicPath = new LinkedList();
+        topicPath.add(TEST_TOPIC);
+        Topic topic = topicList.getTopic(topicPath);
+        try
+        {
+            Document document = XmlUtils.newDocument();
+            message = document.createElementNS("http://widgets.com",
+                                               "widget:TestNotification");
+            topic.notify(message);
+        }
+        catch(Exception e)
+        {
+            throw new RemoteException("", e);
+        }
+        return new GenerateNotificationResponse();
+    }
+
+    public ResourcePropertySet getResourcePropertySet()
+    {
+        return this.propSet;
+    }
+
+    public TopicList getTopicList()
+    {
+        return this.topicList;
+    }
+}

Added: incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/WidgetService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/WidgetService.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/WidgetService.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,68 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.interop.widget;
+
+import java.rmi.RemoteException;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.impl.SimpleResourceKey;
+import org.globus.wsrf.utils.AddressingUtils;
+
+import com.widgets.CreateWidget;
+import com.widgets.CreateWidgetResponse;
+
+/**
+ * Widget service implementation.
+ */
+public class WidgetService {
+
+    public CreateWidgetResponse createWidget(CreateWidget request)
+        throws RemoteException {
+        CreateWidgetResponse response = new CreateWidgetResponse();
+
+        EndpointReferenceType epr = null;
+
+        ResourceContext ctx = null;
+        WidgetHome home = null;
+        Widget resource = null;
+
+        try {
+            ctx = ResourceContext.getResourceContext();
+            home = (WidgetHome)ctx.getResourceHome();
+            resource = home.create();
+        } catch (Exception e) {
+            throw new RemoteException("", e);
+        }
+
+        ResourceKey key = new SimpleResourceKey(home.getKeyTypeName(),
+                                                resource.getID());
+        try
+        {
+            epr = AddressingUtils.createEndpointReference(ctx, key);
+        }
+        catch(Exception e1)
+        {
+            throw new RemoteException("", e1);
+        }
+
+        response.setEndpointReference(epr);
+        return response;
+    }
+
+}

Added: incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/client/Create.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/client/Create.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/client/Create.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,64 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.interop.widget.client;
+
+import java.net.URL;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import com.widgets.WidgetPortType;
+import com.widgets.CreateWidget;
+import com.widgets.CreateWidgetResponse;
+import com.widgets.service.WidgetServiceAddressingLocator;
+
+import org.globus.wsrf.encoding.ObjectSerializer;
+
+import javax.xml.namespace.QName;
+
+public class Create {
+
+    private static final QName NAME = 
+        new QName("http://widgets.com", "WidgetReference");
+
+    public static void main(String [] args) {
+
+        WidgetServiceAddressingLocator locator =
+            new WidgetServiceAddressingLocator();
+
+        String service = null;
+        if (args.length == 0) {
+            service = "http://127.0.0.1:8080/wsrf/services/WidgetService";
+        } else {
+            service = args[0];
+        }
+
+        try {
+            URL endpoint = new URL(service);
+            WidgetPortType port = locator.getWidgetPortTypePort(endpoint);
+
+            CreateWidgetResponse response =
+                port.createWidget(new CreateWidget());
+            
+            EndpointReferenceType epr = 
+                response.getEndpointReference();
+
+            System.out.println(ObjectSerializer.toString(epr, NAME));
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

Added: incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/client/GenerateNotification.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/client/GenerateNotification.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/client/GenerateNotification.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,46 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.interop.widget.client;
+
+import org.apache.axis.message.addressing.Address;
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import com.widgets.WidgetNotificationPortType;
+import com.widgets.service.WidgetNotificationServiceAddressingLocator;
+
+public class GenerateNotification
+{
+    private static WidgetNotificationServiceAddressingLocator locator =
+        new WidgetNotificationServiceAddressingLocator();
+
+    private static String serviceAddress =
+        "http://127.0.0.1:8080/wsrf/services/WidgetNotificationService";
+
+    public static void main(String [] args) {
+        if (args.length > 0) {
+            serviceAddress = args[0];
+        }
+        try {
+            EndpointReferenceType endpoint = new EndpointReferenceType();
+            endpoint.setAddress(new Address(serviceAddress));
+            WidgetNotificationPortType port =
+                locator.getWidgetNotificationPortTypePort(endpoint);
+            port.generateNotification(new com.widgets.GenerateNotification());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

Added: incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/test/InteropTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/test/InteropTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/test/InteropTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,536 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.interop.widget.test;
+
+import java.net.URL;
+import java.util.Calendar;
+import java.rmi.RemoteException;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ServiceException;
+
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.message.addressing.Address;
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.axis.message.addressing.ReferencePropertiesType;
+import org.apache.axis.types.URI;
+
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.GetCurrentMessage;
+import org.oasis.wsn.GetCurrentMessageResponse;
+import org.oasis.wsn.PauseSubscription;
+import org.oasis.wsn.ResumeSubscription;
+import org.oasis.wsn.Subscribe;
+import org.oasis.wsn.SubscribeResponse;
+import org.oasis.wsrf.lifetime.Destroy;
+import org.oasis.wsrf.lifetime.SetTerminationTime;
+import org.oasis.wsrf.lifetime.SetTerminationTimeResponse;
+import org.oasis.wsrf.properties.DeleteType;
+import org.oasis.wsrf.properties.InsertType;
+import org.oasis.wsrf.properties.QueryExpressionType;
+import org.oasis.wsrf.properties.UpdateType;
+import org.oasis.wsrf.properties.GetMultipleResourceProperties_Element;
+import org.oasis.wsrf.properties.GetMultipleResourcePropertiesResponse;
+import org.oasis.wsrf.properties.GetResourcePropertyResponse;
+import org.oasis.wsrf.properties.QueryResourceProperties_Element;
+import org.oasis.wsrf.properties.QueryResourcePropertiesResponse;
+import org.oasis.wsrf.properties.SetResourceProperties_Element;
+import org.w3c.dom.Node;
+
+import org.globus.interop.widget.Widget;
+import org.globus.interop.widget.WidgetNotificationService;
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.core.notification.SubscriptionManager;
+import org.globus.wsrf.core.notification.service.SubscriptionManagerServiceAddressingLocator;
+import org.globus.wsrf.core.tests.interop.NotificationConsumerFactory;
+import org.globus.wsrf.core.tests.interop.CreateNotificationConsumer;
+import org.globus.wsrf.core.tests.interop.service.NotificationConsumerFactoryServiceAddressingLocator;
+import org.globus.wsrf.encoding.ObjectDeserializer;
+import org.globus.wsrf.encoding.ObjectSerializer;
+import org.globus.wsrf.test.GridTestCase;
+import com.widgets.WidgetNotificationPortType;
+import com.widgets.WidgetPortType;
+import com.widgets.CreateWidget;
+import com.widgets.CreateWidgetResponse;
+import com.widgets.GenerateNotification;
+import com.widgets.service.WidgetNotificationServiceAddressingLocator;
+import com.widgets.service.WidgetServiceAddressingLocator;
+import junit.framework.TestSuite;
+
+public class InteropTest extends GridTestCase {
+
+    private WidgetServiceAddressingLocator locator =
+        new WidgetServiceAddressingLocator();
+
+    private WidgetNotificationServiceAddressingLocator notificationLocator =
+        new WidgetNotificationServiceAddressingLocator();
+
+    private SubscriptionManagerServiceAddressingLocator subscriptionManagerLocator =
+        new SubscriptionManagerServiceAddressingLocator();
+
+    private static String serviceAddress = null;
+
+    private static String notificationServiceAddress = null;
+
+    private static String consumerFactoryServiceAddress = null;
+
+    private static String queryString =
+        "boolean(/*/*[namespace-uri()='" +
+        WSRFConstants.LIFETIME_NS + "' and local-name()='TerminationTime'])";
+
+    public InteropTest(String name) {
+        super(name);
+    }
+
+    protected void setUp() throws Exception
+    {
+    }
+
+    public static void main(String [] args) {
+        TestSuite testSuite = null;
+        for (int i=0;i<args.length;i++) {
+            if (args[i].equalsIgnoreCase("-service")) {
+                serviceAddress = args[++i];
+            } else if (args[i].equalsIgnoreCase("-notificationService")) {
+                notificationServiceAddress = args[++i];
+            } else if (args[i].equalsIgnoreCase("-consumerService")) {
+                    consumerFactoryServiceAddress = args[++i];
+            } else if (args[i].equalsIgnoreCase("-query")) {
+                queryString = args[++i];
+            } else {
+                if (testSuite == null) {
+                    testSuite = new TestSuite();
+                }
+                testSuite.addTest(new InteropTest(args[i]));
+            }
+        }
+
+        // run all
+        if (testSuite == null) {
+            testSuite = new TestSuite(InteropTest.class);
+        }
+
+        junit.textui.TestRunner.run (testSuite);
+    }
+
+
+
+    private String getServiceAddress() {
+        if (serviceAddress != null) {
+            return serviceAddress;
+        }
+        if (TEST_CONTAINER == null) {
+            return "http://127.0.0.1:8080/wsrf/services/WidgetService";
+        } else {
+            return TEST_CONTAINER.getBaseURL() + "WidgetService";
+        }
+    }
+
+    private String getNotificationServiceAddress() {
+        if (notificationServiceAddress != null) {
+            return notificationServiceAddress;
+        }
+        if (TEST_CONTAINER == null) {
+            return "http://127.0.0.1:8080/wsrf/services/WidgetNotificationService";
+        } else {
+            return TEST_CONTAINER.getBaseURL() + "WidgetNotificationService";
+        }
+    }
+
+    private String getConsumerFactoryServiceAddress() {
+        if (consumerFactoryServiceAddress != null) {
+            return consumerFactoryServiceAddress;
+        }
+        if (TEST_CONTAINER == null) {
+            return "http://127.0.0.1:8080/wsrf/services/NotificationConsumerFactoryService";
+        } else {
+            return TEST_CONTAINER.getBaseURL() + "NotificationConsumerFactoryService";
+        }
+    }
+
+    private void destroySubscription(EndpointReferenceType subscriptionEPR)
+        throws ServiceException, RemoteException
+    {
+        SubscriptionManager manager =
+            this.subscriptionManagerLocator.getSubscriptionManagerPort(
+                subscriptionEPR);
+        manager.destroy(new Destroy());
+    }
+
+
+    private EndpointReferenceType createResource()
+        throws Exception {
+        URL endpoint = new URL(getServiceAddress());
+        WidgetPortType port = locator.getWidgetPortTypePort(endpoint);
+
+        CreateWidgetResponse response =
+            port.createWidget(new CreateWidget());
+
+        return response.getEndpointReference();
+    }
+
+    // create
+    public void testScenario1() throws Exception {
+        URL endpoint = new URL(getServiceAddress());
+        EndpointReferenceType rs = createResource();
+        assertTrue(rs != null);
+        assertTrue(rs.getAddress() != null);
+        String address = rs.getAddress().toString();
+        assertTrue(address.endsWith(endpoint.getPath()));
+        ReferencePropertiesType props = rs.getProperties();
+        assertTrue(props.get_any() != null);
+        assertTrue(props.get_any().length > 0);
+    }
+
+    // destroy
+    public void testScenario2() throws Exception {
+        EndpointReferenceType endpoint = createResource();
+
+        WidgetPortType port = locator.getWidgetPortTypePort(endpoint);
+
+        port.destroy(new Destroy());
+    }
+
+    // set termination time
+    public void testScenario3() throws Exception {
+        EndpointReferenceType endpoint = createResource();
+
+        WidgetPortType port = locator.getWidgetPortTypePort(endpoint);
+
+        Calendar termTime = Calendar.getInstance();
+        termTime.add(Calendar.SECOND, 30);
+
+        SetTerminationTime request = new SetTerminationTime();
+        request.setRequestedTerminationTime(termTime);
+
+        SetTerminationTimeResponse response =
+            port.setTerminationTime(request);
+
+        Calendar newTermTime = response.getNewTerminationTime();
+
+        System.out.println("requested: " + termTime.getTime());
+        System.out.println("scheduled: " + newTermTime.getTime());
+
+        assertTrue(newTermTime.getTime().equals(termTime.getTime()) ||
+                   newTermTime.getTime().after(termTime.getTime()));
+    }
+
+
+    // get resource property
+    public void testScenario4() throws Exception {
+        EndpointReferenceType endpoint = createResource();
+
+        WidgetPortType port = locator.getWidgetPortTypePort(endpoint);
+
+        Calendar termTime = Calendar.getInstance();
+        termTime.add(Calendar.SECOND, 30);
+
+        SetTerminationTime request = new SetTerminationTime();
+        request.setRequestedTerminationTime(termTime);
+
+        SetTerminationTimeResponse response =
+            port.setTerminationTime(request);
+
+        Calendar newTermTime = response.getNewTerminationTime();
+
+        GetResourcePropertyResponse propResponse =
+            port.getResourceProperty(WSRFConstants.TERMINATION_TIME);
+
+        MessageElement [] any = propResponse.get_any();
+        assertTrue(any != null);
+        assertTrue(any.length > 0);
+
+        Object obj = ObjectDeserializer.toObject(any[0], Calendar.class);
+        assertTrue(obj instanceof Calendar);
+        assertEquals(newTermTime.getTime(), ((Calendar)obj).getTime());
+    }
+
+    // get multiple resource property
+    public void testScenario5() throws Exception {
+        EndpointReferenceType endpoint = createResource();
+
+        WidgetPortType port = locator.getWidgetPortTypePort(endpoint);
+
+        Calendar termTime = Calendar.getInstance();
+        termTime.add(Calendar.SECOND, 30);
+
+        SetTerminationTime request = new SetTerminationTime();
+        request.setRequestedTerminationTime(termTime);
+
+        SetTerminationTimeResponse response =
+            port.setTerminationTime(request);
+
+        Calendar newTermTime = response.getNewTerminationTime();
+
+        QName [] propNames =
+            new QName[] {WSRFConstants.TERMINATION_TIME,
+                         WSRFConstants.CURRENT_TIME};
+
+        GetMultipleResourceProperties_Element requestProp =
+            new GetMultipleResourceProperties_Element();
+        requestProp.setResourceProperty(propNames);
+
+        GetMultipleResourcePropertiesResponse responseProp =
+            port.getMultipleResourceProperties(requestProp);
+
+        MessageElement [] any = responseProp.get_any();
+        assertTrue(any != null);
+        assertTrue(any.length > 1);
+
+        // TODO: need some function to figure out what's on the wire?
+
+        Object obj1 = ObjectDeserializer.toObject(any[0], Calendar.class);
+        assertTrue(obj1 instanceof Calendar);
+        assertEquals(newTermTime.getTime(), ((Calendar)obj1).getTime());
+
+        Object obj2 = ObjectDeserializer.toObject(any[1], Calendar.class);
+        assertTrue(obj2 instanceof Calendar);
+    }
+
+    // query resource property
+    public void testScenario6() throws Exception {
+        EndpointReferenceType endpoint = createResource();
+
+        WidgetPortType port = locator.getWidgetPortTypePort(endpoint);
+
+        // TODO: this can be put in a helper function
+
+        String dialect = WSRFConstants.XPATH_1_DIALECT;
+
+        QueryExpressionType query = new QueryExpressionType();
+        query.setDialect(dialect);
+        query.setValue(queryString);
+
+        QueryResourceProperties_Element request
+            = new QueryResourceProperties_Element();
+        request.setQueryExpression(query);
+
+        QueryResourcePropertiesResponse response =
+            port.queryResourceProperties(request);
+
+        MessageElement [] any = response.get_any();
+        assertTrue(any != null);
+        assertTrue(any.length > 0);
+        assertEquals(Node.TEXT_NODE, any[0].getNodeType());
+        assertEquals("true", any[0].getNodeValue());
+    }
+
+    // set resource property
+    public void testScenario7() throws Exception {
+        EndpointReferenceType endpoint = createResource();
+
+        WidgetPortType port = locator.getWidgetPortTypePort(endpoint);
+
+        scenario7Case1(port);
+        scenario7Case2(port);
+        scenario7Case3(port);
+        scenario7Case4(port);
+    }
+
+    private MessageElement[] getFooProperty(WidgetPortType port)
+       throws Exception {
+        GetResourcePropertyResponse propResponse =
+            port.getResourceProperty(Widget.FOO);
+        MessageElement [] any = propResponse.get_any();
+        assertTrue(any != null);
+        assertTrue(any.length > 0);
+        return any;
+    }
+
+    private void scenario7Case1(WidgetPortType port) throws Exception {
+        GetResourcePropertyResponse propResponse =
+            port.getResourceProperty(Widget.FOO);
+        MessageElement [] any = propResponse.get_any();
+        assertTrue(any == null);
+    }
+
+    private void scenario7Case2(WidgetPortType port) throws Exception {
+        String value1 = "string1";
+
+        InsertType insert = new InsertType();
+        MessageElement [] elements = new MessageElement[1];
+        elements[0] =
+            (MessageElement)ObjectSerializer.toSOAPElement(value1, Widget.FOO);
+        insert.set_any(elements);
+
+        SetResourceProperties_Element request = 
+            new SetResourceProperties_Element();
+        request.setInsert(insert);
+
+        port.setResourceProperties(request);
+
+        MessageElement [] any = getFooProperty(port);
+        Object obj2 = ObjectDeserializer.toObject(any[0], String.class);
+        assertEquals(value1, obj2.toString().trim());
+    }
+
+    private void scenario7Case3(WidgetPortType port) throws Exception {
+        String value1 = "string2";
+        String value2 = "string3";
+
+        UpdateType update = new UpdateType();
+        MessageElement [] elements = new MessageElement[2];
+        elements[0] =
+            (MessageElement)ObjectSerializer.toSOAPElement(value1, Widget.FOO);
+        elements[1] =
+            (MessageElement)ObjectSerializer.toSOAPElement(value2, Widget.FOO);
+        update.set_any(elements);
+
+        SetResourceProperties_Element request = 
+            new SetResourceProperties_Element();
+        request.setUpdate(update);
+
+        port.setResourceProperties(request);
+
+        // TODO: order not important?
+
+        MessageElement [] any = getFooProperty(port);
+        assertEquals(2, any.length);
+        Object obj1 = ObjectDeserializer.toObject(any[0], String.class);
+        assertEquals(value1, obj1.toString().trim());
+        Object obj2 = ObjectDeserializer.toObject(any[1], String.class);
+        assertEquals(value2, obj2.toString().trim());
+    }
+
+    private void scenario7Case4(WidgetPortType port) throws Exception {
+
+        DeleteType delete = new DeleteType();
+        delete.setResourceProperty(Widget.FOO);
+
+        SetResourceProperties_Element request = 
+            new SetResourceProperties_Element();
+        request.setDelete(delete);
+
+        port.setResourceProperties(request);
+
+        GetResourcePropertyResponse propResponse =
+            port.getResourceProperty(Widget.FOO);
+        MessageElement [] any = propResponse.get_any();
+        assertTrue(any == null);
+    }
+
+    // subscribe & send notify to service
+    public void testScenario8() throws Exception {
+
+        NotificationConsumerFactoryServiceAddressingLocator consumerFactoryLocator =
+            new NotificationConsumerFactoryServiceAddressingLocator();
+
+        EndpointReferenceType consumerEPR = new EndpointReferenceType();
+        consumerEPR.setAddress(new Address(getConsumerFactoryServiceAddress()));
+        NotificationConsumerFactory notificationConsumerFactoryPort =
+            consumerFactoryLocator.getNotificationConsumerFactoryPort(consumerEPR);
+        EndpointReferenceType consumer =
+            notificationConsumerFactoryPort.createNotificationConsumer(
+                            new CreateNotificationConsumer());
+        EndpointReferenceType endpoint = new EndpointReferenceType(
+            new URI(getNotificationServiceAddress()));
+        WidgetNotificationPortType port =
+            notificationLocator.getWidgetNotificationPortTypePort(
+                endpoint);
+        Subscribe request = new Subscribe();
+        request.setUseNotify(Boolean.TRUE);
+        request.setConsumerReference(consumer);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            WidgetNotificationService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse response = port.subscribe(request);
+        port.generateNotification(new GenerateNotification());
+        this.destroySubscription(response.getSubscriptionReference());
+    }
+
+    // subscribe & send notify to client
+    public void testScenario8Client() throws Exception {
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer();
+
+        EndpointReferenceType endpoint = new EndpointReferenceType(
+            new URI(getNotificationServiceAddress()));
+        WidgetNotificationPortType port =
+            notificationLocator.getWidgetNotificationPortTypePort(
+                endpoint);
+        Subscribe request = new Subscribe();
+        request.setUseNotify(Boolean.TRUE);
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            WidgetNotificationService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse response = port.subscribe(request);
+        port.generateNotification(new GenerateNotification());
+        Thread.sleep(5000);
+        this.destroySubscription(response.getSubscriptionReference());
+    }
+
+    // getCurrentMessage
+    public void testScenario9GetCurrentMessage() throws Exception {
+        EndpointReferenceType endpoint = new EndpointReferenceType(
+            new URI(getNotificationServiceAddress()));
+        WidgetNotificationPortType port =
+            notificationLocator.getWidgetNotificationPortTypePort(
+                endpoint);
+        GetCurrentMessage request = new GetCurrentMessage();
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            WidgetNotificationService.TEST_TOPIC);
+        request.setTopic(topicPath);
+        GetCurrentMessageResponse response = port.getCurrentMessage(request);
+        assertTrue(response.get_any()[0].getLocalName() == "TestNotification" &&
+            response.get_any()[0].getNamespaceURI() == "http://widgets.com");
+    }
+
+    // pause/resume subscription
+
+    public void testScenario9PauseResume() throws Exception {
+
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer();
+
+        EndpointReferenceType endpoint = new EndpointReferenceType(
+            new URI(getNotificationServiceAddress()));
+        WidgetNotificationPortType port =
+            notificationLocator.getWidgetNotificationPortTypePort(
+                endpoint);
+        Subscribe request = new Subscribe();
+        request.setUseNotify(Boolean.TRUE);
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            WidgetNotificationService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse response = port.subscribe(request);
+        port.generateNotification(new GenerateNotification());
+        Thread.sleep(2000);
+        SubscriptionManager subscriptionManager = this.
+            subscriptionManagerLocator.getSubscriptionManagerPort(
+                response.getSubscriptionReference());
+        subscriptionManager.pauseSubscription(new PauseSubscription());
+        port.generateNotification(new GenerateNotification());
+        subscriptionManager.resumeSubscription(new ResumeSubscription());
+        port.generateNotification(new GenerateNotification());
+        Thread.sleep(2000);
+        subscriptionManager.destroy(new Destroy());
+    }
+
+}

Added: incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/test/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/test/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/interop/src/org/globus/interop/widget/test/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,34 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.interop.widget.test;
+
+import org.globus.wsrf.test.GridTestSuite;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends GridTestSuite {
+    
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("InteropTests");
+        suite.addTestSuite(InteropTest.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/perf/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/perf/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/perf/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,258 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_test_perf" basedir=".">
+    <description>
+        Performance Tests
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+    
+    <property environment="env"/>
+ 
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="../../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="base.name" value="wsrf_test_perf"/>
+    <property name="package.name" value="globus_${base.name}"/>
+    <property name="gar.name" value="${package.name}.gar"/>
+    <property name="jar.name" value="${base.name}.jar"/>
+    <property name="stubs.jar.name" value="${base.name}_stubs.jar"/>
+    <property name="build.dir"  location="build"/>
+    <property name="build.dest" location="build/classes"/>
+    <property name="build.lib.dir" location="build/lib"/>
+    <property name="build.packages" location=
+        "${deploy.dir}/share/globus_wsrf_common/build-packages.xml"/>
+    <property name="build.test" location=
+        "${deploy.dir}/share/globus_wsrf_common/build-test.xml"/>
+    <property name="build.stubs" location=
+        "${deploy.dir}/share/globus_wsrf_tools/build-stubs.xml"/>
+    <property name="stubs.dir" location="build/stubs"/>
+    <property name="stubs.src" location="build/stubs/src"/>
+    <property name="stubs.dest" location="build/stubs/classes"/>
+    <property name="schema.src"   location="${deploy.dir}/share/schema"/>
+    <property name="schema.dest"  location="${build.dir}/schema"/>
+    <property name="java.debug" value="on"/>
+
+    <property name="garjars.id" value="garjars"/>
+    <fileset dir="${build.lib.dir}" id="garjars"/>
+
+    <!-- etc directory for gar -->
+    <property name="garetc.id" value="garEtc"/>
+    <fileset dir="etc" id="garEtc"/>
+
+    <property name="garschema.id" value="garschema"/>
+    <fileset dir="${schema.dest}" 
+        includes="tests/performance/*" 
+        id="garschema"/>
+
+    <property name="junit.reports.dir" value="test-reports"/>
+    <property name="junit.haltonfailure" value="true"/>
+    <property name="junit.timeout" value="900000"/>
+    <property name="junit.jvmarg" value="-Dignore -Xmx512m" />
+
+    <property name="test.server.url" 
+              value="http://localhost:8080/wsrf/services/"/>
+    <property name="secure.test.server.url" 
+              value="https://localhost:8443/wsrf/services/"/>
+
+    <property name="test.security.type" value="message"/>
+    <property name="test.protection.type" value="signature"/>
+
+    <target name="init">
+        <mkdir dir="${build.dir}"/>
+        <mkdir dir="${build.dest}"/>
+        <mkdir dir="${build.lib.dir}"/>
+
+        <mkdir dir="${stubs.dir}"/>
+        <mkdir dir="${stubs.src}"/>
+        <mkdir dir="${stubs.dest}"/>
+
+        <mkdir dir="${schema.dest}"/>
+        <copy toDir="${schema.dest}">
+            <fileset dir="${schema.src}" casesensitive="yes">
+                <include name="core/tests/performance/**"/>
+                <include name="wsrf/**"/>
+                <include name="ws/**"/>
+            </fileset>
+        </copy>
+
+        <available property="stubs.present" type="dir" 
+            file="${stubs.src}/org/globus" />
+
+        <condition property="compiler.jvmarg" value="-source 1.4">
+          <equals arg1="${ant.java.version}" arg2="1.5"/>
+        </condition>
+        <condition property="compiler.jvmarg" value="">
+         <not>
+           <isset property="${compiler.jvmarg}"/>
+         </not>
+        </condition>
+    </target>
+
+    <target name="stubs" unless="stubs.present" depends="init">
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/tests/performance"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+            <property name="wsdl.file" 
+                value="basic_perf_test_service.wsdl"/>
+        </ant>       
+    </target>
+    
+    <target name="compileStubs" depends="stubs">
+        <javac srcdir="${stubs.src}" destdir="${stubs.dest}"
+            debug="${java.debug}">
+            <include name="**/*.java"/>
+            <classpath>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+    </target>
+
+    <target name="compile" depends="compileStubs">
+        <javac srcdir="src" destdir="${build.dest}" debug="${java.debug}">
+            <include name="**/*.java"/>
+            <classpath>
+                <pathelement location="${stubs.dest}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+	<copy todir="${build.dest}" >
+	      <fileset dir="src" includes="**/*.properties" />
+	      <fileset dir="src" includes="**/*.xml" />
+	</copy>
+    </target>
+
+    <target name="jar" depends="compile">
+        <jar destfile="${build.lib.dir}/${jar.name}" basedir="${build.dest}"/>
+    </target>
+
+    <target name="jarStubs" depends="compileStubs">
+        <jar destfile="${build.lib.dir}/${stubs.jar.name}" 
+            basedir="${stubs.dest}"/>
+    </target>
+
+    <target name="dist" depends="jar, jarStubs">
+        <ant antfile="${build.packages}" target="makeGar">
+            <reference refid="${garjars.id}"/>  
+            <reference refid="${garetc.id}"/>
+            <reference refid="${garschema.id}"/>  
+        </ant>
+    </target>
+
+    <target name="clean">
+        <delete dir="tmp"/>
+        <delete dir="${build.dir}"/>
+        <delete file="${gar.name}"/>
+        <delete dir="${junit.reports.dir}"/>
+    </target>
+
+    <target name="deploy" depends="dist">
+        <ant antfile="${build.packages}" target="deployGar"/>
+    </target>  
+
+    <target name="undeploy">
+        <ant antfile="${build.packages}" target="undeployGar">
+            <property name="gar.id" value="${package.name}"/>
+        </ant>
+    </target>
+
+    <target name="all" depends="jar"/>
+
+    <target name="test" depends="compile">
+      <property name="server.arg" value="-Dignore" />
+      <antcall target="runTests"/>
+      <antcall target="runSecurityTests"/>
+    </target>
+
+    <target name="testServer" depends="compile">
+      <property name="server.arg" 
+                value="-Dweb.server.url=${test.server.url} -Dsecure.web.server.url=${secure.test.server.url}" />
+      <antcall target="runTests"/>
+      <antcall target="runSecurityTests"/>
+    </target>
+
+    <target name="runTests" unless="securityTestsOnly">
+      <mkdir dir="${junit.reports.dir}" />
+      <junit printsummary="yes" 
+             haltonfailure="${junit.haltonfailure}" 
+             fork="yes" 
+             timeout="${junit.timeout}">
+            <sysproperty key="org.globus.wsrf.container.webroot" 
+                value="${deploy.dir}"/>
+            <sysproperty key="GLOBUS_LOCATION"
+                value="${deploy.dir}"/>
+            <classpath>
+                <pathelement location="${build.dest}"/>
+                <pathelement location="${stubs.dest}"/>
+                <pathelement location="${deploy.dir}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+        <formatter type="xml" />
+        <batchtest todir="${junit.reports.dir}">
+         <fileset dir="${build.dest}">
+            <include name="**/PackageTests.class" />
+         </fileset>
+        </batchtest>
+        <jvmarg value="-Djava.endorsed.dirs=${deploy.dir}/endorsed"/>
+        <jvmarg line="${server.arg}" />
+        <jvmarg line="${junit.jvmarg}" />
+      </junit>
+    </target>
+    
+    <!-- These are security tests. They require valid credentials. -->
+    <!-- Using "SecurityTests" as the required class name -->
+    <target name="runSecurityTests" unless="basicTestsOnly">
+      <mkdir dir="${junit.reports.dir}" />
+      <junit printsummary="yes" 
+             haltonfailure="${junit.haltonfailure}" 
+             fork="yes" 
+             timeout="${junit.timeout}">
+            <sysproperty key="org.globus.wsrf.container.webroot" 
+                value="${deploy.dir}"/>
+            <sysproperty key="GLOBUS_LOCATION" 
+                value="${deploy.dir}"/>
+            <classpath>
+                <pathelement location="${build.dest}"/>
+                <pathelement location="${stubs.dest}"/>
+                <pathelement location="${deploy.dir}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+        <formatter type="xml" />
+        <batchtest todir="${junit.reports.dir}">
+         <fileset dir="${build.dest}">
+            <include  name="**/SecurityTests.class"/>
+         </fileset>
+        </batchtest>
+        <jvmarg value="-Djava.endorsed.dirs=${deploy.dir}/endorsed"/>
+        <jvmarg line="${server.arg}" />
+        <jvmarg line="${junit.jvmarg}" />
+        <sysproperty key="securityType" value="${test.security.type}"/>
+        <sysproperty key="protectionType" value="${test.protection.type}"/>
+      </junit>
+    </target>
+
+</project>

Added: incubator/apollo/globus/core/test/perf/deploy-jndi-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/perf/deploy-jndi-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/perf/deploy-jndi-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jndiConfig xmlns="http://wsrf.globus.org/jndi/config">
+   <service name="PerformanceTestService">
+        <resource
+            name="home"
+            type="org.globus.wsrf.impl.PerformanceTestHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.PerformanceTestResource</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://wsrf.globus.org/tests/performance/basic}PerformanceTestKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+   <service name="SecurePerformanceTestService">
+        <resource
+            name="home"
+            type="org.globus.wsrf.impl.PerformanceTestHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.PerformanceTestResource</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://wsrf.globus.org/tests/performance/basic}PerformanceTestKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+</jndiConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/test/perf/deploy-server.wsdd
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/perf/deploy-server.wsdd?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/perf/deploy-server.wsdd	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment name="defaultServerConfig"
+    xmlns="http://xml.apache.org/axis/wsdd/"
+    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <service name="PerformanceTestService" provider="Handler"
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="scope" value="Application"/>
+        <parameter name="handlerClass"
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className"
+            value="org.globus.wsrf.impl.PerformanceTestService"/>
+        <wsdlFile>share/schema/core/tests/performance/basic_perf_test_service.wsdl</wsdlFile>
+    </service>
+
+    <service name="SecurePerformanceTestService" provider="Handler"
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="scope" value="Application"/>
+        <parameter name="handlerClass"
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className"
+            value="org.globus.wsrf.impl.PerformanceTestService"/>
+        <wsdlFile>share/schema/core/tests/performance/basic_perf_test_service.wsdl</wsdlFile>
+        <parameter name="securityDescriptor" value="@config.dir@/security-config.xml"/>
+    </service>
+</deployment>

Added: incubator/apollo/globus/core/test/perf/etc/post-deploy.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/perf/etc/post-deploy.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/perf/etc/post-deploy.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+
+<!-- ===================================================================
+
+Notes:
+   This is a build file for use with the Jakarta Ant build tool.
+
+Prerequisites:
+
+   jakarta-ant from http://jakarta.apache.org
+
+
+Build Instructions:
+
+   This file is automatically called at the end of the deployment
+   of the corresponding component's gar (see build-packages.xml).
+
+Copyright:
+Copyright (c) 1999 University of Chicago and The University of
+Southern California. All Rights Reserved.
+
+==================================================================== -->
+<project default="all" basedir=".">
+
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="."/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="abs.deploy.dir" location="${deploy.dir}"/>
+    <property name="build.launcher" 
+        location="${abs.deploy.dir}/share/globus_wsrf_common/build-launcher.xml"/>
+
+    <target name="setup">
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="test-performance"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.impl.ClientTest"/>
+        </ant>
+    </target>
+
+</project>

Added: incubator/apollo/globus/core/test/perf/etc/security-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/perf/etc/security-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/perf/etc/security-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<securityConfig xmlns="http://www.globus.org">
+    <authz value="self"/>
+    <auth-method>
+        <GSISecureConversation/>
+        <GSISecureMessage/>
+        <GSITransport/>
+    </auth-method>
+</securityConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/BasicPerformanceTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/BasicPerformanceTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/BasicPerformanceTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,261 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.Calendar;
+
+import org.apache.axis.components.uuid.UUIDGenFactory;
+import org.apache.axis.message.addressing.AttributedURI;
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.axis.message.addressing.ReferencePropertiesType;
+import org.apache.axis.types.URI;
+
+import org.oasis.wsn.TopicExpressionType;
+
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.test.GridTestCase;
+import org.globus.wsrf.tests.performance.basic.BaseType;
+import org.globus.wsrf.tests.performance.basic.DeleteRequestType;
+import org.globus.wsrf.tests.performance.basic.DeleteType;
+import org.globus.wsrf.tests.performance.basic.NameValuePairType;
+import org.globus.wsrf.tests.performance.basic.TestPortType;
+import org.globus.wsrf.tests.performance.basic.TransferRequestType;
+import org.globus.wsrf.tests.performance.basic.TransferType;
+import org.globus.wsrf.tests.performance.basic.BaseTypeSubscribe;
+import org.globus.wsrf.tests.performance.basic.BaseTypeJob;
+import org.globus.wsrf.tests.performance.basic.service.TestServiceAddressingLocator;
+
+import org.globus.wsrf.impl.security.authorization.SelfAuthorization;
+import org.globus.wsrf.impl.security.authentication.Constants;
+
+import org.globus.axis.gsi.GSIConstants;
+
+import javax.xml.rpc.Stub;
+import javax.security.auth.Subject;
+import org.globus.gsi.GlobusCredential;
+import java.security.cert.X509Certificate;
+import org.globus.wsrf.impl.security.authentication.encryption.EncryptionCredentials;
+
+public class BasicPerformanceTests extends GridTestCase {
+
+    TestServiceAddressingLocator locator = new TestServiceAddressingLocator();
+    TestPortType testService = null;
+    EndpointReferenceType testServiceEPR = null;
+    public static int TEST_ITERATIONS = 10;
+    public static int MESSAGE_SIZE_ITERATIONS = 61;
+
+    static String mechanism = null;
+    static Object protection = null;
+
+    public static final String INSECURE_SERVICE_PATH = 
+        "PerformanceTestService";
+
+    public static final String SECURE_SERVICE_PATH = 
+        "SecurePerformanceTestService";
+
+    static String servicePath = INSECURE_SERVICE_PATH;
+
+    public BasicPerformanceTests(String name) {
+        super(name);
+    }
+
+    public static void setSecurityReq(String securityType, Object protType) {
+
+        mechanism = securityType;
+        if (mechanism != null) {
+            servicePath = SECURE_SERVICE_PATH;
+        } else {
+            servicePath = INSECURE_SERVICE_PATH;
+        }
+        protection = protType;
+        System.out.println("Security machanism: " + mechanism 
+                           + " with protection: " + protType); 
+    }
+    
+    public void testBasicPerformance() throws Exception {
+
+        long time1;
+        long time2;
+        long accumulator;
+
+        for(int i = 1; i < MESSAGE_SIZE_ITERATIONS ; i++) {
+
+            BaseType message = createInputMessage(i);
+            accumulator = 0;
+            for(int j = 0; j < TEST_ITERATIONS; j++) {
+
+                time1 = System.currentTimeMillis();
+                testService.baseline(message);
+                time2 = System.currentTimeMillis();
+                accumulator += time2 - time1;
+            }
+            System.out.println("Base: " +
+                               String.valueOf(accumulator/TEST_ITERATIONS));
+        }
+    }
+
+    public void testDispatchPerformance() throws Exception {
+        
+        long time1;
+        long time2;
+        long accumulator;
+        
+        for(int i = 1; i < MESSAGE_SIZE_ITERATIONS; i++) {
+            
+            BaseType message = createInputMessage(i);
+            accumulator = 0;
+            for(int j = 0; j < TEST_ITERATIONS; j++) {
+
+                time1 = System.currentTimeMillis();
+                testService.resourceDispatch(message);
+                time2 = System.currentTimeMillis();
+                accumulator += time2 - time1;
+            }
+            System.out.println("Dispatch: " +
+                               String.valueOf(accumulator/TEST_ITERATIONS));
+        }
+    }
+
+    protected void setUp() throws Exception {
+
+        super.setUp();
+        testService = locator.getTestPortTypePort(getServiceAddress());
+
+        if (mechanism != null) {
+            ((Stub)testService)._setProperty(mechanism, protection);
+            if (mechanism.equals(Constants.GSI_TRANSPORT)) {
+                ((Stub)testService)
+                    ._setProperty(GSIConstants.GSI_AUTHORIZATION, 
+                                  org.globus.gsi.gssapi.auth.SelfAuthorization
+                                  .getInstance());
+            } else {
+                ((Stub)testService)._setProperty(Constants.AUTHORIZATION, 
+                                                 SelfAuthorization
+                                                 .getInstance());
+            }
+            
+            if ((mechanism.equals(Constants.GSI_SEC_MSG)) &&
+                (protection.equals(Constants.ENCRYPTION))) {
+                GlobusCredential cred = 
+                    GlobusCredential.getDefaultCredential();
+                X509Certificate array[] = cred.getCertificateChain();
+                EncryptionCredentials encryptionCreds =
+                    new EncryptionCredentials(array);
+                Subject subject = new Subject();
+                subject.getPublicCredentials().add(encryptionCreds);
+                ((Stub)testService)._setProperty(Constants.PEER_SUBJECT, 
+                                                 subject);
+            }
+        }
+
+        //Warmup
+        for(int i = 0; i < 5; i++) {
+            testService.baseline(createInputMessage(i));
+        }
+
+        for(int i = 0; i < 5; i++) {
+            testService.resourceDispatch(createInputMessage(i));
+        }
+    }
+
+    //Todo: Do I need to randomize strings here?
+    public static BaseType createInputMessage(int count)
+        throws Exception {
+
+        BaseType message = new BaseType();
+        message.setInitialTerminationTime(Calendar.getInstance());
+        message.setJob(new BaseTypeJob[count]);
+        for(int i = 0; i < count; i++) {
+            message.setJob(i, createJobDescritption());
+        }
+        message.setJobID(new AttributedURI(
+            "uuid:" + UUIDGenFactory.getUUIDGen().nextUUID()));
+        message.setSubscribe(createSubscribe());
+        return message;
+    }
+
+    private static BaseTypeSubscribe createSubscribe()
+        throws Exception {
+
+        BaseTypeSubscribe subscribe =
+            new BaseTypeSubscribe();
+        NotificationConsumerManager manager =
+            NotificationConsumerManager.getInstance();
+        manager.startListening();
+        subscribe.setConsumerReference(manager.createNotificationConsumer());
+        subscribe.setInitialTerminationTime(Calendar.getInstance());
+        subscribe.setUseNotify(Boolean.TRUE);
+        TopicExpressionType topicExpression = new TopicExpressionType();
+        topicExpression.setDialect(WSNConstants.SIMPLE_TOPIC_DIALECT);
+        topicExpression.setValue(WSNConstants.TOPIC_EXPRESSION_DIALECTS);
+        subscribe.setTopicExpression(topicExpression);
+        return subscribe;
+    }
+
+    private static BaseTypeJob createJobDescritption() {
+
+        BaseTypeJob jobDescription = new BaseTypeJob();
+        jobDescription.setArgument(
+            new String[] {"12", "abc", "34",
+                          "pdscaex_instr_GrADS_grads23_28919.cfg",
+                          "pgwynnel was here"});
+        jobDescription.setDirectory("${GLOBUS_USER_HOME}");
+        jobDescription.setExecutable("/bin/echo");
+        NameValuePairType[] environment = new NameValuePairType[]
+            {new NameValuePairType(), new NameValuePairType()};
+        environment[0].setName("PI");
+        environment[0].setValue("3.1415");
+        environment[1].setName("GLOBUS_DUROC_SUBJOB_INDEX");
+        environment[1].setValue("0");
+        jobDescription.setEnvironment(environment);
+        jobDescription.setStdout("${GLOBUS_USER_HOME}/stdout");
+        jobDescription.setStderr("${GLOBUS_USER_HOME}/stderr");
+        DeleteRequestType deleteRequest = new DeleteRequestType();
+        DeleteType[] deletion = new DeleteType[] {new DeleteType()};
+        deletion[0].setFile("file://${GLOBUS_USER_HOME}/stdout");
+        deleteRequest.setDeletion(deletion);
+        jobDescription.setFileCleanUp(deleteRequest);
+        TransferRequestType stageInRequest = new TransferRequestType();
+        TransferType[] stageIn = new TransferType[] {new TransferType()};
+        stageIn[0].setSourceUrl(
+            "gsiftp://localhost:2811/${GLOBUS_USER_HOME}/stdin");
+        stageIn[0].setDestinationUrl("file:///tmp/stdin");
+        stageInRequest.setTransfer(stageIn);
+        jobDescription.setFileStageIn(stageInRequest);
+        TransferRequestType stageOutRequest = new TransferRequestType();
+        TransferType[] stageOut = new TransferType[] {new TransferType()};
+        stageOut[0].setSourceUrl("file://${GLOBUS_USER_HOME}/stdout");
+        stageOut[0].setDestinationUrl("gsiftp://localhost:2811/tmp/stdout");
+        stageOutRequest.setTransfer(stageOut);
+        jobDescription.setFileStageIn(stageOutRequest);
+        return jobDescription;
+    }
+
+    public EndpointReferenceType getServiceAddress() throws Exception {
+
+        if(this.testServiceEPR == null) {
+            String address =
+                TEST_CONTAINER.getBaseURL() + servicePath;
+            this.testServiceEPR =
+                new EndpointReferenceType(new URI(address));
+            ReferencePropertiesType props = new ReferencePropertiesType();
+            props.add(PerformanceTestHome.TEST_KEY.toSOAPElement());
+            this.testServiceEPR.setProperties(props);
+        }
+        return this.testServiceEPR;
+    }
+}

Added: incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/ClientTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/ClientTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/ClientTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,208 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.axis.message.addressing.ReferencePropertiesType;
+import org.apache.axis.types.URI;
+
+import org.globus.wsrf.tests.performance.basic.TransferRequestType;
+import org.globus.wsrf.tests.performance.basic.TransferType;
+import org.globus.wsrf.tests.performance.basic.DeleteRequestType;
+import org.globus.wsrf.tests.performance.basic.DeleteType;
+import org.globus.wsrf.tests.performance.basic.TestPortType;
+import org.globus.wsrf.tests.performance.basic.BaseType;
+import org.globus.wsrf.tests.performance.basic.BaseTypeJob;
+import org.globus.wsrf.tests.performance.basic.NameValuePairType;
+import org.globus.wsrf.tests.performance.basic.service.TestServiceAddressingLocator;
+
+public class ClientTest {
+    
+    public static void main(String [] args) throws Exception {
+        
+        String address =
+            "http://localhost:8080/wsrf/services/PerformanceTestService" ;
+        
+        EndpointReferenceType testServiceEPR =
+            new EndpointReferenceType(new URI(address));
+        ReferencePropertiesType props = new ReferencePropertiesType();
+        props.add(PerformanceTestHome.TEST_KEY.toSOAPElement());
+        testServiceEPR.setProperties(props);
+        
+        int t = Integer.parseInt(args[0]);
+        int n = Integer.parseInt(args[1]);
+        int m = Integer.parseInt(args[2]);
+
+        switch(t) {
+        case 1:
+            test1(testServiceEPR, n, m);
+            break;
+        case 2:
+            test2(testServiceEPR, n, m);
+            break;
+        case 3:
+            test3(testServiceEPR, n, m);
+            break;
+        default:
+            System.err.println("Wrong test number");
+            System.exit(1);
+        }
+    }
+
+    public static void test1(EndpointReferenceType testServiceEPR, 
+                             int n, int m) 
+        throws Exception {
+        BaseType message = createInputMessage(m);
+        long time1;
+        long time2;
+        long accumulator = 0;
+
+        TestServiceAddressingLocator locator =
+            new TestServiceAddressingLocator();
+        
+        TestPortType testService =
+            locator.getTestPortTypePort(testServiceEPR);
+        
+        for (int i=0;i<5;i++) {
+            testService.baseline(message);
+        }
+
+        for (int i=0;i<n;i++) {
+            time1 = System.currentTimeMillis();
+
+            testService.baseline(message);
+
+            time2 = System.currentTimeMillis();
+            accumulator += time2 - time1;
+        }
+        System.out.println("Base: " +
+                           String.valueOf(accumulator/n));        
+    }
+
+    public static void test2(EndpointReferenceType testServiceEPR, 
+                             int n, int m) 
+        throws Exception {
+        BaseType message = createInputMessage(m);
+        long time1;
+        long time2;
+        long accumulator = 0;
+        
+        for (int i=0;i<5;i++) {
+            TestServiceAddressingLocator locator =
+                new TestServiceAddressingLocator();
+            TestPortType testService =
+                locator.getTestPortTypePort(testServiceEPR);
+            testService.baseline(message);
+        }
+        
+        for (int i=0;i<n;i++) {
+            time1 = System.currentTimeMillis();
+
+            TestServiceAddressingLocator locator =
+                new TestServiceAddressingLocator();
+            TestPortType testService =
+                locator.getTestPortTypePort(testServiceEPR);
+            testService.baseline(message);
+
+            time2 = System.currentTimeMillis();
+            accumulator += time2 - time1;
+        }
+        System.out.println("Base: " +
+                           String.valueOf(accumulator/n));        
+    }
+
+   public static void test3(EndpointReferenceType testServiceEPR, 
+                            int n, int m) 
+        throws Exception {
+       BaseType message = createInputMessage(m);
+       long time1;
+        long time2;
+        long accumulator = 0;
+
+        TestServiceAddressingLocator locator =
+            new TestServiceAddressingLocator();
+
+        for (int i=0;i<5;i++) {
+            TestPortType testService =
+                locator.getTestPortTypePort(testServiceEPR);
+            testService.baseline(message);
+        }
+        
+        for (int i=0;i<n;i++) {
+            time1 = System.currentTimeMillis();
+
+            TestPortType testService =
+                locator.getTestPortTypePort(testServiceEPR);
+            testService.baseline(message);
+
+            time2 = System.currentTimeMillis();
+            accumulator += time2 - time1;
+        }
+        System.out.println("Base: " +
+                           String.valueOf(accumulator/n));        
+    }
+    
+
+    public static BaseType createInputMessage(int count)
+        throws Exception {
+        BaseType message = new BaseType();
+        message.setJob(new BaseTypeJob[count]);
+        for(int i = 0; i < count; i++) {
+            message.setJob(i, createJobDescritption());
+        }
+        return message;
+    }
+
+    private static BaseTypeJob createJobDescritption() {
+        
+        BaseTypeJob jobDescription = new BaseTypeJob();
+        jobDescription.setArgument(
+                                   new String[] {"12", "abc", "34",
+                          "pdscaex_instr_GrADS_grads23_28919.cfg",
+                          "pgwynnel was here"});
+        jobDescription.setDirectory("${GLOBUS_USER_HOME}");
+        jobDescription.setExecutable("/bin/echo");
+        NameValuePairType[] environment = new NameValuePairType[]
+            {new NameValuePairType(), new NameValuePairType()};
+        environment[0].setName("PI");
+        environment[0].setValue("3.1415");
+        environment[1].setName("GLOBUS_DUROC_SUBJOB_INDEX");
+        environment[1].setValue("0");
+        jobDescription.setEnvironment(environment);
+        jobDescription.setStdout("${GLOBUS_USER_HOME}/stdout");
+        jobDescription.setStderr("${GLOBUS_USER_HOME}/stderr");
+        DeleteRequestType deleteRequest = new DeleteRequestType();
+        DeleteType[] deletion = new DeleteType[] {new DeleteType()};
+        deletion[0].setFile("file://${GLOBUS_USER_HOME}/stdout");
+        deleteRequest.setDeletion(deletion);
+        jobDescription.setFileCleanUp(deleteRequest);
+        TransferRequestType stageInRequest = new TransferRequestType();
+        TransferType[] stageIn = new TransferType[] {new TransferType()};
+        stageIn[0].setSourceUrl(
+            "gsiftp://localhost:2811/${GLOBUS_USER_HOME}/stdin");
+        stageIn[0].setDestinationUrl("file:///tmp/stdin");
+        stageInRequest.setTransfer(stageIn);
+        jobDescription.setFileStageIn(stageInRequest);
+        TransferRequestType stageOutRequest = new TransferRequestType();
+        TransferType[] stageOut = new TransferType[] {new TransferType()};
+        stageOut[0].setSourceUrl("file://${GLOBUS_USER_HOME}/stdout");
+        stageOut[0].setDestinationUrl("gsiftp://localhost:2811/tmp/stdout");
+        stageOutRequest.setTransfer(stageOut);
+        jobDescription.setFileStageIn(stageOutRequest);
+        return jobDescription;
+      }
+
+}

Added: incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import org.globus.wsrf.test.GridTestSuite;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends GridTestSuite
+{
+
+    public static void main(String args[]) throws Exception
+    { 
+	junit.textui.TestRunner.run(suite());
+    }
+
+    public PackageTests(String name)
+    {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("BasicPerformanceTests");
+        suite.addTestSuite(BasicPerformanceTests.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PerformanceTestHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PerformanceTestHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PerformanceTestHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,34 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import javax.xml.namespace.QName;
+
+import org.globus.wsrf.ResourceKey;
+
+public class PerformanceTestHome extends ResourceHomeImpl
+{
+    public static ResourceKey TEST_KEY = new SimpleResourceKey(
+        new QName("http://wsrf.globus.org/tests/performance/basic",
+                  "PerformanceTestKey"), 
+        "foo");
+
+    public synchronized void initialize() throws Exception
+    {
+        super.initialize();
+        this.add(TEST_KEY, new PerformanceTestResource());
+    }
+}

Added: incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PerformanceTestResource.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PerformanceTestResource.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PerformanceTestResource.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,24 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import org.globus.wsrf.Resource;
+
+
+public class PerformanceTestResource implements Resource
+{
+
+}

Added: incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PerformanceTestService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PerformanceTestService.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/PerformanceTestService.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,68 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.axis.types.URI;
+
+import org.globus.wsrf.tests.performance.basic.BaseType;
+import org.globus.wsrf.tests.performance.basic.TestPortType;
+import org.globus.wsrf.tests.performance.basic.BaseResponse;
+import org.globus.wsrf.tests.performance.basic.ResourceDispatchResponse;
+import org.globus.wsrf.ResourceContext;
+
+public class PerformanceTestService implements TestPortType
+
+{
+
+    public ResourceDispatchResponse resourceDispatch(BaseType request)
+        throws RemoteException
+    {
+        ResourceContext context = ResourceContext.getResourceContext();        
+        context.getResource();
+
+        ResourceDispatchResponse response = new ResourceDispatchResponse();
+        try
+        {
+            response.setEndpointReference(
+                new EndpointReferenceType(
+                    new URI("http://foo.bar.com/wsrf/services")));
+        }
+        catch(URI.MalformedURIException e)
+        {
+            throw new RemoteException("", e);
+        }
+        return response;
+    }
+
+    public BaseResponse baseline(BaseType request) throws RemoteException
+    {
+        BaseResponse response = new BaseResponse();
+        try
+        {
+            response.setEndpointReference(
+                new EndpointReferenceType(
+                    new URI("http://foo.bar.com/wsrf/services")));
+        }
+        catch(URI.MalformedURIException e)
+        {
+            throw new RemoteException("", e);
+        }
+        return response;
+    }
+}

Added: incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/SecurityTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/SecurityTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/perf/src/org/globus/wsrf/impl/SecurityTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,98 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import org.globus.wsrf.test.GridTestSuite;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.globus.wsrf.test.TestContainer;
+import org.globus.wsrf.test.GridTestCase;
+import junit.framework.TestResult;
+import org.globus.wsrf.test.GSITestContainer;
+
+import org.globus.wsrf.impl.security.authentication.Constants;
+
+public class SecurityTests extends TestSuite {
+
+    protected TestContainer testContainer;
+
+    public static void main(String args[]) throws Exception { 
+	junit.textui.TestRunner.run(suite());
+    }
+
+    String mechanism = null;
+
+    public SecurityTests(String name) {
+        super(name);
+        
+        String securityType = (String)System.getProperty("securityType");
+        Object protection = null;
+        if (securityType != null) { 
+            if (securityType.equalsIgnoreCase("message")) {
+                mechanism = Constants.GSI_SEC_MSG;
+            } else if (securityType.equalsIgnoreCase("conversation")) {
+                mechanism = Constants.GSI_SEC_CONV;
+            } else if (securityType.equalsIgnoreCase("transport")) {
+                mechanism = Constants.GSI_TRANSPORT;
+            } 
+         
+            String protType = (String)System.getProperty("protectionType");
+            if ((protType != null) && 
+                (protType.equalsIgnoreCase("signature"))) {
+                protection = Constants.SIGNATURE;
+            } else if ((protType != null) && 
+                       (protType.equalsIgnoreCase("encryption"))) {
+                protection = Constants.ENCRYPTION;
+            } else {
+                protection = Constants.SIGNATURE;
+            }
+        }
+
+        BasicPerformanceTests.setSecurityReq(mechanism, protection);
+    }
+
+    public void run(TestResult result) {
+
+        if (Constants.GSI_TRANSPORT.equals(mechanism)) {
+            this.testContainer = new GSITestContainer();
+        } else {
+            this.testContainer = new TestContainer();
+        }
+            
+        try {
+            this.testContainer.start();
+            GridTestCase.setTestServer(this.testContainer);
+            super.run(result);
+        }
+        catch(Exception e) {
+            result.addError(this, e);
+        }
+        finally {
+            try {
+                this.testContainer.stop();
+            } catch(Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new SecurityTests("BasicSecurityPerformanceTests");
+        suite.addTestSuite(BasicPerformanceTests.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,285 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_test_unit" basedir=".">
+    <description>
+        Unit Tests
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+    
+    <property environment="env"/>
+ 
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="../../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="base.name" value="wsrf_test_unit"/>
+    <property name="package.name" value="globus_${base.name}"/>
+    <property name="gar.name" value="${package.name}.gar"/>
+    <property name="jar.name" value="${base.name}.jar"/>
+    <property name="stubs.jar.name" value="${base.name}_stubs.jar"/>
+    <property name="build.dir"  location="build"/>
+    <property name="build.dest" location="build/classes"/>
+    <property name="build.lib.dir" location="build/lib"/>
+    <property name="build.packages" location=
+        "${deploy.dir}/share/globus_wsrf_common/build-packages.xml"/>
+    <property name="build.test" location=
+        "${deploy.dir}/share/globus_wsrf_common/build-test.xml"/>
+    <property name="build.stubs" location=
+        "${deploy.dir}/share/globus_wsrf_tools/build-stubs.xml"/>
+    <property name="stubs.dir" location="build/stubs"/>
+    <property name="stubs.src" location="build/stubs/src"/>
+    <property name="stubs.dest" location="build/stubs/classes"/>
+    <property name="schema.src"   location="${deploy.dir}/share/schema"/>
+    <property name="schema.dest"  location="${build.dir}/schema"/>
+    <property name="java.debug" value="on"/>
+    <property name="java.deprecation" value="true"/>
+
+    <property name="garjars.id" value="garjars"/>
+    <fileset dir="${build.lib.dir}" id="garjars"/>
+
+    <property name="garetc.id" value="garEtc"/>
+    <fileset dir="etc" id="garEtc"/>    
+
+    <property name="garschema.id" value="garschema"/>
+    <fileset dir="${schema.dest}" 
+        includes="tests/notification/*" 
+        id="garschema"/>
+
+    <property name="junit.reports.dir" value="test-reports"/>
+    <property name="junit.haltonfailure" value="true"/>
+    <property name="junit.timeout" value="900000"/>
+    <property name="junit.jvmarg" value="-Dignore" />
+
+    <property name="security.test.client.authz" value="self"/>
+
+    <property name="test.server.url" 
+              value="http://localhost:8080/wsrf/services/"/>
+    <property name="secure.test.server.url" 
+              value="https://localhost:8443/wsrf/services/"/>
+
+    <property name="java.debug" value="true"/>
+
+    <target name="init">
+        <mkdir dir="${build.dir}"/>
+        <mkdir dir="${build.dest}"/>
+        <mkdir dir="${build.lib.dir}"/>
+
+        <mkdir dir="${stubs.dir}"/>
+        <mkdir dir="${stubs.src}"/>
+        <mkdir dir="${stubs.dest}"/>
+
+        <mkdir dir="${schema.dest}"/>
+        <copy toDir="${schema.dest}">
+            <fileset dir="${schema.src}" casesensitive="yes">
+                <include name="core/tests/basic/**"/>
+                <include name="core/tests/notification/**"/>
+                <include name="core/tests/security/**"/>
+                <include name="core/tests/invalidate/**"/>
+                <include name="wsrf/**"/>
+                <include name="ws/**"/>
+            </fileset>
+        </copy>
+
+        <available property="stubs.present" type="dir" 
+            file="${stubs.src}/org/globus" />
+
+        <condition property="compiler.jvmarg" value="-source 1.4">
+          <equals arg1="${ant.java.version}" arg2="1.5"/>
+        </condition>
+        <condition property="compiler.jvmarg" value="">
+         <not>
+           <isset property="${compiler.jvmarg}"/>
+         </not>
+        </condition>
+    </target>
+
+    <target name="stubs" unless="stubs.present" depends="init">
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/tests/basic"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+            <property name="wsdl.file" 
+                value="test_service.wsdl"/>
+        </ant>       
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/tests/notification"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+            <property name="wsdl.file" 
+                value="notification_test_service.wsdl"/>
+        </ant>        
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/tests/notification"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+            <property name="wsdl.file" 
+                value="persistence_test_subscription_manager_service.wsdl"/>
+        </ant>        
+	<!-- Test service for secure access test -->
+        <ant antfile="${build.stubs}" target="generateStubs">
+            <property name="source.stubs.dir" 
+                location="${schema.dest}/core/tests/security"/>
+            <property name="target.stubs.dir" location="${stubs.src}"/>
+            <property name="wsdl.file" 
+                value="security_test_service.wsdl"/>
+        </ant>        
+    </target>
+    
+    <target name="compileStubs" depends="stubs">
+        <javac srcdir="${stubs.src}" destdir="${stubs.dest}"
+               debug="${java.debug}" deprecation="${java.deprecation}">
+            <include name="**/*.java"/>
+            <classpath>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+    </target>
+
+    <target name="compile" depends="compileStubs">
+        <javac srcdir="src" destdir="${build.dest}" 
+               debug="${java.debug}" deprecation="${java.deprecation}">
+            <include name="**/*.java"/>
+            <classpath>
+                <pathelement location="${stubs.dest}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+            <compilerarg line="${compiler.jvmarg}"/>
+        </javac>
+	<copy todir="${build.dest}" >
+	      <fileset dir="src" includes="**/*.properties" />
+	      <fileset dir="src" includes="**/*.xml" />
+	</copy>
+    </target>
+
+    <target name="jar" depends="compile">
+        <jar destfile="${build.lib.dir}/${jar.name}" basedir="${build.dest}"/>
+    </target>
+
+    <target name="jarStubs" depends="compileStubs">
+        <jar destfile="${build.lib.dir}/${stubs.jar.name}" 
+            basedir="${stubs.dest}"/>
+    </target>
+
+    <target name="dist" depends="jar, jarStubs">
+        <ant antfile="${build.packages}" target="makeGar">
+            <reference refid="${garjars.id}"/>  
+            <reference refid="${garetc.id}"/>
+            <reference refid="${garschema.id}"/>  
+        </ant>
+    </target>
+
+    <target name="clean">
+        <delete dir="tmp"/>
+        <delete dir="${build.dir}"/>
+        <delete file="${gar.name}"/>
+        <delete dir="${junit.reports.dir}"/>
+    </target>
+
+    <target name="deploy" depends="dist">
+        <ant antfile="${build.packages}" target="deployGar"/>
+    </target>  
+
+    <target name="undeploy">
+        <ant antfile="${build.packages}" target="undeployGar">
+            <property name="gar.id" value="${package.name}"/>
+        </ant>
+    </target>
+
+    <target name="all" depends="jar"/>
+
+    <target name="test" depends="compile">
+      <property name="server.arg" value="-Dignore" />
+      <antcall target="runTests"/>
+      <antcall target="runSecurityTests"/>
+    </target>
+
+    <target name="testServer" depends="compile">
+      <property name="server.arg" 
+                value="-Dweb.server.url=${test.server.url} -Dsecure.web.server.url=${secure.test.server.url}" />
+      <antcall target="runTests"/>
+      <antcall target="runSecurityTests"/>
+    </target>
+
+    <target name="runTests" unless="securityTestsOnly">
+      <mkdir dir="${junit.reports.dir}" />
+      <junit printsummary="yes" 
+             haltonfailure="${junit.haltonfailure}" 
+             fork="yes" 
+             timeout="${junit.timeout}">
+            <sysproperty key="org.globus.wsrf.container.webroot" 
+                value="${deploy.dir}"/>
+            <sysproperty key="GLOBUS_LOCATION"
+                value="${deploy.dir}"/>
+            <classpath>
+                <pathelement location="${build.dest}"/>
+                <pathelement location="${stubs.dest}"/>
+                <pathelement location="${deploy.dir}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+        <formatter type="xml" />
+        <batchtest todir="${junit.reports.dir}">
+         <fileset dir="${build.dest}">
+            <include name="**/PackageTests.class" />
+         </fileset>
+        </batchtest>
+        <jvmarg value="-Djava.endorsed.dirs=${deploy.dir}/endorsed"/>
+        <jvmarg line="${server.arg}" />
+        <jvmarg line="${junit.jvmarg}" />
+      </junit>
+    </target>
+    
+    <!-- These are security tests. They require valid credentials. -->
+    <!-- Using "SecurityTests" as the required class name -->
+    <target name="runSecurityTests" unless="basicTestsOnly">
+      <mkdir dir="${junit.reports.dir}" />
+      <junit printsummary="yes" 
+             haltonfailure="${junit.haltonfailure}" 
+             fork="yes" 
+             timeout="${junit.timeout}">
+            <sysproperty key="org.globus.wsrf.container.webroot" 
+                value="${deploy.dir}"/>
+            <sysproperty key="GLOBUS_LOCATION" 
+                value="${deploy.dir}"/>
+            <sysproperty key="TEST_CLIENT_AUTHZ" 
+                value="${security.test.client.authz}"/>
+            <classpath>
+                <pathelement location="${build.dest}"/>
+                <pathelement location="${stubs.dest}"/>
+                <pathelement location="${deploy.dir}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+        <formatter type="xml" />
+        <batchtest todir="${junit.reports.dir}">
+         <fileset dir="${build.dest}">
+            <include  name="**/SecurityTests.class"/>
+         </fileset>
+        </batchtest>
+        <jvmarg value="-Djava.endorsed.dirs=${deploy.dir}/endorsed"/>
+        <jvmarg line="${server.arg}" />
+        <jvmarg line="${junit.jvmarg}" />
+      </junit>
+    </target>
+
+</project>

Added: incubator/apollo/globus/core/test/unit/deploy-jndi-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/deploy-jndi-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/deploy-jndi-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jndiConfig xmlns="http://wsrf.globus.org/jndi/config">
+   <service name="TestService">
+        <resource
+            name="home"
+            type="org.globus.wsrf.impl.TestHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.TestResource</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+   <service name="TestServiceRequest">
+        <resource
+            name="home"
+            type="org.globus.wsrf.impl.TestHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.TestResource</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+    <service name="NotificationTestService">
+        <resource
+            name="home"
+            type="org.globus.wsrf.impl.notification.NotificationTestHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.notification.NotificationTestResource</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.Integer</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+    <service name="PersistenceTestSubscriptionManager">
+        <resource
+            name="home"
+            type="org.globus.wsrf.impl.notification.PersistenceTestSubscriptionHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.notification.PersistentSubscription</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://www.globus.org/namespaces/2004/06/core}SubscriptionKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+    <service name="SecurityTestService">
+        <resource
+            name="home"
+            type="org.globus.wsrf.impl.security.SecurityTestResourceHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.security.SecurityTestResource</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://www.globus.org/namespaces/2004/06/core}SecurityTestKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+    <service name="AuthzCalloutTestService">
+        <resource
+            name="home"
+            type="org.globus.wsrf.impl.security.SecurityTestResourceHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.impl.security.SecurityTestResource</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyName</name>
+                    <value>{http://www.globus.org/namespaces/2004/06/core}SecurityTestKey</value>
+                </parameter>
+                <parameter>
+                    <name>resourceKeyType</name>
+                    <value>java.lang.String</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+    <service name="TestAuthzService">
+        <resource 
+            name="home"
+            type="org.globus.wsrf.samples.authzService.SampleAuthzHome">
+            <resourceParams>
+                <parameter>
+                    <name>factory</name>
+                    <value>org.globus.wsrf.jndi.BeanFactory</value>
+                </parameter>
+                <parameter>
+                    <name>resourceClass</name>
+                    <value>org.globus.wsrf.samples.authzService.SampleAuthzResource</value>
+                </parameter>
+                <parameter>
+                    <name>declinedMethods</name>
+                    <value>gsiSecConvOnly, gsiSecConvIntegrity, gsiSec</value>
+                </parameter>
+                <parameter>
+                    <name>signature</name>
+                    <value>true</value>
+                </parameter>
+            </resourceParams>
+        </resource>
+    </service>
+</jndiConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/test/unit/deploy-server.wsdd
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/deploy-server.wsdd?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/deploy-server.wsdd	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment name="defaultServerConfig"
+    xmlns="http://xml.apache.org/axis/wsdd/"
+    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <service name="TestService" provider="Handler"
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="scope" value="Application"/>
+        <parameter name="providers" value="
+            GetRPProvider GetMRPProvider QueryRPProvider SetRPProvider  
+            DestroyProvider SetTerminationTimeProvider"/>
+        <parameter name="handlerClass"
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className"
+            value="org.globus.wsrf.impl.TestService"/>
+        <wsdlFile>share/schema/core/tests/basic/test_service.wsdl</wsdlFile>
+        <parameter name="securityDescriptor" value="org/globus/wsrf/impl/test-service-config.xml"/>
+    </service>
+    <service name="TestServiceRequest" provider="Handler"
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="providers" value="
+            GetRPProvider GetMRPProvider QueryRPProvider SetRPProvider  
+            DestroyProvider SetTerminationTimeProvider"/>
+        <parameter name="handlerClass"
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className"
+            value="org.globus.wsrf.impl.TestService"/>
+        <wsdlFile>share/schema/core/tests/basic/test_service.wsdl</wsdlFile>
+    </service>
+    <service name="TestServiceWrongWSDL" provider="Handler"
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="scope" value="Application"/>
+        <parameter name="providers" value="
+            GetRPProvider GetMRPProvider QueryRPProvider SetRPProvider  
+            DestroyProvider SetTerminationTimeProvider"/>
+        <parameter name="handlerClass"
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className"
+            value="org.globus.wsrf.impl.TestService"/>
+        <wsdlFile>share/schema/core/tests/invalidate/invalidate_port_type.wsdl</wsdlFile>
+    </service>
+    <service name="NotificationTestService" provider="Handler"
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="scope" value="Application"/>
+        <parameter name="providers" value="
+            GetRPProvider SetRPProvider 
+            GetCurrentMessageProvider 
+            org.globus.wsrf.impl.notification.PersistenceTestSubscribeProvider
+            org.globus.wsrf.impl.InvalidateProvider"/>
+        <parameter name="handlerClass"
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className"
+            value="org.globus.wsrf.impl.notification.NotificationTestService"/>
+        <wsdlFile>share/schema/core/tests/notification/notification_test_service.wsdl</wsdlFile>
+    </service>
+    <service name="PersistenceTestSubscriptionManager" provider="Handler"
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="scope" value="Application"/>
+        <parameter name="providers"
+            value="DestroyProvider SetTerminationTimeProvider
+            GetRPProvider PauseSubscriptionProvider
+            org.globus.wsrf.impl.InvalidateProvider"/>
+        <parameter name="handlerClass"
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className"
+            value="org.globus.wsrf.impl.notification.ResumeSubscriptionProvider"/>
+        <wsdlFile>share/schema/core/tests/notification/persistence_test_subscription_manager_service.wsdl</wsdlFile>
+    </service>
+    <service name="SecurityTestService" provider="Handler"
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="scope" value="Application"/>
+        <parameter name="handlerClass"
+                   value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className"
+            value="org.globus.wsrf.impl.security.SecurityTestService"/>
+        <wsdlFile>share/schema/core/tests/security/security_test_service.wsdl</wsdlFile>
+        <!-- Does self authz by default -->
+        <parameter name="securityDescriptor" value="@config.dir@/security-config.xml"/>
+        <!-- For use only when identity authz is used-->
+        <!-- parameter name="securityDescriptor" value="@config.dir@/identity-security-config.xml"/>
+        <parameter name="idenAuthz-identity" value="Identity used by client"/ -->
+        <parameter name="providers" value="GetRPProvider SubscribeProvider 
+	GetCurrentMessageProvider"/>
+    </service>
+    <service name="AuthzCalloutTestService" provider="Handler"
+        use="literal" style="document">
+        <parameter name="allowedMethods" value="*"/>
+        <parameter name="scope" value="Application"/>
+        <parameter name="handlerClass"
+                   value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className"
+            value="org.globus.wsrf.impl.security.SecurityTestService"/>
+        <wsdlFile>share/schema/core/tests/security/security_test_service.wsdl</wsdlFile>
+        <!-- Does self authz by default -->
+        <parameter name="securityDescriptor" value="@config.dir@/security-config.xml"/>
+        <!-- For use only when identity authz is used-->
+        <!-- parameter name="securityDescriptor" value="@config.dir@/identity-security-config.xml"/>
+        <parameter name="idenAuthz-identity" value="Identity used by client"/ -->
+        <parameter name="providers" value="GetRPProvider SubscribeProvider 
+	GetCurrentMessageProvider"/>
+        <parameter name="customAuthzTest" value="true"/>
+    </service>
+
+    <!-- Using sample service as test service with some configuration -->
+    <service name="TestAuthzService" provider="Handler" use="literal" 
+        style="document">
+        <parameter name="allowedMethodsClass" 
+            value="org.globus.wsrf.samples.authzService.AuthzServicePortType"/>
+        <parameter name="handlerClass" 
+            value="org.globus.axis.providers.RPCProvider"/>
+        <parameter name="className" 
+            value="org.globus.wsrf.samples.authzService.SampleAuthzService"/>
+        <wsdlFile>share/schema/core/samples/authzService/authzService_service.wsdl</wsdlFile>
+        <parameter name="scope" value="Application"/>
+        <parameter name="providers" value="
+             GetRPProvider GetMRPProvider SetRPProvider 
+        GetCurrentMessageProvider QueryRPProvider"/>
+    </service>
+</deployment>

Added: incubator/apollo/globus/core/test/unit/etc/identity-security-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/etc/identity-security-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/etc/identity-security-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,95 @@
+<securityConfig xmlns="http://www.globus.org">
+ <method name="noAuth"> 
+   <auth-method>
+    <none/>
+   </auth-method>
+ </method>
+ <method name="gsiSecConvDeleg">
+   <auth-method>
+    <GSISecureConversation/>
+   </auth-method>
+   <run-as>
+    <caller-identity/>
+   </run-as>
+ </method>
+  <method name="gsiTransportIntegrity">
+   <auth-method>
+    <GSITransport>
+     <protection-level>
+       <integrity/>
+      </protection-level>
+    </GSITransport>
+   </auth-method>
+  </method>
+  <method name="gsiTransportPrivacy">
+   <auth-method>
+    <GSITransport>
+     <protection-level>
+       <privacy/>
+      </protection-level>
+    </GSITransport>
+   </auth-method>
+  </method>
+  <method name="gsiTransportOnly">
+   <auth-method>
+    <GSITransport/>
+   </auth-method>
+  </method>
+  <method name="gsiSecConvIntegrity">
+   <auth-method>
+    <GSISecureConversation>
+     <protection-level>
+       <integrity/>
+      </protection-level>
+    </GSISecureConversation>
+   </auth-method>
+  </method>
+  <method name="gsiSecConvPrivacy">
+   <auth-method>
+    <GSISecureConversation>
+     <protection-level>
+       <privacy/>
+      </protection-level>
+    </GSISecureConversation>
+   </auth-method>
+  </method>
+  <method name="gsiSecConvOnly">
+   <auth-method>
+    <GSISecureConversation/>
+   </auth-method>
+  </method>
+  <method name="gsiSecMsgOnly">
+   <auth-method>
+    <GSISecureMessage/>
+   </auth-method>
+  </method>
+  <method name="gsiSec">
+   <auth-method>
+    <GSISecureMessage/>
+    <GSISecureConversation/>
+   </auth-method>
+  </method>
+  <method name="setNoAuthz">
+   <run-as>
+     <caller-identity/>
+   </run-as>
+   <auth-method>
+    <GSISecureConversation/>
+   </auth-method>
+  </method>
+  <method name="alterSecurityDesc">
+   <auth-method>
+    <GSISecureConversation/>
+   </auth-method>
+  </method>
+   <method name="subscribe">
+    <auth-method>
+     <GSISecureMessage/>
+     <GSISecureConversation/>
+    </auth-method>
+   </method>  
+  <authz value="identity"/>
+  <auth-method>
+    <none/>
+  </auth-method>
+</securityConfig>

Added: incubator/apollo/globus/core/test/unit/etc/local-config-authz-test.conf
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/etc/local-config-authz-test.conf?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/etc/local-config-authz-test.conf	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,2 @@
+/CN\=foo={http://org.test}read;{http://org.test}write;{http://org.test}exec
+/CN\=bar={http://org.test}read;
\ No newline at end of file

Added: incubator/apollo/globus/core/test/unit/etc/security-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/etc/security-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/etc/security-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,95 @@
+<securityConfig xmlns="http://www.globus.org">
+ <method name="noAuth"> 
+   <auth-method>
+    <none/>
+   </auth-method>
+ </method>
+ <method name="gsiSecConvDeleg">
+   <auth-method>
+    <GSISecureConversation/>
+   </auth-method>
+   <run-as>
+    <caller-identity/>
+   </run-as>
+ </method>
+  <method name="gsiTransportIntegrity">
+   <auth-method>
+    <GSITransport>
+     <protection-level>
+       <integrity/>
+      </protection-level>
+    </GSITransport>
+   </auth-method>
+  </method>
+  <method name="gsiTransportPrivacy">
+   <auth-method>
+    <GSITransport>
+     <protection-level>
+       <privacy/>
+      </protection-level>
+    </GSITransport>
+   </auth-method>
+  </method>
+  <method name="gsiTransportOnly">
+   <auth-method>
+    <GSITransport/>
+   </auth-method>
+  </method>
+  <method name="gsiSecConvIntegrity">
+   <auth-method>
+    <GSISecureConversation>
+     <protection-level>
+       <integrity/>
+      </protection-level>
+    </GSISecureConversation>
+   </auth-method>
+  </method>
+  <method name="gsiSecConvPrivacy">
+   <auth-method>
+    <GSISecureConversation>
+     <protection-level>
+       <privacy/>
+      </protection-level>
+    </GSISecureConversation>
+   </auth-method>
+  </method>
+  <method name="gsiSecConvOnly">
+   <auth-method>
+    <GSISecureConversation/>
+   </auth-method>
+  </method>
+  <method name="gsiSecMsgOnly">
+   <auth-method>
+    <GSISecureMessage/>
+   </auth-method>
+  </method>
+  <method name="gsiSec">
+   <auth-method>
+    <GSISecureMessage/>
+    <GSISecureConversation/>
+   </auth-method>
+  </method>
+  <method name="setNoAuthz">
+   <run-as>
+     <caller-identity/>
+   </run-as>
+   <auth-method>
+    <GSISecureConversation/>
+   </auth-method>
+  </method>
+  <method name="alterSecurityDesc">
+   <auth-method>
+    <GSISecureConversation/>
+   </auth-method>
+  </method>
+   <method name="subscribe">
+    <auth-method>
+     <GSISecureMessage/>
+     <GSISecureConversation/>
+    </auth-method>
+   </method>  
+  <authz value="self"/>
+  <auth-method>
+    <none/>
+  </auth-method>
+</securityConfig>

Added: incubator/apollo/globus/core/test/unit/pkgdata/filelist
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/pkgdata/filelist?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/pkgdata/filelist	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,7 @@
+etc/globus_packages/globus_wsrf_test_unit/undeploy.xml
+etc/globus_wsrf_test_unit/jndi-config.xml
+etc/globus_wsrf_test_unit/local-config-authz-test.conf
+etc/globus_wsrf_test_unit/security-config.xml
+etc/globus_wsrf_test_unit/server-config.wsdd
+lib/wsrf_test_unit.jar
+lib/wsrf_test_unit_stubs.jar

Added: incubator/apollo/globus/core/test/unit/pkgdata/pkg_data_src.gpt
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/pkgdata/pkg_data_src.gpt?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/pkgdata/pkg_data_src.gpt	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE gpt_package_metadata SYSTEM "package.dtd">
+
+<gpt_package_metadata Format_Version="0.01" Name="globus_java_ws_core_test_unit">
+
+    <Aging_Version Age="0" Major="0" Minor="1"/>
+    <Description>
+        The Java WS Core Unit Testing package
+    </Description>
+    <Functional_Group>Core</Functional_Group>
+    <Version_Stability Release="alpha" />
+
+    <src_pkg >
+
+        <Source_Dependencies Type="compile" >
+            <Dependency Name="globus_java_ws_core_test_base" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+        </Source_Dependencies>
+
+        <Build_Environment >
+            <cflags ></cflags>
+            <external_includes ></external_includes>
+            <pkg_libs ></pkg_libs>
+            <external_libs ></external_libs>
+        </Build_Environment>
+
+        <With_Flavors build="no" />
+
+        <Version_Label>0.1</Version_Label>
+
+        <Build_Instructions>
+            <Build_Step>ant deploy -Ddeploy.dir=INSTALLDIR_GPTMACRO</Build_Step>
+        </Build_Instructions>
+
+    </src_pkg >
+
+</gpt_package_metadata>

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/InvalidateResourceMapping.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/InvalidateResourceMapping.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/InvalidateResourceMapping.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,21 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf;
+
+public interface InvalidateResourceMapping
+{
+    public void invalidate(ResourceKey key) throws ResourceException;
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/GSIServiceContainerTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/GSIServiceContainerTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/GSIServiceContainerTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,307 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.rpc.Stub;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.axis.types.URI;
+
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.Subscribe;
+import org.oasis.wsn.SubscribeResponse;
+import org.oasis.wsrf.lifetime.Destroy;
+
+import org.globus.axis.gsi.GSIConstants;
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.core.notification.SubscriptionManager;
+import org.globus.wsrf.handlers.DIITests;
+import org.globus.wsrf.impl.TestService;
+import org.globus.wsrf.impl.notification.NotificationTestCase;
+import org.globus.wsrf.impl.notification.NotificationTestService;
+import org.globus.wsrf.impl.notification.NotifyThread;
+import org.globus.wsrf.impl.notification.TestNotifyCallback;
+import org.globus.wsrf.impl.security.TestConstants;
+import org.globus.wsrf.impl.security.descriptor.ClientSecurityDescriptor;
+import org.globus.wsrf.security.Constants;
+import org.globus.wsrf.test.GridTestSuite;
+import org.globus.wsrf.tests.basic.TestPortType;
+import org.globus.wsrf.tests.basic.CreateResource;
+import org.globus.wsrf.tests.basic.CreateResourceResponse;
+import org.globus.wsrf.tests.basic.service.TestServiceAddressingLocator;
+import org.globus.wsrf.tests.security.SecurityTestPortType;
+import org.globus.wsrf.tests.security.SetAnonymousAuthz;
+import org.globus.wsrf.tests.security.service.SecurityTestServiceAddressingLocator;
+import org.globus.wsrf.impl.security.authorization.Authorization;
+import org.globus.wsrf.impl.security.authorization.NoAuthorization;
+
+public class GSIServiceContainerTest extends NotificationTestCase {
+
+    static Log logger =
+        LogFactory.getLog(GSIServiceContainerTest.class.getName());
+
+    protected TestServiceAddressingLocator locator =
+        new TestServiceAddressingLocator();
+
+    Authorization authz = null;
+    org.globus.gsi.gssapi.auth.Authorization gsiAuthz = null;
+
+    public GSIServiceContainerTest(String name) {
+        super(name);
+        authz = TestConstants.getConfiguredClientAuthz();
+        gsiAuthz = TestConstants.getConfiguredClientGSIAuthz();
+    }
+
+    public void testBasic() throws Exception {
+        String address =
+            TEST_CONTAINER.getBaseURL() + TestService.SERVICE_PATH;
+        URI u = new URI(address);
+        assertEquals("https", u.getScheme());
+        EndpointReferenceType epr = new EndpointReferenceType(u);
+        TestPortType port = locator.getTestPortTypePort(epr);
+        ClientSecurityDescriptor secDesc = new ClientSecurityDescriptor();
+        secDesc.setAuthz(authz);
+        ((Stub) port)._setProperty(Constants.CLIENT_DESCRIPTOR, secDesc);
+        CreateResourceResponse response =
+            port.createResource(new CreateResource());
+        assertEquals("https",
+                     response.getEndpointReference().getAddress().getScheme());
+        port = locator.getTestPortTypePort(response.getEndpointReference());
+        ((Stub) port)._setProperty(Constants.CLIENT_DESCRIPTOR, secDesc);
+        port.destroy(new Destroy());
+    }
+
+    public void testAnonymous() throws Exception {
+        String address =
+            TEST_CONTAINER.getBaseURL() + TestConstants.SECURITY_SERVICE_PATH;
+        URI u = new URI(address);
+        assertEquals("https", u.getScheme());
+        EndpointReferenceType epr = new EndpointReferenceType(u);
+        SecurityTestServiceAddressingLocator locator =
+            new SecurityTestServiceAddressingLocator();
+        SecurityTestPortType port = locator.getSecurityTestPortTypePort(epr);
+        ClientSecurityDescriptor secDesc = new ClientSecurityDescriptor();
+        // Setting to no authz, self will not work since its anon
+        secDesc.setAuthz(new NoAuthorization());
+        secDesc.setAnonymous();
+        ((Stub) port)._setProperty(Constants.CLIENT_DESCRIPTOR, secDesc);
+        org.globus.wsrf.tests.security.CreateResourceResponse response =
+            port.createResource(true);
+        assertEquals("https",
+                     response.getEndpointReference().getAddress().getScheme());
+        port = locator.getSecurityTestPortTypePort(
+            response.getEndpointReference());
+        ((Stub) port)._setProperty(Constants.CLIENT_DESCRIPTOR, secDesc);
+        port.setAnonymousAuthz(new SetAnonymousAuthz());
+        port.setValue(20);
+    }
+
+    public void testDII() throws Exception {
+        String address =
+            TEST_CONTAINER.getBaseURL() + TestService.SERVICE_PATH + "?wsdl";
+        DIITests test = new DIITests("diiTest");
+        Map props = new HashMap();
+        ClientSecurityDescriptor secDesc = new ClientSecurityDescriptor();
+        secDesc.setAuthz(authz);
+        props.put(Constants.CLIENT_DESCRIPTOR, secDesc);
+        test.diiTest(address, props);
+    }
+
+    public void testSecurityPolicy() throws Exception {
+
+        assertTrue(TEST_CONTAINER != null);
+        String testServiceAddrs = TEST_CONTAINER.getBaseURL() +
+                                  TestConstants.SECURITY_SERVICE_PATH;
+        EndpointReferenceType testServiceEPR =
+            new EndpointReferenceType(new URI(testServiceAddrs));
+
+        SecurityTestServiceAddressingLocator locator =
+            new SecurityTestServiceAddressingLocator();
+        SecurityTestPortType testPort =
+            locator.getSecurityTestPortTypePort(testServiceEPR);
+        ((Stub)testPort)._setProperty(Constants.GSI_TRANSPORT,
+                                      Constants.SIGNATURE);
+        ((Stub)testPort)._setProperty(GSIConstants.GSI_AUTHORIZATION,
+                                      gsiAuthz);
+        verifySecureAccess(testPort, true, true, false);
+
+        testPort = locator.getSecurityTestPortTypePort(testServiceEPR);
+        ((Stub)testPort)._setProperty(Constants.GSI_TRANSPORT,
+                                      Constants.ENCRYPTION);
+        ((Stub)testPort)._setProperty(GSIConstants.GSI_AUTHORIZATION,
+                                      gsiAuthz);
+        verifySecureAccess(testPort, true, false, true);
+
+        SecurityTestServiceAddressingLocator locator1 =
+            new SecurityTestServiceAddressingLocator();
+        SecurityTestPortType testPort1 =
+            locator1.getSecurityTestPortTypePort(testServiceEPR);
+        ((Stub)testPort1)._setProperty(Constants.GSI_SEC_MSG,
+                                       Constants.SIGNATURE);
+        ((Stub)testPort1)._setProperty(Constants.AUTHORIZATION, authz);
+        ((Stub)testPort1)._setProperty(GSIConstants.GSI_AUTHORIZATION,
+                                       gsiAuthz);
+
+        // Signaure is always set
+        verifySecureAccess(testPort1, true, true, false);
+
+    }
+
+    private void verifySecureAccess(SecurityTestPortType testPort,
+                                    boolean transportOnly,
+                                    boolean transportIntegrity,
+                                    boolean transportPrivacy)
+        throws Exception {
+
+        boolean exp = true;
+        try {
+            testPort.gsiTransportOnly(null);
+        } catch (Exception e) {
+            if ((e.getMessage().indexOf("authentication require")) != -1) {
+                exp = false;
+            } else {
+                logger.error(e);
+            }
+        }
+        assertTrue(exp == transportOnly);
+
+        exp = true;
+        try {
+            testPort.gsiTransportIntegrity(null);
+        } catch (Exception e) {
+            if ((e.getMessage().indexOf("authentication require")) != -1) {
+                exp = false;
+            } else {
+                logger.error(e);
+            }
+        }
+        assertTrue(exp == transportIntegrity);
+
+        exp = true;
+        try {
+            testPort.gsiTransportPrivacy(null);
+        } catch (Exception e) {
+            if ((e.getMessage().indexOf("authentication require")) != -1) {
+                exp = false;
+            } else {
+                logger.error(e);
+            }
+        }
+        assertTrue(exp == transportPrivacy);
+    }
+
+    public void testMultipleNotifications() throws Exception {
+        TestNotifyCallback callback = new TestNotifyCallback();
+        int expectedCount = 1;
+        Map properties = new HashMap();
+        ClientSecurityDescriptor secDesc = new ClientSecurityDescriptor();
+        secDesc.setAuthz(authz);
+        properties.put(ServiceContainer.CLASS,
+                       "org.globus.wsrf.container.GSIServiceContainer");
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance(properties);
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(callback);
+        assertEquals("https",
+                     consumerEPR.getAddress().getScheme());
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        ((Stub) super.port)._setProperty(Constants.CLIENT_DESCRIPTOR, secDesc);
+        SubscribeResponse response = super.port.subscribe(request);
+
+        for(int i = 0; i < 10; i++) {
+            super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+            assertTrue("timed out waiting for notification #" + expectedCount,
+                       callback.waitForCount(expectedCount, GridTestSuite.timeout));
+            assertEquals(expectedCount, callback.getNotifyCount());
+            expectedCount++;
+        }
+        SubscriptionManager manager =
+            this.managerLocator.getSubscriptionManagerPort(
+                response.getSubscriptionReference());
+        ((Stub) manager)._setProperty(Constants.CLIENT_DESCRIPTOR, secDesc);
+        manager.destroy(new Destroy());
+    }
+
+    public void testMultithreadedNotifications() throws Exception {
+
+        Map properties = new HashMap();
+        ClientSecurityDescriptor secDesc = new ClientSecurityDescriptor();
+        secDesc.setAuthz(authz);
+        properties.put(ServiceContainer.CLASS,
+                       "org.globus.wsrf.container.GSIServiceContainer");
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance(properties);
+        consumer.startListening();
+
+        ((Stub) super.port)._setProperty(Constants.CLIENT_DESCRIPTOR, secDesc);
+
+        Object lock = new Object();
+
+        int size = 10;
+        NotifyThread [] threads = new NotifyThread[size];
+        for (int i=0;i<size;i++) {
+            threads[i] = new NotifyThread(testServiceEPR, consumer,
+                                          lock, secDesc);
+            threads[i].start();
+        }
+
+        for (int i=0;i<size;i++) {
+            while( !threads[i].isSubscribed() ) {
+                Throwable e = threads[i].getException();
+                if (e != null) {
+                    fail(e.getMessage());
+                }
+                Thread.sleep(100);
+            }
+        }
+
+        synchronized(lock) {
+            lock.notifyAll();
+        }
+
+        super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+
+        Throwable e = null;
+
+        for (int i=0;i<size;i++) {
+            threads[i].join();
+            if (threads[i].getException() != null) {
+                threads[i].getException().printStackTrace();
+                if (e == null) {
+                    e = threads[i].getException();
+                }
+            }
+        }
+
+        if (e != null) {
+            fail(e.getMessage());
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/LockManagerTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/LockManagerTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/LockManagerTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,35 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import junit.framework.TestCase;
+
+public class LockManagerTest extends TestCase {
+
+    public LockManagerTest(String name) {
+        super(name);
+    }
+
+    public void testGetLocks() throws Exception {
+        LockManager l = new LockManager();
+        
+        Lock l1 = l.getLock(new String("A"));
+        Lock l2 = l.getLock(new String("A"));
+        
+        assertTrue(l1 == l2);
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,34 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends TestSuite {
+
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("ContainerTests");
+        suite.addTestSuite(LockManagerTest.class);
+        suite.addTestSuite(ServiceContainerTest.class);
+        suite.addTestSuite(ServiceHostTest.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/SecurityTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/SecurityTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/SecurityTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,69 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import org.globus.wsrf.test.GSITestContainer;
+import org.globus.wsrf.test.GridTestCase;
+import org.globus.wsrf.test.TestContainer;
+import junit.framework.Test;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+
+public class SecurityTests extends TestSuite
+{
+    public static int timeout =  1000 * 60 * 2;
+
+    protected TestContainer testContainer;
+
+    public SecurityTests(String name)
+    {
+        super(name);
+    }
+
+    public static Test suite() throws Exception
+    {
+        TestSuite suite = new SecurityTests("SecureServiceContainerTest");
+        suite.addTestSuite(GSIServiceContainerTest.class);
+        return suite;
+    }
+
+    public void run(TestResult result)
+    {
+        this.testContainer = new GSITestContainer();
+
+        try
+        {
+            this.testContainer.start();
+            GridTestCase.setTestServer(this.testContainer);
+            super.run(result);
+        }
+        catch(Exception e)
+        {
+            result.addError(this, e);
+        }
+        finally
+        {
+            try
+            {
+                this.testContainer.stop();
+            }
+            catch(Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/ServiceContainerTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/ServiceContainerTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/ServiceContainerTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,102 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import junit.framework.TestCase;
+
+public class ServiceContainerTest extends TestCase {
+
+    static Log logger =
+        LogFactory.getLog(ServiceContainerTest.class.getName());
+
+    public ServiceContainerTest(String name) {
+        super(name);
+    }
+
+    public void testContainerReuse() throws Exception {
+        ServiceContainer container1 = 
+            ServiceContainer.createContainer(false);
+        
+        ServiceContainer container2 = 
+            ServiceContainer.createContainer(false);
+        
+        assertEquals(container1, container2);
+        
+        container2.stop();
+        container1.stop();
+
+        ServiceContainer container3 = 
+            ServiceContainer.createContainer(false);
+        
+        assertTrue(container2 != container3);
+
+        container3.stop();
+    }
+
+    public void testSeparateContainers() throws Exception {
+        ServiceContainer container1 = 
+            ServiceContainer.createContainer(false);
+        
+        ServiceContainer container2 = 
+            ServiceContainer.createContainer(true);
+        
+        assertTrue(container1 != container2);
+
+        assertTrue(ServiceContainerCollection.get(container1.getURLString()) != null);
+        assertTrue(ServiceContainerCollection.get(container2.getURLString()) != null);
+        
+        container1.stop();
+        container2.stop();
+        
+        assertTrue(ServiceContainerCollection.get(container1.getURLString()) == null);
+        assertTrue(ServiceContainerCollection.get(container2.getURLString()) == null);
+    }
+    
+    public void testReferences() throws Exception {
+        ServiceContainer container1 = 
+            ServiceContainer.createContainer(false);
+        
+        ServiceContainer container2 = 
+            ServiceContainer.createContainer(false);
+        
+        assertTrue(container1 == container2);
+        
+        assertTrue(ServiceContainerCollection.get(container1.getURLString()) != null);
+        
+        container1.stop();
+        
+        assertTrue(ServiceContainerCollection.get(container1.getURLString()) != null);
+        
+        container2.stop();
+        
+        assertTrue(ServiceContainerCollection.get(container1.getURLString()) == null);
+    }
+    
+    public void testIsRunning() throws Exception {
+        ServiceContainer container1 = 
+            ServiceContainer.createContainer(false);
+        
+        assertTrue(container1.isRunning());
+        
+        container1.stop();
+        
+        assertTrue(!container1.isRunning());
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/ServiceHostTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/ServiceHostTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/container/ServiceHostTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,61 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.container;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.MessageContext;
+
+import junit.framework.TestCase;
+
+public class ServiceHostTest extends TestCase {
+
+    static Log logger =
+        LogFactory.getLog(ServiceHostTest.class.getName());
+
+    public ServiceHostTest(String name) {
+        super(name);
+    }
+
+    public void testPort() throws Exception {
+        String url;
+        MessageContext ctx;
+
+        url = "http://localhost:843/ogsa/services/core/registry/handle";
+        ctx = getContext(url);
+        assertEquals(843, ServiceHost.getPort(ctx));
+
+        url = "http://localhost/ogsa/services/core/registry/handle";
+        ctx = getContext(url);
+        assertEquals(80, ServiceHost.getPort(ctx));
+    }
+
+    public void testProtocol() throws Exception {
+        String url;
+        MessageContext ctx;
+
+        url = "http://localhost:843/ogsa/services/core/registry/handle";
+        ctx = getContext(url);
+        assertEquals("http", ServiceHost.getProtocol(ctx));
+    }
+
+    private MessageContext getContext(String url) {
+        MessageContext ctx = new MessageContext(null);
+        ctx.setProperty(MessageContext.TRANS_URL, url);
+        return ctx;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/AnyListMarshalingTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/AnyListMarshalingTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/AnyListMarshalingTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,135 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.oasis.AnyListType;
+import org.oasis.wsrf.properties.SetResourceProperties_Element;
+
+import java.io.StringWriter;
+import java.io.StringReader;
+
+import java.util.Calendar;
+
+import org.apache.axis.MessageContext;
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.client.AxisClient;
+
+import org.globus.wsrf.utils.XmlUtils;
+
+import org.xml.sax.InputSource;
+
+import junit.framework.TestCase;
+
+import javax.xml.namespace.QName;
+
+import org.oasis.wsrf.properties.DeleteType;
+import org.oasis.wsrf.properties.InsertType;
+import org.oasis.wsrf.properties.UpdateType;
+
+public class AnyListMarshalingTest extends TestCase {
+
+    public AnyListMarshalingTest(String name) {
+        super(name);
+    }
+
+    public void testSimple() throws Exception {
+
+        MessageContext ctx = new MessageContext(new AxisClient());
+        ctx.setEncodingStyle("");
+        ctx.setProperty(AxisClient.PROP_DOMULTIREFS, 
+                        Boolean.FALSE);
+        
+        StringWriter writer = new StringWriter();
+        SerializationContext context =
+            new SerializationContext(writer, ctx);
+        context.setPretty(true);
+        
+        QName foo = new QName("http://www.globus.org", "bar");
+
+        AnyListType values = new SetResourceProperties_Element();
+
+        QName RP = new QName("http://www.globus.org", "FooRP");
+
+        Calendar time1 = Calendar.getInstance();
+        time1.add(Calendar.SECOND, 30);
+        
+        Calendar time2 = Calendar.getInstance();
+        time2.add(Calendar.HOUR, 30);
+
+        DeleteType delete = new DeleteType();
+        delete.setResourceProperty(RP);
+        
+        values.add(delete);
+
+        InsertType insert = new InsertType();
+        insert.set_any(new MessageElement[] {
+            (MessageElement)ObjectSerializer.toSOAPElement(time1, RP)
+        });
+
+        values.add(insert);
+
+        UpdateType update = new UpdateType();
+        update.set_any(new MessageElement[] {
+            (MessageElement)ObjectSerializer.toSOAPElement(time2, RP)
+        });
+
+        values.add(update);
+
+
+        QName xmlType = SetResourceProperties_Element.getTypeDesc().getXmlType();
+        QName request = new QName(xmlType.getNamespaceURI(),
+                                  xmlType.getLocalPart().substring(1));
+        
+        context.serialize(request, null, values);
+
+        writer.flush();
+
+        String valueStr = writer.toString();
+        
+        System.out.println(valueStr);
+
+        InputSource input = new InputSource(new StringReader(valueStr));
+        
+        Object dserValue = 
+            ObjectDeserializer.toObject(XmlUtils.newDocument(input).getDocumentElement(), SetResourceProperties_Element.class);
+
+        assertTrue(dserValue != null);
+        assertTrue(dserValue instanceof AnyListType);
+        AnyListType rt = (AnyListType)dserValue;
+        assertEquals(3, rt.size());
+
+        assertTrue(rt.get(0) instanceof DeleteType);
+        assertEquals(RP, ((DeleteType)rt.get(0)).getResourceProperty());
+
+        Object tmp = null;
+        assertTrue(rt.get(1) instanceof InsertType);
+        assertEquals(1, ((InsertType)rt.get(1)).get_any().length);
+        tmp = ObjectDeserializer.toObject(
+                         ((InsertType)rt.get(1)).get_any()[0],
+                         Calendar.class);
+        assertEquals(time1.getTime(), ((Calendar)tmp).getTime());
+
+        assertTrue(rt.get(2) instanceof UpdateType);
+        assertEquals(1, ((UpdateType)rt.get(2)).get_any().length);
+        tmp = ObjectDeserializer.toObject(
+                         ((UpdateType)rt.get(2)).get_any()[0],
+                         Calendar.class);
+        assertEquals(time2.getTime(), ((Calendar)tmp).getTime());
+
+    }
+        
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/AnyMarshalingTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/AnyMarshalingTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/AnyMarshalingTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,131 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.oasis.AnyListType;
+import org.oasis.wsrf.properties.SetResourceProperties_Element;
+
+import java.io.StringWriter;
+import java.io.StringReader;
+
+import java.util.Calendar;
+
+import javax.xml.rpc.encoding.TypeMapping;
+import javax.xml.rpc.encoding.TypeMappingRegistry;
+
+import org.apache.axis.MessageContext;
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.client.AxisClient;
+
+import org.globus.wsrf.utils.XmlUtils;
+
+import org.xml.sax.InputSource;
+
+import junit.framework.TestCase;
+
+import javax.xml.namespace.QName;
+
+import org.oasis.wsrf.properties.DeleteType;
+import org.oasis.wsrf.properties.InsertType;
+import org.oasis.wsrf.properties.UpdateType;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class AnyMarshalingTest extends TestCase {
+
+    private static final QName ANY_TYPE = 
+        new QName("http://www.w3.org/2001/XMLSchema", "anyType");
+    
+    public AnyMarshalingTest(String name) {
+        super(name);
+    }
+
+    public void testSerializeDeserialize() throws Exception {
+
+        MessageContext ctx = new MessageContext(new AxisClient());
+        ctx.setEncodingStyle("");
+        ctx.setProperty(AxisClient.PROP_DOMULTIREFS, 
+                        Boolean.FALSE);
+        
+        StringWriter writer = new StringWriter();
+        SerializationContext context =
+            new SerializationContext(writer, ctx);
+        context.setPretty(true);
+
+        TypeMappingRegistry registry = context.getTypeMappingRegistry();
+        TypeMapping map = registry.getDefaultTypeMapping();
+
+        map.register(MessageElement.class,
+                     ANY_TYPE,
+                     new AnySerializerFactory(),
+                     new AnyDeserializerFactory());
+
+        QName RP = new QName("http://www.globus.org", "FooRP");
+        
+        Calendar time1 = Calendar.getInstance();
+        time1.add(Calendar.SECOND, 30);
+        
+        MessageElement value = 
+            (MessageElement)ObjectSerializer.toSOAPElement(time1, RP);
+        value.setType(ANY_TYPE);
+
+        QName request = new QName("http://www.globus.org",
+                                  "FooElement");
+        
+        context.serialize(request, null, value);
+        
+        writer.flush();
+        
+        String valueStr = writer.toString();
+        
+        System.out.println(valueStr);
+
+        InputSource input = new InputSource(new StringReader(valueStr));
+        
+        Element elem = XmlUtils.newDocument(input).getDocumentElement();
+
+        assertEquals("FooElement", elem.getLocalName());
+        NodeList children = elem.getChildNodes();
+        assertTrue(children.getLength() > 0);
+        // find first element child
+        Node child = null;
+        for (int i=0;i<children.getLength();i++) {
+            child = children.item(i);
+            if (child.getLocalName() != null) {
+                break;
+            } else {
+                child = null;
+            }
+        }
+        assertEquals("FooRP", child.getLocalName());
+        Object tmp = ObjectDeserializer.toObject((Element)child, 
+                                                 Calendar.class);
+        assertEquals(time1.getTime(), ((Calendar)tmp).getTime());
+
+        // try deserializer
+        Object dserValue = ObjectDeserializer.toObject(elem);
+
+        assertTrue(dserValue != null);
+        assertTrue(elem != dserValue);
+        assertTrue(dserValue instanceof MessageElement);
+
+        System.out.println(dserValue);
+    }
+        
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/ObjectSerializerTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/ObjectSerializerTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/ObjectSerializerTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,76 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import org.globus.wsrf.utils.AnyHelper;
+
+import org.globus.wsrf.types.profiling.Timestamp;
+import org.globus.wsrf.types.profiling.TimestampType;
+
+import org.apache.axis.message.MessageElement;
+
+import junit.framework.TestCase;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+public class ObjectSerializerTest extends TestCase {
+
+    public void testSimple() throws Exception {
+        SOAPElement soapElem = null;
+        Element elem = null;
+
+        QName name = new QName("http://foo", "abcdef");
+        String value = "abc";
+
+        soapElem = ObjectSerializer.toSOAPElement(value, name);
+        System.out.println(AnyHelper.toString((MessageElement)soapElem));
+        elem = AnyHelper.toElement((MessageElement)soapElem);
+
+        assertEquals(name.getNamespaceURI(), elem.getNamespaceURI());
+        assertTrue (elem.getTagName().indexOf(name.getLocalPart()) != -1);
+    }
+
+    public void testBean() throws Exception {
+        SOAPElement soapElem = null;
+        Element elem = null;
+
+        TimestampType timestampType = new TimestampType();
+        Timestamp timestamp = new Timestamp();
+        timestampType.setTimestamp(timestamp);
+        timestamp.setThreadID("foo");
+        timestamp.setMessageContextHash("bar");
+        timestamp.setServiceURL("http://mismis");
+        timestamp.setOperation("createCounter");
+        
+
+
+        QName name = new QName("http://foo", "abcdef");
+        soapElem = ObjectSerializer.toSOAPElement(timestampType, name);
+        System.out.println(AnyHelper.toString((MessageElement)soapElem));
+        elem = AnyHelper.toElement((MessageElement)soapElem);
+
+        NodeList list = 
+            elem.getElementsByTagNameNS("http://wsrf.globus.org/types/profiling",
+                                        "threadID");
+        assertEquals(1, list.getLength());
+        assertEquals("foo", list.item(0).getFirstChild().getNodeValue());
+    }
+            
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/encoding/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,34 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.encoding;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends TestSuite {
+
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("EncodingTests");
+        suite.addTestSuite(AnyMarshalingTest.class);
+        suite.addTestSuite(ObjectSerializerTest.class);
+        suite.addTestSuite(AnyListMarshalingTest.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/BasicTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/BasicTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/BasicTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,287 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.handlers;
+
+import java.net.URL;
+import java.net.Socket;
+import java.io.IOException;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.io.InputStream;
+import java.util.Hashtable;
+
+import org.oasis.wsrf.lifetime.WSResourceLifetimeServiceAddressingLocator;
+import org.oasis.wsrf.lifetime.ImmediateResourceTermination;
+import org.oasis.wsrf.lifetime.Destroy;
+
+import org.globus.util.http.HTTPResponseParser;
+import org.globus.util.http.HTTPProtocol;
+
+import org.globus.wsrf.tests.basic.service.TestServiceAddressingLocator;
+import org.globus.wsrf.tests.basic.TestPortType;
+import org.globus.wsrf.tests.basic.CreateResource;
+import org.globus.wsrf.tests.basic.CreateResourceResponse;
+import org.globus.wsrf.tests.basic.GetInstanceInfoResponse;
+import org.globus.wsrf.tests.basic.TestLocalInvocation;
+import org.globus.wsrf.tests.basic.TestLocalInvocationResponse;
+
+import org.globus.wsrf.impl.TestService;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.MessageContext;
+import org.apache.axis.transport.http.HTTPConstants;
+
+import org.globus.wsrf.test.GridTestCase;
+
+import javax.xml.rpc.Stub;
+
+public class BasicTests extends GridTestCase {
+
+    public BasicTests(String name) {
+        super(name);
+    }
+
+    public void testServiceNotFound() throws Exception {
+        assertTrue(TEST_CONTAINER.getBaseURL().endsWith("/"));
+        
+        runTest(TEST_CONTAINER.getBaseURL());
+        runTest(TEST_CONTAINER.getBaseURL() + "F");
+        
+        String url = TEST_CONTAINER.getBaseURL();
+        runTest(url.substring(0, url.length()-1));
+        //runTest(url.substring(0, url.length()-2));
+    }
+
+    private void runTest(String strUrl) throws Exception {
+        System.out.println(strUrl);
+
+        WSResourceLifetimeServiceAddressingLocator locator =
+            new WSResourceLifetimeServiceAddressingLocator();
+        
+        URL url = new URL(strUrl);
+
+        try {
+            
+            ImmediateResourceTermination port = 
+                locator.getImmediateResourceTerminationPort(url);
+            port.destroy(new Destroy());
+        } catch (AxisFault e) {
+            assertTrue(
+                e.getFaultCode().getLocalPart().equals(
+                    "Server.NoService"
+                    ));
+        }
+                
+    }
+
+    public void testWrongWSDLCall() throws Exception {
+        String address = 
+            TEST_CONTAINER.getBaseURL() + TestService.SERVICE_PATH + "WrongWSDL";
+        
+        WSResourceLifetimeServiceAddressingLocator locator =
+            new WSResourceLifetimeServiceAddressingLocator();
+        
+        URL url = new URL(address);
+        
+        ImmediateResourceTermination port = 
+            locator.getImmediateResourceTerminationPort(url);
+
+        try {
+            port.destroy(new Destroy());
+        } catch (AxisFault e) {
+            // little hacky...
+            assertTrue(e.getMessage().startsWith("WSDLException: faultCode=OTHER_ERROR: [CORE] wsdl binding information missing"));
+        }
+    }
+
+    public void testWrongWSDLGet() throws Exception {
+        String wsdlLocation = TEST_CONTAINER.getBaseURL() + 
+            TestService.SERVICE_PATH + "WrongWSDL?wsdl";
+        
+        URL url = new URL(wsdlLocation);
+
+        Socket socket = null;
+        InputStream in = null;
+        OutputStream out = null;
+
+        try {
+            socket = new Socket(TEST_CONTAINER.getHost(),
+                                TEST_CONTAINER.getPort());
+            
+            out = socket.getOutputStream();
+            String msg = HTTPProtocol.createGETHeader(url.getFile(), 
+                                                      TEST_CONTAINER.getHost(),
+                                                      "TestClient");
+            out.write(msg.getBytes());
+            out.flush();
+            
+            in = socket.getInputStream();
+
+            HTTPResponseParser response =
+                new HTTPResponseParser(in);
+
+            byte [] buf = new byte[1024];
+            ByteArrayOutputStream outb = 
+                new ByteArrayOutputStream();
+            long len = response.getContentLength();
+            int bytes = 0;
+            if (len == -1) {
+                while ( (bytes = in.read(buf)) != -1 ) {
+                    outb.write(buf, 0, bytes);
+                }
+            } else {
+                int totalBytes = 0;
+                while ( totalBytes < len ) {
+                    bytes = in.read(buf);
+                    if (bytes == -1) {
+                        break;
+                    }
+                    outb.write(buf, 0, bytes);
+                    totalBytes += bytes;
+                }
+            }
+            
+            byte [] data = outb.toByteArray();  
+            
+            System.out.println("Content type: " + 
+                               response.getContentType());
+            System.out.println("Reply: " + new String(data));
+            
+            assertTrue(response.getStatusCode() >= 300);
+            assertTrue(response.getContentType().startsWith("text/html"));
+
+            // we could check for this also in development prop enabled
+            // in tomcat.
+            /*
+          ("WSDLException: faultCode=OTHER_ERROR: [CORE] SOAP address not found"));
+            */
+
+        } catch (IOException e) {
+            fail(e.getMessage());
+        } finally {
+            if (in != null) {
+                try { in.close(); } catch (Exception e) {}
+            }
+            if (out != null) {
+                try { out.close(); } catch (Exception e) {}
+            }
+            if (socket != null) {
+                try { socket.close(); } catch (Exception e) {}
+            }
+        }
+    }
+
+    public void testHTTP11() throws Exception {
+        URL url = new URL(TEST_CONTAINER.getBaseURL() + 
+                          TestService.SERVICE_PATH);
+        
+        TestServiceAddressingLocator locator = 
+            new TestServiceAddressingLocator();
+        
+        TestPortType port = locator.getTestPortTypePort(url);
+        
+        CreateResourceResponse response = null;
+
+        // force HTTP 1.0 version
+        ((Stub)port)._setProperty(MessageContext.HTTP_TRANSPORT_VERSION,
+                                  HTTPConstants.HEADER_PROTOCOL_V10);
+
+        response = port.createResource(new CreateResource());
+
+        // force HTTP 1.1 version
+        ((Stub)port)._setProperty(MessageContext.HTTP_TRANSPORT_VERSION,
+                                  HTTPConstants.HEADER_PROTOCOL_V11);
+        
+        response = port.createResource(new CreateResource());
+
+        // force HTTP 1.1 chunked encoding
+        Hashtable p = new Hashtable();
+        p.put(HTTPConstants.HEADER_TRANSFER_ENCODING,
+              HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED);
+        ((Stub)port)._setProperty(HTTPConstants.REQUEST_HEADERS,
+                                  p);
+        
+        response = port.createResource(new CreateResource());
+    }
+ 
+    public void testScoping() throws Exception {
+        TestServiceAddressingLocator locator = 
+            new TestServiceAddressingLocator();
+
+        URL url = null;
+        TestPortType port = null;
+
+        // Application scope tests - numInstances should not increase
+        
+        url = new URL(TEST_CONTAINER.getBaseURL() + 
+                      TestService.SERVICE_PATH);
+        
+        port = locator.getTestPortTypePort(url);
+        
+        port.resetNumInstances(null);
+        
+        GetInstanceInfoResponse response = null;
+
+        response = port.getInstanceInfo(null);
+        assertEquals(0, response.getInstances());
+        assertTrue(response.isInitialized());
+
+        response = port.getInstanceInfo(null);
+        assertEquals(0, response.getInstances());
+        assertTrue(response.isInitialized());
+
+        response = port.getInstanceInfo(null);
+        assertEquals(0, response.getInstances());
+        assertTrue(response.isInitialized());
+
+        // Request scope tests - numInstaces should increase
+
+        url = new URL(TEST_CONTAINER.getBaseURL() + 
+                      TestService.SERVICE_PATH + "Request");
+        
+        port = locator.getTestPortTypePort(url);
+
+        port.resetNumInstances(null);
+        
+        response = port.getInstanceInfo(null);
+        assertEquals(1, response.getInstances());
+        assertTrue(response.isInitialized());
+
+        response = port.getInstanceInfo(null);
+        assertEquals(2, response.getInstances());
+        assertTrue(response.isInitialized());
+
+        response = port.getInstanceInfo(null);
+        assertEquals(3, response.getInstances());
+        assertTrue(response.isInitialized());
+    }
+
+    public void testLocalInvocation() throws Exception {
+        URL url = new URL(TEST_CONTAINER.getBaseURL() + 
+                          TestService.SERVICE_PATH);
+        
+        TestServiceAddressingLocator locator = 
+            new TestServiceAddressingLocator();
+        
+        TestPortType port = locator.getTestPortTypePort(url);
+
+        TestLocalInvocation request = 
+            new TestLocalInvocation();
+        port.testLocalInvocation(request);
+    }
+    
+}
+

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/DIITests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/DIITests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/DIITests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,119 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.handlers;
+
+import org.globus.wsrf.impl.TestService;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.net.URL;
+
+import javax.xml.rpc.Call;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
+import javax.xml.rpc.encoding.TypeMapping;
+import javax.xml.rpc.encoding.TypeMappingRegistry;
+import javax.xml.namespace.QName;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.globus.wsrf.test.GridTestCase;
+
+import org.globus.wsrf.tests.basic.CreateResourceResponse;
+
+public class DIITests extends GridTestCase {
+
+    public DIITests(String name) {
+        super(name);
+    }
+
+    /**
+     * Test with JAXRPC DII. Also tests wsdl parsing and retrival via
+     * ?wsdl HTTP GET call.
+     */
+    public void testDII() throws Exception {
+        String wsdlLocation = TEST_CONTAINER.getBaseURL() + 
+            TestService.SERVICE_PATH + "?wsdl";
+        diiTest(wsdlLocation, null);
+    }
+
+    public void diiTest(String wsdlLocation, Map props) throws Exception {
+        String portTypeNS = "http://wsrf.globus.org/tests/basic";
+        String serviceNS = portTypeNS + "/service";
+        String serviceName = "TestService";
+        String portType = "TestPortTypePort";
+
+        ServiceFactory factory = ServiceFactory.newInstance();
+        Service service = factory.createService(new URL(wsdlLocation),
+                                                new QName(serviceNS, 
+                                                          serviceName));
+
+        TypeMappingRegistry registry = service.getTypeMappingRegistry();
+        TypeMapping map = registry.getDefaultTypeMapping();
+
+        QName qname = 
+            new QName("http://wsrf.globus.org/tests/basic", 
+                      "createResourceResponse");
+        Class clazz = CreateResourceResponse.class;
+                                
+        map.register(clazz,
+                     qname,
+                     new org.apache.axis.encoding.ser.BeanSerializerFactory(clazz, qname),
+                     new org.apache.axis.encoding.ser.BeanDeserializerFactory(clazz, qname));
+
+        Call[] calls = service.getCalls(new QName(portTypeNS + "/bindings", 
+                                                  portType));
+        assertTrue(calls != null);
+        assertEquals(10, calls.length);
+
+        boolean found = false;
+        int i = 0;
+        for (i=0;i<calls.length;i++) {
+            System.out.println("A: " + calls[i].getOperationName());
+            if (calls[i].getOperationName().getLocalPart().equals("createResource")) {
+                found = true;
+                break;
+            }
+        }
+
+        assertTrue(found);
+
+        if (props != null) {
+            Iterator iter = props.keySet().iterator();
+            while(iter.hasNext()) {
+                String key = (String)iter.next();
+                Object value = props.get(key);
+                calls[i].setProperty(key, value);
+            }
+        }
+
+        // Shouldn't have to do that....
+        ((org.apache.axis.client.Call)calls[i]).setOperationName(new QName(portTypeNS, "createResource"));
+        ((org.apache.axis.client.Call)calls[i]).setReturnClass(clazz);
+
+        Object ret = calls[i].invoke(new Object[] {});
+
+        System.out.println(ret);
+
+        assertTrue(ret != null);
+        assertTrue(ret instanceof CreateResourceResponse);
+        EndpointReferenceType epr = 
+            ((CreateResourceResponse)ret).getEndpointReference();
+        assertTrue(epr != null);
+        assertTrue("Address field", epr.getAddress() != null);
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/handlers/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,35 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.handlers;
+
+import org.globus.wsrf.test.GridTestSuite;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends GridTestSuite {
+    
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("HandlerTests");
+        suite.addTestSuite(BasicTests.class);
+        suite.addTestSuite(DIITests.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/InvalidateProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/InvalidateProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/InvalidateProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,69 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.rmi.RemoteException;
+
+import org.globus.wsrf.tests.invalidate.InvalidateRequest;
+import org.globus.wsrf.tests.invalidate.InvalidateResponse;
+import org.globus.wsrf.ResourceHome;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.InvalidateResourceMapping;
+
+public class InvalidateProvider
+{
+    public InvalidateResponse invalidate(InvalidateRequest request)
+        throws RemoteException
+    {
+        ResourceHome home = null;
+        ResourceKey key = null;
+
+        try
+        {
+            ResourceContext ctx = ResourceContext.getResourceContext();
+            home = ctx.getResourceHome();
+            key = ctx.getResourceKey();
+        }
+        catch(RemoteException re)
+        {
+            throw re;
+        }
+        catch(Exception e)
+        {
+            throw new RemoteException("", e);
+        }
+
+        if(home instanceof InvalidateResourceMapping)
+        {
+            try 
+            {
+                ((InvalidateResourceMapping) home).invalidate(key);
+            } 
+            catch (Exception e) 
+            {
+                throw new RemoteException("Invalidate failed", e);
+            }
+        }
+        else
+        {
+            throw new RemoteException(
+                "ResourceHome does not implement invalidate method");
+        }
+        
+        return new InvalidateResponse();
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,34 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends TestSuite {
+
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("ImplTests");
+        suite.addTestSuite(SimpleResourceKeyTest.class);
+        suite.addTestSuite(SimpleResourcePropertyTest.class);
+        suite.addTestSuite(ReflectionResourcePropertyTest.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/ReflectionResourcePropertyTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/ReflectionResourcePropertyTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/ReflectionResourcePropertyTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,774 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.Vector;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.Name;
+
+import org.w3c.dom.Element;
+
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourcePropertyMetaData;
+import org.globus.wsrf.encoding.ObjectDeserializer;
+import org.globus.wsrf.encoding.ObjectSerializer;
+
+import junit.framework.TestCase;
+
+// o add test with beans
+public class ReflectionResourcePropertyTest extends TestCase {
+
+    public void testPrimitivesArray() throws Exception {
+        JavaPrimitivesTestClass t = new JavaPrimitivesTestClass();
+        QName propName = new QName("http:/foo", "IntArray");
+
+        ReflectionResourceProperty prop =
+            new ReflectionResourceProperty(propName, t);
+        
+        assertEquals(null, t.getIntArray());
+        assertEquals(0, prop.size());
+
+        Integer testValue1 = new Integer(2);
+        Integer testValue2 = new Integer(3);
+        Integer testValue3 = new Integer(4);
+
+        // test add
+        prop.add(testValue1);
+        prop.add(ObjectSerializer.toElement(testValue2, propName));
+        prop.add(ObjectSerializer.toSOAPElement(testValue3, propName));
+        
+        assertEquals(3, t.getIntArray().length);
+        assertEquals(testValue1.intValue(), t.getIntArray()[0]);
+        assertEquals(testValue2.intValue(), t.getIntArray()[1]);
+        assertEquals(testValue3.intValue(), t.getIntArray()[2]);
+
+        // test get
+        assertEquals(3, prop.size());
+        assertEquals(testValue1, prop.get(0));
+        assertEquals(testValue2, prop.get(1));
+        assertEquals(testValue3, prop.get(2));
+
+        // test set
+        Integer testValue4 = new Integer(5);
+        prop.set(1, testValue4);
+        assertEquals(testValue4.intValue(), t.getIntArray()[1]);
+        assertEquals(testValue4, prop.get(1));
+
+        // test remove
+
+        prop.remove(testValue4);
+        assertEquals(2, prop.size());
+        assertEquals(testValue3.intValue(), t.getIntArray()[1]);
+        assertEquals(testValue3, prop.get(1));
+
+        prop.remove(testValue1);
+        prop.remove(testValue3);
+        assertEquals(0, prop.size());
+
+        // test clear
+        prop.add(testValue1);
+        prop.add(ObjectSerializer.toElement(testValue2, propName));
+        prop.add(ObjectSerializer.toSOAPElement(testValue3, propName));
+        prop.clear();
+        assertEquals(0, prop.size());
+    }
+
+    public void testPrimitives() throws Exception {
+        JavaPrimitivesTestClass t = new JavaPrimitivesTestClass();
+        QName qname;
+        ReflectionResourceProperty prop;
+        Object testObject;
+
+        //======== boolean ==========
+        qname = new QName("http:/foo", "Boolean");
+        prop = new ReflectionResourceProperty(qname, t);
+
+        assertEquals(Boolean.FALSE, prop.get(0));
+
+        boolean testValue1 = true;
+        testObject = new Boolean(testValue1);
+        t.setBoolean(testValue1);
+        assertEquals(testObject, prop.get(0));
+
+        prop.set(0, testObject);
+        assertEquals(new Boolean(t.isBoolean()), prop.get(0));
+
+        //======== char ==========
+        qname = new QName("http:/foo", "Char");
+        prop = new ReflectionResourceProperty(qname, t);
+
+        char testValue2 = 'a';
+        testObject = new Character(testValue2);
+        t.setChar(testValue2);
+        assertEquals(testObject, prop.get(0));
+
+        prop.set(0, testObject);
+        assertEquals(new Character(t.getChar()), prop.get(0));
+
+
+        //======== byte ==========
+        qname = new QName("http:/foo", "Byte");
+        prop = new ReflectionResourceProperty(qname, t);
+
+        byte testValue3 = 20;
+        testObject = new Byte(testValue3);
+        t.setByte(testValue3);
+        assertEquals(testObject, prop.get(0));
+
+        prop.set(0, testObject);
+        assertEquals(new Byte(t.getByte()), prop.get(0));
+
+
+        //======== short ==========
+        qname = new QName("http:/foo", "Short");
+        prop = new ReflectionResourceProperty(qname, t);
+
+        short testValue4 = 5;
+        testObject = new Short(testValue4);
+        t.setShort(testValue4);
+        assertEquals(testObject, prop.get(0));
+
+        prop.set(0, testObject);
+        assertEquals(new Short(t.getShort()), prop.get(0));
+
+
+        //======== int ==========
+        qname = new QName("http:/foo", "Int");
+        prop = new ReflectionResourceProperty(qname, t);
+
+        int testValue5 = 5;
+        testObject = new Integer(testValue5);
+        t.setInt(testValue5);
+        assertEquals(testObject, prop.get(0));
+
+        prop.set(0, testObject);
+        assertEquals(new Integer(t.getInt()), prop.get(0));
+
+
+        //======== long ==========
+        qname = new QName("http:/foo", "Long");
+        prop = new ReflectionResourceProperty(qname, t);
+
+        long testValue6 = 5;
+        testObject = new Long(testValue6);
+        t.setLong(testValue6);
+        assertEquals(testObject, prop.get(0));
+
+        prop.set(0, testObject);
+        assertEquals(new Long(t.getLong()), prop.get(0));
+
+
+        //======== float ==========
+        qname = new QName("http:/foo", "Float");
+        prop = new ReflectionResourceProperty(qname, t);
+
+        float testValue7 = 5;
+        testObject = new Float(testValue7);
+        t.setFloat(testValue7);
+        assertEquals(testObject, prop.get(0));
+
+        prop.set(0, testObject);
+        assertEquals(new Float(t.getFloat()), prop.get(0));
+
+
+        //======== double ==========
+        qname = new QName("http:/foo", "Double");
+        prop = new ReflectionResourceProperty(qname, t);
+
+        double testValue = 5;
+        testObject = new Double(testValue);
+        t.setDouble(testValue);
+        assertEquals(testObject, prop.get(0));
+
+        prop.set(0, testObject);
+        assertEquals(new Double(t.getDouble()), prop.get(0));
+
+
+    }
+
+    public void testSimple() throws Exception {
+        TestClass t = new TestClass();
+        boolean result;
+        QName propBarName = new QName("http:/foo", "Bar");
+        ReflectionResourceProperty propBar =
+            new ReflectionResourceProperty(propBarName, t);
+
+        assertEquals(5, t.getBar());
+        assertEquals(new Integer(5), propBar.get(0));
+        assertEquals(1, propBar.size());
+
+        try {
+            propBar.set(0, new Integer(10));
+            fail("Expected exception");
+        } catch (UnsupportedOperationException e) {
+            // that's cool
+        }
+
+        QName propFooName = new QName("http:/foo", "Foo");
+        ReflectionResourceProperty propFoo =
+            new ReflectionResourceProperty(propFooName, t);
+
+        assertEquals(null, propFoo.get(0));
+        assertEquals(0, propFoo.size());
+
+        String testValue = "abcdef";
+
+        propFoo.set(0, testValue);
+
+        assertEquals(testValue, t.getFoo());
+        assertEquals(testValue, propFoo.get(0));
+        assertEquals(1, propFoo.size());
+
+        propFoo.clear();
+        assertEquals(null, t.getFoo());
+
+        propFoo.set(0, testValue);
+        result =
+            propFoo.remove(testValue);
+        assertEquals(true, result);
+        assertEquals(null, t.getFoo());
+        assertEquals(null, propFoo.get(0));
+
+        result =
+            propFoo.remove(testValue);
+        assertEquals(false, result);
+
+        // test data conversion from Element to String
+        String testValue2 = "123456";
+
+        propFoo.set(0, ObjectSerializer.toElement(testValue2, propFooName));
+        assertEquals(testValue2, t.getFoo());
+        assertEquals(testValue2, propFoo.get(0));
+
+        result =
+            propFoo.remove(
+                ObjectSerializer.toElement(testValue2, propFooName));
+        assertEquals(true, result);
+        assertEquals(null, t.getFoo());
+        assertEquals(null, propFoo.get(0));
+
+        // test data conversion from SOAPElement to String
+        String testValue3 = "123456abcdef";
+
+        propFoo.set(0, ObjectSerializer.toSOAPElement(testValue3, propFooName));
+        assertEquals(testValue3, t.getFoo());
+        assertEquals(testValue3, propFoo.get(0));
+
+        result =
+            propFoo.remove(
+                ObjectSerializer.toSOAPElement(testValue3, propFooName));
+        assertEquals(true, result);
+        assertEquals(null, t.getFoo());
+        assertEquals(null, propFoo.get(0));
+    }
+
+    public void testArray() throws Exception {
+        TestClass t = new TestClass();
+
+        QName propName = new QName("http:/foo", "A");
+        ReflectionResourceProperty prop =
+            new ReflectionResourceProperty(propName, t);
+
+        assertEquals(null, t.getA());
+        assertEquals(0, prop.size());
+
+        String testValue1 = "ABCDE";
+        String testValue2 = "12345";
+        String testValue3 = "45677";
+
+        // test add
+        prop.add(testValue1);
+        prop.add(ObjectSerializer.toElement(testValue2, propName));
+        prop.add(ObjectSerializer.toSOAPElement(testValue3, propName));
+
+        assertEquals(3, t.getA().length);
+        assertEquals(testValue1, t.getA()[0]);
+        assertEquals(testValue2, t.getA()[1]);
+        assertEquals(testValue3, t.getA()[2]);
+
+        // test get
+        assertEquals(3, prop.size());
+        assertEquals(testValue1, prop.get(0));
+        assertEquals(testValue2, prop.get(1));
+        assertEquals(testValue3, prop.get(2));
+
+        // test set
+        String testValue4 = "BLAH";
+        prop.set(1, testValue4);
+        assertEquals(testValue4, t.getA()[1]);
+        assertEquals(testValue4, prop.get(1));
+
+        // test remove
+
+        prop.remove(testValue4);
+        assertEquals(2, prop.size());
+        assertEquals(testValue3, t.getA()[1]);
+        assertEquals(testValue3, prop.get(1));
+
+        prop.remove(testValue1);
+        prop.remove(testValue3);
+        assertEquals(0, prop.size());
+
+        // test clear
+        prop.add(testValue1);
+        prop.add(ObjectSerializer.toElement(testValue2, propName));
+        prop.add(ObjectSerializer.toSOAPElement(testValue3, propName));
+        prop.clear();
+        assertEquals(0, prop.size());
+
+    }
+
+    public void testList() throws Exception {
+        TestClass t = new TestClass();
+
+        QName propName = new QName("http:/foo", "B");
+        SimpleResourcePropertyMetaData metaData = 
+            new SimpleResourcePropertyMetaData(propName, 
+                                               0, Integer.MAX_VALUE,
+                                               false, 
+                                               String.class, 
+                                               false);
+        ReflectionResourceProperty prop =
+            new ReflectionResourceProperty(metaData, t);
+
+        assertEquals(null, t.getB());
+        assertEquals(0, prop.size());
+
+        String testValue1 = "ABCDE";
+        String testValue2 = "12345";
+        String testValue3 = "45677";
+
+        // test add
+        prop.add(testValue1);
+        prop.add(ObjectSerializer.toElement(testValue2, propName));
+        prop.add(ObjectSerializer.toSOAPElement(testValue3, propName));
+
+        assertEquals(3, t.getB().size());
+        assertEquals(testValue1, t.getB().get(0));
+        assertEquals(testValue2, t.getB().get(1));
+        assertEquals(testValue3, t.getB().get(2));
+
+        // test get
+        assertEquals(3, prop.size());
+        assertEquals(testValue1, prop.get(0));
+        assertEquals(testValue2, prop.get(1));
+        assertEquals(testValue3, prop.get(2));
+
+        // test set
+        String testValue4 = "BLAH";
+        prop.set(1, testValue4);
+        assertEquals(testValue4, t.getB().get(1));
+        assertEquals(testValue4, prop.get(1));
+
+        // test remove
+
+        prop.remove(testValue4);
+        assertEquals(2, prop.size());
+        assertEquals(testValue3, t.getB().get(1));
+        assertEquals(testValue3, prop.get(1));
+
+        prop.remove(testValue1);
+        prop.remove(testValue3);
+        assertEquals(0, prop.size());
+
+        // test clear
+        prop.add(testValue1);
+        prop.add(ObjectSerializer.toElement(testValue2, propName));
+        prop.add(ObjectSerializer.toSOAPElement(testValue3, propName));
+        prop.clear();
+        assertEquals(0, prop.size());
+    }
+
+    public void testListMixed() throws Exception {
+        TestClass t = new TestClass();
+
+        QName propName = new QName("http:/foo", "B");
+        ReflectionResourceProperty prop =
+            new ReflectionResourceProperty(propName, t);
+
+        assertEquals(null, t.getB());
+        assertEquals(0, prop.size());
+
+        String testValue1 = "ABCDE";
+        String testValue2 = "12345";
+        String testValue3 = "45677";
+
+        // test add
+        prop.add(testValue1);
+        prop.add(ObjectSerializer.toElement(testValue2, propName));
+        prop.add(ObjectSerializer.toSOAPElement(testValue3, propName));
+
+        assertEquals(3, t.getB().size());
+        assertEquals(testValue1, t.getB().get(0));
+        assertTrue(t.getB().get(1) instanceof Element);
+        assertEquals(testValue2,
+                     ObjectDeserializer.toObject((Element)t.getB().get(1),
+                                                 String.class));
+        assertTrue(t.getB().get(2) instanceof SOAPElement);
+        assertEquals(testValue3,
+                     ObjectDeserializer.toObject((SOAPElement)t.getB().get(2),
+                                                 String.class));
+
+        assertEquals(testValue1, prop.get(0));
+        assertTrue(prop.get(1) instanceof Element);
+        assertEquals(testValue2,
+                     ObjectDeserializer.toObject((Element)prop.get(1),
+                                                 String.class));
+        assertTrue(prop.get(2) instanceof SOAPElement);
+        assertEquals(testValue3,
+                     ObjectDeserializer.toObject((SOAPElement)prop.get(2),
+                                                 String.class));
+
+        // test clear
+        prop.clear();
+        assertEquals(0, prop.size());
+    }
+
+    public void testElementArray() throws Exception {
+        TestClass t = new TestClass();
+
+        QName propName = new QName("http:/foo", "C");
+        ReflectionResourceProperty prop =
+            new ReflectionResourceProperty(propName, t);
+
+        String testValue1 = "ABCDE";
+        String testValue2 = "12345";
+        String testValue3 = "45677";
+
+        // test add
+        prop.add(testValue1);
+        prop.add(ObjectSerializer.toElement(testValue2, propName));
+        prop.add(ObjectSerializer.toSOAPElement(testValue3, propName));
+
+        Element [] el = t.getC();
+        assertEquals(3, el.length);
+        assertEquals(testValue1, el[0].getFirstChild().getNodeValue());
+        assertEquals(testValue2, el[1].getFirstChild().getNodeValue());
+        assertEquals(testValue3, el[2].getFirstChild().getNodeValue());
+    }
+
+    public void testSOAPElementArray() throws Exception {
+        TestClass t = new TestClass();
+
+        QName propName = new QName("http:/foo", "D");
+        ReflectionResourceProperty prop =
+            new ReflectionResourceProperty(propName, t);
+
+        String testValue1 = "ABCDE";
+        String testValue2 = "12345";
+        String testValue3 = "45677";
+
+        // test add
+        prop.add(testValue1);
+        prop.add(ObjectSerializer.toElement(testValue2, propName));
+        prop.add(ObjectSerializer.toSOAPElement(testValue3, propName));
+
+        Element [] el = t.getD();
+        assertEquals(3, el.length);
+
+        for (int i=0;i<el.length;i++) {
+            System.out.println(el[i]);
+        }
+
+        assertTrue(el[0].toString().indexOf(testValue1) != -1);
+        assertTrue(el[1].toString().indexOf(testValue2) != -1);
+        assertTrue(el[2].toString().indexOf(testValue3) != -1);
+    }
+
+    public void testEmptyString() throws Exception {
+        TestClass t = new TestClass();
+
+        QName prop1Name = new QName("http:/foo", "Foo");
+        ReflectionResourceProperty prop1 =
+            new ReflectionResourceProperty(prop1Name, t);
+
+        // test empty string
+        t.setFoo("");
+        Element [] elements = prop1.toElements();
+        assertTrue(elements != null);
+        assertEquals(1, elements.length);
+        assertEquals(0, elements[0].getChildNodes().getLength());
+        SOAPElement [] soapElements = prop1.toSOAPElements();
+        assertTrue(soapElements != null);
+        assertEquals(1, soapElements.length);
+    }
+
+    public void testMinNillable() throws Exception {
+        QName prop1Name = new QName("http:/foo", "Foo");
+        testMinNillable(prop1Name);
+        QName prop2Name = new QName("http:/foo", "A");
+        testMinNillable(prop2Name);
+        QName prop3Name = new QName("http:/foo", "B");
+        testMinNillable(prop3Name);
+    }
+
+    private void testMinNillable(QName propName) 
+        throws Exception {
+        ResourcePropertyMetaData metaData = null;
+        ResourceProperty prop = null;
+        Element [] elements = null;
+        SOAPElement [] soapElements = null;
+        
+        TestClass t = new TestClass();
+        
+        // case 1: returns null if minOccurs == 0
+        metaData = new SimpleResourcePropertyMetaData(propName,
+                                                      0, 
+                                                      Integer.MAX_VALUE, 
+                                                      false, 
+                                                      Object.class, 
+                                                      false);
+        prop = new ReflectionResourceProperty(metaData, t);
+
+        elements = prop.toElements();
+        assertTrue(elements == null);
+        soapElements = prop.toSOAPElements();
+        assertTrue(soapElements == null);
+
+        // case 2: returns null when minOccurs > 0
+        metaData = new SimpleResourcePropertyMetaData(propName,
+                                                      1, 
+                                                      Integer.MAX_VALUE, 
+                                                      false, 
+                                                      Object.class, 
+                                                      false);
+        prop = new ReflectionResourceProperty(metaData, t);
+
+        elements = prop.toElements();
+        assertTrue(elements == null);
+        soapElements = prop.toSOAPElements();
+        assertTrue(soapElements == null);
+        
+        // case 3: returns <Bar xsi:nil="true"/>
+        metaData = new SimpleResourcePropertyMetaData(propName,
+                                                      1, 
+                                                      Integer.MAX_VALUE, 
+                                                      true,
+                                                      Object.class, 
+                                                      false);
+        prop = new ReflectionResourceProperty(metaData, t);
+
+        elements = prop.toElements();
+        assertTrue(elements != null);
+        assertEquals(1, elements.length);
+        assertEquals("true", elements[0].getAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "nil"));
+
+        soapElements = prop.toSOAPElements();
+        assertTrue(soapElements != null);
+        assertEquals(1, soapElements.length);
+        Iterator iter = soapElements[0].getAllAttributes();
+        assertTrue(iter.hasNext());
+        assertEquals("true",
+                     soapElements[0].getAttributeValue((Name)iter.next()));
+    }
+
+    public void testSelfContained() throws Exception {
+        QName name = new QName("http:/foo", "Bar");
+        RP1 propFoo = new RP1(name);
+        
+        assertEquals(null, propFoo.get(0));
+        assertEquals(0, propFoo.size());
+
+        String testValue = "abcdef";
+
+        propFoo.set(0, testValue);
+
+        assertEquals(testValue, propFoo.getFoo());
+        assertEquals(testValue, propFoo.get(0));
+        assertEquals(1, propFoo.size());
+
+        propFoo.clear();
+        assertEquals(null, propFoo.getFoo());
+
+        propFoo.set(0, testValue);
+
+        boolean result;
+
+        result = propFoo.remove(testValue);
+        assertEquals(true, result);
+        assertEquals(null, propFoo.getFoo());
+        assertEquals(null, propFoo.get(0));
+
+        result = propFoo.remove(testValue);
+        assertEquals(false, result);
+    }
+
+    class RP1 extends ReflectionResourceProperty {
+        
+        private String foo;
+
+        public RP1(QName name) throws Exception {
+            super(new SimpleResourcePropertyMetaData(name));
+            // all of these must be called
+            setObject(this);
+            setPropertyName("Foo");
+            initialize();
+        }
+        
+        public String getFoo() {
+            return this.foo;
+        }
+        
+        public void setFoo(String value) {
+            this.foo = value;
+        }
+        
+    }
+
+    class TestClass {
+
+        private String foo;
+        private String [] strArray;
+        private Vector strList;
+        private Element [] elements;
+        private SOAPElement [] soapElements;
+
+        public String getFoo() {
+            return this.foo;
+        }
+
+        public void setFoo(String value) {
+            this.foo = value;
+        }
+
+        public int getBar() {
+            return 5;
+        }
+
+        public String[] getA() {
+            return this.strArray;
+        }
+
+        public void setA(String [] value) {
+            this.strArray = value;
+        }
+
+        public Vector  getB() {
+            return this.strList;
+        }
+
+        public void setB(Vector list) {
+            this.strList = list;
+        }
+
+        public Element[] getC() {
+            return this.elements;
+        }
+
+        public void setC(Element [] value) {
+            this.elements = value;
+        }
+
+        public SOAPElement[] getD() {
+            return this.soapElements;
+        }
+
+        public void setD(SOAPElement [] value) {
+            this.soapElements = value;
+        }
+    }
+
+    class JavaPrimitivesTestClass {
+
+        private boolean booleanP = Boolean.FALSE.booleanValue();
+        private short shortP;
+        private long longP;
+        private int intP;
+        private double doubleP;
+        private float floatP;
+        private byte byteP;
+        private char charP;
+        private int[] intArray;
+
+        public boolean isBoolean() {
+            return this.booleanP;
+        }
+
+        public void setBoolean(boolean value) {
+            this.booleanP = value;
+        }
+
+        public short getShort() {
+            return this.shortP;
+        }
+
+        public void setShort(short value) {
+            this.shortP = value;
+        }
+
+        public long getLong() {
+            return this.longP;
+        }
+
+        public void setLong(long value) {
+            this.longP = value;
+        }
+
+        public int getInt() {
+            return this.intP;
+        }
+
+        public void setInt(int value) {
+            this.intP = value;
+        }
+
+        public double getDouble() {
+            return this.doubleP;
+        }
+
+        public void setDouble(double value) {
+            this.doubleP = value;
+        }
+
+        public float getFloat() {
+            return this.floatP;
+        }
+
+        public void setFloat(float value) {
+            this.floatP = value;
+        }
+
+        public byte getByte() {
+            return this.byteP;
+        }
+
+        public void setByte(byte value) {
+            this.byteP = value;
+        }
+
+        public char getChar() {
+            return this.charP;
+        }
+
+        public void setChar(char value) {
+            this.charP = value;
+        }
+
+        public int[] getIntArray() {
+            return this.intArray;
+        }
+        
+        public void setIntArray(int[] values) {
+            this.intArray = values;
+        }
+        
+    }
+
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/SimpleResourceKeyTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/SimpleResourceKeyTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/SimpleResourceKeyTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+public class SimpleResourceKeyTest extends TestCase {
+
+    public void testHashCodeAndEquals() throws Exception {
+
+        QName name1 = new QName("http://foo", "bar");
+        QName name2 = new QName("http://foo", "bar");
+
+        SimpleResourceKey key1 = new SimpleResourceKey(name1, new Integer(5));
+        SimpleResourceKey key2 = new SimpleResourceKey(name2, new Integer(5));
+        SimpleResourceKey key3 = new SimpleResourceKey(name2, new Integer(6));
+
+        assertTrue(key1.equals(key2));
+        assertTrue(key2.equals(key1));
+        assertEquals(key1.hashCode(), key2.hashCode());
+
+        assertFalse(key2.equals(key3));
+        assertTrue(key2.hashCode() != key3.hashCode());
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/SimpleResourcePropertyTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/SimpleResourcePropertyTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/SimpleResourcePropertyTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,196 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.Name;
+
+import org.w3c.dom.Element;
+
+import org.globus.wsrf.encoding.ObjectSerializer;
+
+import junit.framework.TestCase;
+
+public class SimpleResourcePropertyTest extends TestCase {
+    
+    public void testConverstion() throws Exception {
+        QName propName = new QName("http:/foo", "IntArray");
+
+        SimpleResourcePropertyMetaData metaData = 
+            new SimpleResourcePropertyMetaData(propName,
+                                               1, Integer.MAX_VALUE, false, 
+                                               Integer.class, false);
+        SimpleResourceProperty prop =
+            new SimpleResourceProperty(metaData);
+        
+        assertEquals(0, prop.size());
+
+        Integer testValue1 = new Integer(2);
+        Integer testValue2 = new Integer(3);
+        Integer testValue3 = new Integer(4);
+
+        // test add
+        prop.add(testValue1);
+        prop.add(ObjectSerializer.toElement(testValue2, propName));
+        prop.add(ObjectSerializer.toSOAPElement(testValue3, propName));
+        
+        // test get
+        assertEquals(3, prop.size());
+        assertEquals(testValue1, prop.get(0));
+        assertEquals(testValue2, prop.get(1));
+        assertEquals(testValue3, prop.get(2));
+    }
+
+    public void testNoConverstion() throws Exception {
+        QName propName = new QName("http:/foo", "IntArray");
+
+        SimpleResourceProperty prop =
+            new SimpleResourceProperty(propName);
+        
+        assertEquals(0, prop.size());
+
+        Integer testValue1 = new Integer(2);
+        Integer testValue2 = new Integer(3);
+        Integer testValue3 = new Integer(4);
+
+        // test add
+        prop.add(testValue1);
+        prop.add(ObjectSerializer.toElement(testValue2, propName));
+        prop.add(ObjectSerializer.toSOAPElement(testValue3, propName));
+        
+        // test get
+        assertEquals(3, prop.size());
+        assertEquals(testValue1, prop.get(0));
+        assertTrue(prop.get(1) instanceof Element);
+        assertTrue(prop.get(2) instanceof SOAPElement);
+    }
+
+     public void testReadOnly() throws Exception {
+        QName propName = new QName("http:/foo", "IntArray");
+
+        SimpleResourcePropertyMetaData metaData = 
+            new SimpleResourcePropertyMetaData(propName,
+                                               1, Integer.MAX_VALUE, false, 
+                                               Integer.class, true);
+        SimpleResourceProperty prop =
+            new SimpleResourceProperty(metaData);
+        
+        Integer testValue1 = new Integer(2);
+        prop.add(testValue1);
+
+        prop.setEnableValidation(true);
+        
+        try {
+            prop.add(testValue1);
+            fail("did not throw expected exception");
+        } catch (IllegalStateException e) {
+            // that's what we want
+        }
+
+        try {
+            prop.clear();
+            fail("did not throw expected exception");
+        } catch (IllegalStateException e) {
+            // that's what we want
+        }
+
+        try {
+            prop.remove(new Integer(1));
+            fail("did not throw expected exception");
+        } catch (IllegalStateException e) {
+            // that's what we want
+        }
+
+        try {
+            prop.set(0, new Integer(1));
+            fail("did not throw expected exception");
+        } catch (IllegalStateException e) {
+            // that's what we want
+        }
+
+        prop.setEnableValidation(false);
+
+        prop.add(new Integer(5));
+    }
+
+    public void testMinNillable() throws Exception {
+
+        QName propBarName = new QName("http:/foo", "Bar");
+        SimpleResourcePropertyMetaData metaData = null;
+        SimpleResourceProperty propBar = null;
+        Element [] elements = null;
+        SOAPElement [] soapElements = null;
+        
+        // case 1: returns null if minOccurs == 0
+        metaData = 
+            new SimpleResourcePropertyMetaData(propBarName, 
+                                               0, 
+                                               Integer.MAX_VALUE, 
+                                               false, 
+                                               Object.class, 
+                                               false);
+        propBar = new SimpleResourceProperty(metaData);
+        
+        elements = propBar.toElements();
+        assertTrue(elements == null);
+        soapElements = propBar.toSOAPElements();
+        assertTrue(soapElements == null);
+
+
+        // case 2: returns null even if minOccurs > 0
+        metaData = 
+            new SimpleResourcePropertyMetaData(propBarName,
+                                               1, 
+                                               Integer.MAX_VALUE, 
+                                               false, 
+                                               Object.class, 
+                                               false);
+        propBar = new SimpleResourceProperty(metaData);
+
+        elements = propBar.toElements();
+        assertTrue(elements == null);
+        soapElements = propBar.toSOAPElements();
+        assertTrue(soapElements == null);
+
+
+        // case 3: returns <Bar xsi:nil="true"/>
+        metaData = 
+            new SimpleResourcePropertyMetaData(propBarName,
+                                               1, 
+                                               Integer.MAX_VALUE, 
+                                               true,
+                                               Object.class, 
+                                               false);
+        propBar = new SimpleResourceProperty(metaData);
+        
+        elements = propBar.toElements();
+        assertTrue(elements != null);
+        assertEquals(1, elements.length);
+        assertEquals("true", elements[0].getAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "nil"));
+        
+        soapElements = propBar.toSOAPElements();
+        assertTrue(soapElements != null);
+        assertEquals(1, soapElements.length);
+        Iterator iter = soapElements[0].getAllAttributes();
+        assertTrue(iter.hasNext());
+        assertEquals("true", 
+                     soapElements[0].getAttributeValue((Name)iter.next()));
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/TestHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/TestHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/TestHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/TestResource.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/TestResource.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/TestResource.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,85 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl;
+
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourceProperties;
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.ResourceLifetime;
+
+import java.util.Calendar;
+
+import javax.xml.namespace.QName;
+
+public class TestResource
+    implements Resource,
+               ResourceProperties,
+               ResourceLifetime {
+
+    public static final String TEST_NS =
+        "http://wsrf.globus.org/tests/basic";
+    
+    public static final QName RP_SET =
+        new QName(TEST_NS, "TestRP");
+
+    public static final QName VALUE_RP = 
+        new QName(TEST_NS, "Value");
+    
+    private ResourcePropertySet propSet;
+    private Calendar terminationTime = null;
+    private int[] values = {5};
+
+    public TestResource() throws Exception {
+        this.propSet = new SimpleResourcePropertySet(RP_SET);
+
+        ResourceProperty prop = null;
+
+        prop = new ReflectionResourceProperty(SimpleResourcePropertyMetaData.TERMINATION_TIME, this);
+        this.propSet.add(prop);
+        
+        prop = new ReflectionResourceProperty(SimpleResourcePropertyMetaData.CURRENT_TIME, this);
+        this.propSet.add(prop);
+
+        prop = new ReflectionResourceProperty(VALUE_RP, this);
+        this.propSet.add(prop);
+    }
+
+    public ResourcePropertySet getResourcePropertySet() {
+        return this.propSet;
+    }
+
+    public void setTerminationTime(Calendar time) {
+        this.terminationTime = time;
+    }
+
+    public Calendar getTerminationTime() {
+        return this.terminationTime;
+    }
+
+    public Calendar getCurrentTime() {
+        return Calendar.getInstance();
+    }
+
+    public int[] getValue() {
+        return this.values;
+    }
+
+    public void setValue(int[] newValues) {
+        this.values = newValues;
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/TestService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/TestService.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/TestService.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/DestroyTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/DestroyTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/DestroyTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,84 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.lifetime;
+
+import org.globus.wsrf.impl.TestHome;
+
+import org.globus.wsrf.tests.basic.TestPortType;
+
+import org.oasis.wsrf.lifetime.ResourceUnknownFaultType;
+import org.oasis.wsrf.lifetime.ResourceNotDestroyedFaultType;
+import org.oasis.wsrf.lifetime.Destroy;
+
+public class DestroyTests extends LifetimeTestCase {
+
+    public DestroyTests(String name) {
+        super(name);
+    }
+
+    public void testUnknownResource() throws Exception {
+        TestPortType port = 
+            locator.getTestPortTypePort(createEPR(TestHome.BAD_KEY));
+        
+        try {
+            port.destroy(new Destroy());
+            fail("Did not throw exception");
+        } catch (ResourceUnknownFaultType e) {
+            //it's ok
+        }
+    }
+
+    public void testDestroy() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        // destroy resource
+        port.destroy(new Destroy());
+
+        try {
+            port.destroy(new Destroy());
+            fail("Did not throw exception");
+        } catch (ResourceUnknownFaultType e) {
+            //it's ok
+        }      
+    }
+
+    // right now throw ResourceNotDestroyedFaultType, spec doesn't
+    // define any better error at this point for this case
+    public void testDestroyNoResourceKey() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        try {
+            port.destroy(new Destroy());
+            fail("Did not throw exception");
+        } catch (ResourceNotDestroyedFaultType e) {
+            //it's ok
+        }      
+    }
+    
+    // operation is supported but fails for whatever reason
+    public void testUnsupportedDestroy() throws Exception {
+        TestPortType port = 
+            locator.getTestPortTypePort(createEPR(TestHome.TEST_KEY));
+        
+        try {
+            port.destroy(new Destroy());
+            fail("Did not throw exception");
+        } catch (ResourceNotDestroyedFaultType e) {
+            //it's ok
+        }
+    }
+    
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/LifetimeTestCase.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/LifetimeTestCase.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/LifetimeTestCase.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,81 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.lifetime;
+
+import org.globus.wsrf.impl.TestService;
+
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.tests.basic.service.TestServiceAddressingLocator;
+import org.globus.wsrf.tests.basic.TestPortType;
+
+import org.globus.wsrf.tests.basic.CreateResource;
+import org.globus.wsrf.tests.basic.CreateResourceResponse;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.axis.message.addressing.ReferencePropertiesType;
+import org.apache.axis.types.URI;
+
+import org.globus.wsrf.test.GridTestCase;
+
+public class LifetimeTestCase extends GridTestCase {
+
+    protected TestServiceAddressingLocator locator = 
+        new TestServiceAddressingLocator();
+
+    protected EndpointReferenceType testServiceEPR = null;
+
+    public LifetimeTestCase(String name) {
+        super(name);
+    }
+
+    protected EndpointReferenceType createEPR()
+        throws Exception {
+        return createEPR(null);
+    }
+    
+    protected EndpointReferenceType createEPR(ResourceKey key)
+        throws Exception {
+        String address = 
+            TEST_CONTAINER.getBaseURL() + TestService.SERVICE_PATH;
+        EndpointReferenceType epr = 
+            new EndpointReferenceType(new URI(address));
+
+        if (key != null) {
+            ReferencePropertiesType props = new ReferencePropertiesType();
+            props.add(key.toSOAPElement());
+            epr.setProperties(props);
+        }
+        
+        return epr;
+    }
+
+    protected EndpointReferenceType createResource(TestPortType port)
+        throws Exception {
+        CreateResourceResponse response = 
+            port.createResource(new CreateResource());
+        EndpointReferenceType epr = response.getEndpointReference();
+        assertTrue(epr != null);
+        return epr;
+    }
+
+    protected EndpointReferenceType getServiceAddress() throws Exception {
+        if (this.testServiceEPR == null) {
+            this.testServiceEPR = createEPR();
+        }
+        return this.testServiceEPR;
+    }
+    
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,35 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.lifetime;
+
+import org.globus.wsrf.test.GridTestSuite;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends GridTestSuite {
+
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("LifetimeTests");
+        suite.addTestSuite(DestroyTests.class);
+        suite.addTestSuite(SetTerminationTimeTests.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/SetTerminationTimeTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/SetTerminationTimeTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/lifetime/SetTerminationTimeTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,201 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.lifetime;
+
+import java.util.Calendar;
+
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.impl.TestHome;
+
+import org.apache.axis.message.MessageElement;
+
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.encoding.ObjectDeserializer;
+import org.globus.wsrf.tests.basic.TestPortType;
+
+import org.oasis.wsrf.lifetime.ResourceUnknownFaultType;
+import org.oasis.wsrf.lifetime.SetTerminationTime;
+import org.oasis.wsrf.lifetime.SetTerminationTimeResponse;
+import org.oasis.wsrf.properties.GetResourcePropertyResponse;
+
+import org.globus.wsrf.test.GridTestSuite;
+
+public class SetTerminationTimeTests extends LifetimeTestCase {
+
+    public SetTerminationTimeTests(String name) {
+        super(name);
+    }
+
+    public void testUnknownResource() throws Exception {
+        TestPortType port = 
+            locator.getTestPortTypePort(createEPR(TestHome.BAD_KEY));
+
+        Calendar termTime = Calendar.getInstance();
+        termTime.add(Calendar.SECOND, 30);
+        
+        SetTerminationTime request = new SetTerminationTime();
+        request.setRequestedTerminationTime(termTime);
+
+        try {
+            SetTerminationTimeResponse response =
+                port.setTerminationTime(request);
+
+            fail("Did not throw exception");
+        } catch (ResourceUnknownFaultType e) {
+            //it's ok
+        }
+    }
+
+    public void testTimeInPast() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        Calendar termTime = Calendar.getInstance();
+        termTime.add(Calendar.SECOND, -30);
+
+        SetTerminationTime request = new SetTerminationTime();
+        request.setRequestedTerminationTime(termTime);
+
+        SetTerminationTimeResponse response =
+            port.setTerminationTime(request);
+
+        Calendar newTermTime = response.getNewTerminationTime();
+        Calendar currentTime = response.getCurrentTime();
+
+        // in our impl we newTermTime == currentTime if requested
+        // time was in the past
+        assertTrue(newTermTime != null);
+        assertTrue(currentTime != null);
+        assertTrue(newTermTime.getTime().equals(currentTime.getTime()));
+        
+        try {
+            port.setTerminationTime(request);
+            fail("Did not throw exception");
+        } catch (ResourceUnknownFaultType e) {
+            //it's ok
+        }
+    }
+
+    public void testTimeInFuture() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        Calendar termTime = Calendar.getInstance();
+        termTime.add(Calendar.SECOND, 30);
+
+        SetTerminationTime request = new SetTerminationTime();
+        request.setRequestedTerminationTime(termTime);
+
+        SetTerminationTimeResponse response =
+            port.setTerminationTime(request);
+
+        Calendar newTermTime = response.getNewTerminationTime();
+        Calendar currentTime = response.getCurrentTime();
+
+        // in our impl we newTermTime == currentTime if requested
+        // time was in the past
+        assertTrue(newTermTime != null);
+        assertTrue(currentTime != null);
+        assertTrue(newTermTime.getTime().equals(termTime.getTime()));
+        
+        org.oasis.wsrf.properties.ResourceUnknownFaultType fault = null;
+        int wait = 0;
+        while(wait < GridTestSuite.timeout) {
+            try
+            {
+                assertEquals(newTermTime.getTime(), 
+                             getTerminationTimeRP(port).getTime());
+
+                wait += 1000 * 45;
+                Thread.sleep(1000 * 45);
+            }
+            catch(org.oasis.wsrf.properties.ResourceUnknownFaultType e)
+            {
+                fault = e;
+                break;
+            }
+        }
+
+        assertTrue("timeout or exception not generated", fault != null);
+    }
+
+    private Calendar getTerminationTimeRP(TestPortType port) 
+        throws Exception {
+        GetResourcePropertyResponse propResponse =
+            port.getResourceProperty(WSRFConstants.TERMINATION_TIME);
+        
+        MessageElement [] any = propResponse.get_any();
+        assertTrue(any != null);
+        assertTrue(any.length > 0);
+        
+        Object obj = 
+            ObjectDeserializer.toObject(any[0], Calendar.class);
+        assertTrue(obj instanceof Calendar);
+        
+        return (Calendar)obj;
+    }
+
+    public void testChangeTime() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        Calendar termTime = Calendar.getInstance();
+        termTime.add(Calendar.SECOND, 30);
+        
+        SetTerminationTime request = null;
+        SetTerminationTimeResponse response = null;
+        
+        request = new SetTerminationTime();
+        request.setRequestedTerminationTime(termTime);
+        
+        response = port.setTerminationTime(request);
+
+        Calendar newTermTime = null;
+        Calendar currentTime = null;
+
+        newTermTime = response.getNewTerminationTime();
+        currentTime = response.getCurrentTime();
+        
+        // in our impl we newTermTime == currentTime if requested
+        // time was in the past
+        assertTrue(newTermTime != null);
+        assertTrue(currentTime != null);
+        assertTrue(newTermTime.getTime().equals(termTime.getTime()));
+
+        assertEquals(termTime.getTime(), getTerminationTimeRP(port).getTime());
+
+        // send nill request - no term time
+        
+        request = new SetTerminationTime();
+        response = port.setTerminationTime(request);
+        
+        newTermTime = response.getNewTerminationTime();
+        currentTime = response.getCurrentTime();
+        
+        assertTrue(newTermTime == null);
+        assertTrue(currentTime != null);
+        
+        GetResourcePropertyResponse propResponse =
+            port.getResourceProperty(WSRFConstants.TERMINATION_TIME);
+        
+        MessageElement [] any = propResponse.get_any();
+        assertTrue(any != null);
+        assertTrue(any.length > 0);
+        assertEquals(WSRFConstants.TERMINATION_TIME, any[0].getQName());
+        assertEquals("true", any[0].getAttributeNS(Constants.XSI_NS, "nil"));
+    }
+    
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/GetCurrentMessageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/GetCurrentMessageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/GetCurrentMessageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,144 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import javax.xml.namespace.QName;
+
+import org.globus.wsrf.WSNConstants;
+import org.oasis.wsn.ResourceUnknownFaultType;
+import org.oasis.wsn.NoCurrentMessageOnTopicFaultType;
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.TopicNotSupportedFaultType;
+import org.oasis.wsn.TopicPathDialectUnknownFaultType;
+import org.oasis.wsn.GetCurrentMessage;
+import org.oasis.wsn.GetCurrentMessageResponse;
+
+public class GetCurrentMessageTests extends NotificationTestCase
+{
+    public GetCurrentMessageTests(String name)
+    {
+        super(name);
+    }
+
+    public void testGetCurrentMessage() throws Exception
+    {
+        super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+        GetCurrentMessage request = new GetCurrentMessage();
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopic(topicPath);
+        GetCurrentMessageResponse response = port.getCurrentMessage(request);
+        assertTrue(response.get_any()[0].getLocalName() == "TestNotification" &&
+                   response.get_any()[0].getNamespaceURI() ==
+                   NotificationTestService.TEST_NS);
+    }
+
+    public void testResourceUnknown() throws Exception
+    {
+        ResourceUnknownFaultType fault = null;
+        GetCurrentMessage request = new GetCurrentMessage();
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            new QName("foo"));
+        request.setTopic(topicPath);
+        try
+        {
+            super.badPort.getCurrentMessage(request);
+        }
+        catch(ResourceUnknownFaultType e)
+        {
+            fault = e;
+        }
+        assertTrue(fault != null);
+    }
+
+    public void testUnsupportedTopic() throws Exception
+    {
+        TopicNotSupportedFaultType fault = null;
+        GetCurrentMessage request = new GetCurrentMessage();
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            new QName("foo"));
+        request.setTopic(topicPath);
+        try
+        {
+            super.port.getCurrentMessage(request);
+        }
+        catch(TopicNotSupportedFaultType e)
+        {
+            fault = e;
+        }
+        assertTrue(fault != null);
+    }
+
+    public void testNoCurrentMessage() throws Exception
+    {
+        NoCurrentMessageOnTopicFaultType fault = null;
+        GetCurrentMessage request = new GetCurrentMessage();
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.EMPTY_TOPIC);
+        request.setTopic(topicPath);
+        try
+        {
+            super.port.getCurrentMessage(request);
+        }
+        catch(NoCurrentMessageOnTopicFaultType e)
+        {
+            fault = e;
+        }
+        assertTrue(fault != null);
+    }
+/*
+    public void testInvalidTopicExpression() throws Exception
+    {
+        InvalidTopicExpressionFaultType fault = null;
+        GetCurrentMessage request = new GetCurrentMessage();
+        TopicExpressionType topicPath = new TopicExpressionType(
+            new URI(""),
+            NotificationTestService.EMPTY_TOPIC);
+        request.setTopic(topicPath);
+        try
+        {
+            super.port.getCurrentMessage(request);
+        }
+        catch(InvalidTopicExpressionFaultType e)
+        {
+            fault = e;
+        }
+        assertTrue(fault != null);
+    }
+*/
+    public void testTopicPathDialectUnknown() throws Exception
+    {
+        TopicPathDialectUnknownFaultType fault = null;
+        GetCurrentMessage request = new GetCurrentMessage();
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.CONCRETE_TOPIC_DIALECT,
+            NotificationTestService.EMPTY_TOPIC);
+        request.setTopic(topicPath);
+        try
+        {
+            super.port.getCurrentMessage(request);
+        }
+        catch(TopicPathDialectUnknownFaultType e)
+        {
+            fault = e;
+        }
+        assertTrue(fault != null);
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationConsumerTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationConsumerTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationConsumerTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,202 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.w3c.dom.Element;
+
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.test.GridTestSuite;
+import org.globus.wsrf.tests.notification.NotificationTestPortType;
+import org.globus.wsrf.tests.notification.SelfSubscribeRequest;
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.Subscribe;
+import org.oasis.wsn.SubscribeResponse;
+
+public class NotificationConsumerTests extends NotificationTestCase
+{
+    public NotificationConsumerTests(String name)
+    {
+        super(name);
+    }
+
+    class TestThread extends Thread
+    {
+
+        private NotificationTestPortType port;
+        private boolean stop = false;
+
+        public TestThread(NotificationTestPortType port)
+        {
+            this.port = port;
+        }
+
+        public void kill()
+        {
+            stop = true;
+        }
+
+        public void run()
+        {
+            try
+            {
+                while(!stop)
+                {
+                    Thread.sleep(1000 * 10);
+                    port.generateNotification(
+                        NotificationTestService.FOURTH_TOPIC);
+                }
+            }
+            catch (Exception e)
+            {
+                // ignore errors
+            }
+        }
+    }
+
+
+    public void testServerNotificationConsumerManager() throws Exception
+    {
+         TestThread t = new TestThread(super.port);
+         t.start();
+        SelfSubscribeRequest request = new SelfSubscribeRequest();
+        try
+        {
+            super.port.selfSubscribe(request);
+        }
+        finally
+        {
+            t.kill();
+        }
+    }
+
+    public void testAllCallback() throws Exception
+    {
+        TestNotifyCallback callback = new TestNotifyCallback();
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(callback);
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse subscribeResponse1 = super.port.subscribe(request);
+        super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+
+        assertTrue(callback.waitForCount(1, GridTestSuite.timeout));
+        assertEquals(1, callback.getNotifyCount());
+        assertEquals(NotificationTestService.TEST_TOPIC,
+                     callback.getNotificationTopic());
+        assertEquals(new QName(NotificationTestService.TEST_NS,
+                               "TestNotification"),
+                     new QName(
+                         ((Element) callback.getMessage()).getNamespaceURI(),
+                         ((Element) callback.getMessage()).getLocalName()));
+
+        topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.THIRD_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse subscribeResponse2 = super.port.subscribe(request);
+        super.port.generateNotification(NotificationTestService.THIRD_TOPIC);
+
+        assertTrue(callback.waitForCount(2, GridTestSuite.timeout));
+        assertEquals(2, callback.getNotifyCount());
+        assertEquals(NotificationTestService.THIRD_TOPIC,
+                     callback.getNotificationTopic());
+        assertEquals(new QName(NotificationTestService.TEST_NS,
+                               "TestNotification"),
+                     new QName(
+                         ((Element) callback.getMessage()).getNamespaceURI(),
+                         ((Element) callback.getMessage()).getLocalName()));
+        super.destroySubscription(
+            subscribeResponse1.getSubscriptionReference());
+        super.destroySubscription(
+            subscribeResponse2.getSubscriptionReference());
+    }
+
+    public void testTopicCallback() throws Exception
+    {
+        TestNotifyCallback testCallback = new TestNotifyCallback();
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        List testTopicPath = new LinkedList();
+        testTopicPath.add(NotificationTestService.TEST_TOPIC);
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(testTopicPath,
+                                                testCallback);
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse subscribeResponse1 = super.port.subscribe(request);
+        super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+
+        assertTrue(testCallback.waitForCount(1, GridTestSuite.timeout));
+        assertEquals(1, testCallback.getNotifyCount());
+        assertEquals(NotificationTestService.TEST_TOPIC,
+                     testCallback.getNotificationTopic());
+        assertEquals(
+            new QName(NotificationTestService.TEST_NS,
+                      "TestNotification"),
+            new QName(
+                ((Element) testCallback.getMessage()).getNamespaceURI(),
+                ((Element) testCallback.getMessage()).getLocalName()));
+
+        List thirdTopicPath = new LinkedList();
+        thirdTopicPath.add(NotificationTestService.THIRD_TOPIC);
+        TestNotifyCallback thirdCallback = new TestNotifyCallback();
+        consumerEPR =
+            consumer.createNotificationConsumer(thirdTopicPath,
+                                                thirdCallback);
+        request.setConsumerReference(consumerEPR);
+        topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.THIRD_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse subscribeResponse2 = super.port.subscribe(request);
+        super.port.generateNotification(NotificationTestService.THIRD_TOPIC);
+
+        assertTrue(thirdCallback.waitForCount(1, GridTestSuite.timeout));
+        assertEquals(1, thirdCallback.getNotifyCount());
+        assertEquals(NotificationTestService.THIRD_TOPIC,
+                     thirdCallback.getNotificationTopic());
+        assertEquals(
+            new QName(NotificationTestService.TEST_NS,
+                      "TestNotification"),
+            new QName(
+                ((Element) thirdCallback.getMessage()).getNamespaceURI(),
+                ((Element) thirdCallback.getMessage()).getLocalName()));
+        super.destroySubscription(
+            subscribeResponse1.getSubscriptionReference());
+        super.destroySubscription(
+            subscribeResponse2.getSubscriptionReference());
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationProducerRPTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationProducerRPTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationProducerRPTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,90 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import org.apache.axis.Constants;
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.types.URI;
+
+import org.globus.wsrf.WSNConstants;
+import org.oasis.wsrf.properties.GetResourcePropertyResponse;
+
+public class NotificationProducerRPTests extends NotificationTestCase
+{
+    public NotificationProducerRPTests(String name)
+    {
+        super(name);
+    }
+
+    public void testGetTopics() throws Exception
+    {
+        boolean foundEmptyTopic = false;
+        boolean foundTestTopic = false;
+        boolean foundThirdTopic = false;
+        GetResourcePropertyResponse response =
+            super.port.getResourceProperty(WSNConstants.TOPIC);
+        MessageElement[] topics = response.get_any();
+        assertEquals(7, topics.length);
+        for(int i = 0; i < topics.length; i++)
+        {
+            MessageElement topic = topics[i];
+            assertEquals(topic.getQName(), WSNConstants.TOPIC);
+            if(topic.getValueAsType(Constants.XSD_QNAME).equals(
+                NotificationTestService.EMPTY_TOPIC))
+            {
+                foundEmptyTopic = true;
+            }
+            if(topic.getValueAsType(Constants.XSD_QNAME).equals(
+                NotificationTestService.TEST_TOPIC))
+            {
+                foundTestTopic = true;
+            }
+            if(topic.getValueAsType(Constants.XSD_QNAME).equals(
+                NotificationTestService.THIRD_TOPIC))
+            {
+                foundThirdTopic = true;
+            }
+        }
+        assertTrue(foundEmptyTopic);
+        assertTrue(foundTestTopic);
+        assertTrue(foundThirdTopic);
+    }
+
+    public void testGetFixedTopicSet() throws Exception
+    {
+        GetResourcePropertyResponse response =
+            super.port.getResourceProperty(WSNConstants.FIXED_TOPIC_SET);
+        MessageElement[] topics = response.get_any();
+        assertEquals(1, topics.length);
+        MessageElement topic = topics[0];
+        assertEquals(WSNConstants.FIXED_TOPIC_SET, topic.getQName());
+        assertEquals(true, ((Boolean) topic.getValueAsType(
+            Constants.XSD_BOOLEAN)).booleanValue());
+    }
+
+    public void testGetDialects() throws Exception
+    {
+        GetResourcePropertyResponse response =
+            super.port.getResourceProperty(
+                WSNConstants.TOPIC_EXPRESSION_DIALECTS);
+        MessageElement[] topics = response.get_any();
+        assertEquals(1, topics.length);
+        MessageElement topic = topics[0];
+        assertEquals(WSNConstants.TOPIC_EXPRESSION_DIALECTS, topic.getQName());
+        assertEquals(WSNConstants.SIMPLE_TOPIC_DIALECT, 
+                     ((URI)topic.getValueAsType(Constants.XSD_ANYURI)).toString());
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestCase.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestCase.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestCase.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,121 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.rmi.RemoteException;
+
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.Stub;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.oasis.wsrf.lifetime.Destroy;
+
+import org.globus.wsrf.core.notification.service.SubscriptionManagerServiceAddressingLocator;
+import org.globus.wsrf.core.notification.SubscriptionManager;
+import org.globus.wsrf.test.GridTestCase;
+import org.globus.wsrf.tests.notification.NotificationTestPortType;
+import org.globus.wsrf.tests.notification.service.NotificationTestServiceAddressingLocator;
+import org.globus.wsrf.utils.AddressingUtils;
+import org.globus.wsrf.impl.security.descriptor.ClientSecurityDescriptor;
+import org.globus.wsrf.impl.security.authentication.Constants;
+import org.globus.wsrf.impl.security.authorization.SelfAuthorization;
+import org.globus.wsrf.impl.security.authorization.HostAuthorization;
+
+import org.globus.wsrf.impl.security.TestConstants;
+
+public class NotificationTestCase extends GridTestCase
+{
+    protected EndpointReferenceType testServiceEPR = null;
+    protected EndpointReferenceType badEPR = null;
+    protected NotificationTestServiceAddressingLocator notificationTestLocator =
+        new NotificationTestServiceAddressingLocator();
+    protected NotificationTestPortType port = null;
+    protected NotificationTestPortType badPort = null;
+    protected SubscriptionManagerServiceAddressingLocator managerLocator =
+        new SubscriptionManagerServiceAddressingLocator();
+
+    public NotificationTestCase(String name)
+    {
+        super(name);
+    }
+
+    protected void setAddress() throws Exception
+    {
+        String notificationTestServiceAddress =
+            TEST_CONTAINER.getBaseURL() +
+            NotificationTestService.SERVICE_PATH;
+        this.testServiceEPR = AddressingUtils.createEndpointReference(
+            notificationTestServiceAddress,
+            NotificationTestHome.GOOD_KEY
+        );
+
+        this.badEPR = AddressingUtils.createEndpointReference(
+            notificationTestServiceAddress,
+            NotificationTestHome.BAD_KEY
+        );
+    }
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        setAddress();
+        this.port =
+            notificationTestLocator.getNotificationTestPortTypePort(
+                this.testServiceEPR);
+        this.badPort =
+            notificationTestLocator.getNotificationTestPortTypePort(
+                this.badEPR);
+    }
+
+    protected void destroySubscription(
+        EndpointReferenceType subscriptionEPR, ClientSecurityDescriptor desc)
+        throws ServiceException, RemoteException
+    {
+        SubscriptionManager manager =
+            this.managerLocator.getSubscriptionManagerPort(subscriptionEPR);
+        if(desc != null)
+        {
+            ((Stub) manager)._setProperty(Constants.CLIENT_DESCRIPTOR, desc);
+        }
+        manager.destroy(new Destroy());
+    }
+
+    protected void destroySubscription(EndpointReferenceType subscriptionEPR)
+        throws ServiceException, RemoteException
+    {
+        destroySubscription(subscriptionEPR, (ClientSecurityDescriptor) null);
+    }
+
+    protected void destroySubscription(EndpointReferenceType subscriptionEPR,
+                                       String msgType)
+        throws ServiceException, RemoteException
+    {
+        ClientSecurityDescriptor desc = new ClientSecurityDescriptor();
+        desc.setAuthz(TestConstants.getConfiguredClientAuthz());
+        if(msgType.equals(Constants.GSI_SEC_CONV))
+        {
+            desc.setGSISecureConv(Constants.SIGNATURE);
+        }
+        else if(msgType.equals(Constants.GSI_SEC_MSG))
+        {
+            desc.setGSISecureMsg(Constants.SIGNATURE);
+        }
+
+        destroySubscription(subscriptionEPR, desc);
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestResource.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestResource.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestResource.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,257 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.rmi.RemoteException;
+import java.util.Calendar;
+
+import org.oasis.wsrf.faults.BaseFaultType;
+
+import org.globus.wsrf.InvalidResourceKeyException;
+import org.globus.wsrf.NoSuchResourceException;
+import org.globus.wsrf.PersistentResource;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.ResourceProperties;
+import org.globus.wsrf.ResourceProperty;
+import org.globus.wsrf.ResourcePropertySet;
+import org.globus.wsrf.Topic;
+import org.globus.wsrf.TopicList;
+import org.globus.wsrf.TopicListAccessor;
+import org.globus.wsrf.impl.ReflectionResourceProperty;
+import org.globus.wsrf.impl.ResourcePropertyTopic;
+import org.globus.wsrf.impl.SimpleResourceProperty;
+import org.globus.wsrf.impl.SimpleResourcePropertySet;
+import org.globus.wsrf.impl.SimpleTopic;
+import org.globus.wsrf.impl.SimpleTopicList;
+import org.globus.wsrf.impl.SimpleTopicListMetaData;
+import org.globus.wsrf.tests.notification.JobStatusType;
+import org.globus.wsrf.utils.FilePersistenceHelper;
+import org.globus.wsrf.utils.SubscriptionPersistenceUtils;
+
+public class NotificationTestResource implements ResourceProperties,
+                                                 TopicListAccessor,
+                                                 PersistentResource
+{
+    private TopicList topicList;
+    private ResourcePropertySet propSet;
+    private JobStatusType jobStatus;
+    private Topic jobStatusTopic = null;
+    private FilePersistenceHelper persistenceHelper;
+    private Integer id = null;
+    private static final String FILE_SUFFIX = ".obj";
+
+    protected Topic getJobStatusTopic()
+    {
+        return this.jobStatusTopic;
+    }
+
+    public NotificationTestResource() throws RemoteException
+    {
+        this.propSet = new SimpleResourcePropertySet(
+            NotificationTestService.RP_SET);
+        jobStatus = new JobStatusType();
+        jobStatus.setJobState(NotificationTestService.JOB_STATUS_ACTIVE);
+        BaseFaultType fault = new BaseFaultType();
+        fault.setTimestamp(Calendar.getInstance());
+        jobStatus.setFault(fault);
+        try
+        {
+            this.jobStatusTopic = new ResourcePropertyTopic(new ReflectionResourceProperty(
+                NotificationTestService.JOB_STATUS_TOPIC_RP,
+                "JobStatus",
+                this));
+            this.propSet.add(new ResourcePropertyTopic(new SimpleResourceProperty(
+                NotificationTestService.AUTO_NOTIFY_TOPIC_RP)));
+            this.propSet.add(new ResourcePropertyTopic(new ReflectionResourceProperty(
+                NotificationTestService.SEND_OLD_TOPIC_RP,
+                "SendOldValue",
+                this.propSet.get(NotificationTestService.AUTO_NOTIFY_TOPIC_RP))));
+        }
+        catch(Exception e)
+        {
+            throw new RemoteException("", e);
+        }
+        ((ResourcePropertyTopic) this.jobStatusTopic).setAutoNotify(false);
+        this.propSet.add((ResourceProperty) this.jobStatusTopic);
+        
+        SimpleTopicListMetaData metaData = 
+            new SimpleTopicListMetaData(true);
+        this.topicList = new SimpleTopicList(this, metaData);
+
+        this.topicList.addTopic(new SimpleTopic(
+            NotificationTestService.TEST_TOPIC));
+        this.topicList.addTopic(new SimpleTopic(
+            NotificationTestService.EMPTY_TOPIC));
+        this.topicList.addTopic(new SimpleTopic(
+            NotificationTestService.THIRD_TOPIC));
+        this.topicList.addTopic(new SimpleTopic(
+            NotificationTestService.FOURTH_TOPIC));
+        this.topicList.addTopic(this.jobStatusTopic);
+        this.topicList.addTopic((Topic) this.propSet.get(
+            NotificationTestService.AUTO_NOTIFY_TOPIC_RP));
+        this.topicList.addTopic((Topic) this.propSet.get(
+            NotificationTestService.SEND_OLD_TOPIC_RP));
+    }
+
+    public ResourcePropertySet getResourcePropertySet()
+    {
+        return this.propSet;
+    }
+
+    public TopicList getTopicList()
+    {
+        return this.topicList;
+    }
+
+    public JobStatusType getJobStatus()
+    {
+        return jobStatus;
+    }
+
+    public void setJobStatus(JobStatusType jobStatus)
+    {
+        this.jobStatus = jobStatus;
+        try
+        {
+            this.store();
+        }
+        catch(ResourceException e)
+        {
+            throw new RuntimeException(e.toString());
+        }
+    }
+
+    public void load(ResourceKey key) throws ResourceException,
+                                             NoSuchResourceException,
+                                             InvalidResourceKeyException
+    {
+        this.id = (Integer) key.getValue();
+        File file = getPersistenceHelper().getKeyAsFile(this.id);
+        if(!file.exists())
+        {
+            throw new NoSuchResourceException();
+        }
+        FileInputStream fis = null;
+
+        try
+        {
+            fis = new FileInputStream(file);
+            ObjectInputStream ois = new ObjectInputStream(fis);
+            this.jobStatus = (JobStatusType) ois.readObject();
+            SubscriptionPersistenceUtils.loadSubscriptionListeners(
+                this.getTopicList(), ois);
+        }
+        catch(Exception e)
+        {
+            throw new ResourceException("Failed to load resource", e);
+        }
+        finally
+        {
+            if(fis != null)
+            {
+                try
+                {
+                    fis.close();
+                }
+                catch(Exception ee)
+                {
+                }
+            }
+        }
+    }
+
+    public synchronized void store() throws ResourceException
+    {
+        FileOutputStream fos = null;
+        File tmpFile = null;
+        try
+        {
+            tmpFile = File.createTempFile(
+                "notificationTestResource", ".tmp",
+                getPersistenceHelper().getStorageDirectory());
+            fos = new FileOutputStream(tmpFile);
+            ObjectOutputStream oos = new ObjectOutputStream(fos);
+            oos.writeObject(this.jobStatus);
+            SubscriptionPersistenceUtils.storeSubscriptionListeners(
+                this.getTopicList(), oos);
+        }
+        catch(Exception e)
+        {
+            tmpFile.delete();
+            throw new ResourceException("Failed to store resource", e);
+        }
+        finally
+        {
+            if(fos != null)
+            {
+                try
+                {
+                    fos.close();
+                }
+                catch(Exception ee)
+                {
+                }
+            }
+        }
+
+        File file = getPersistenceHelper().getKeyAsFile(this.id);
+        if (file.exists()) {
+            file.delete();
+        }
+        if (!tmpFile.renameTo(file)) {
+            tmpFile.delete();
+            throw new ResourceException("Failed to store resource");
+        }
+    }
+
+    public Object getID()
+    {
+        return this.id;
+    }
+
+    protected void setID(Integer id)
+    {
+        this.id = id;
+    }
+
+    public void remove() throws ResourceException
+    {
+        getPersistenceHelper().remove(this.id);
+    }
+
+    protected synchronized FilePersistenceHelper getPersistenceHelper()
+    {
+        if(this.persistenceHelper == null)
+        {
+            try
+            {
+                this.persistenceHelper = new FilePersistenceHelper(getClass(),
+                                                                   FILE_SUFFIX);
+            }
+            catch(Exception e)
+            {
+                throw new RuntimeException(e.getMessage());
+            }
+        }
+        return this.persistenceHelper;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestService.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTestService.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,212 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.rmi.RemoteException;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.oasis.wsn.ResourceUnknownFaultType;
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.Subscribe;
+import org.oasis.wsn.SubscribeResponse;
+import org.oasis.wsrf.lifetime.Destroy;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.Topic;
+import org.globus.wsrf.TopicList;
+import org.globus.wsrf.TopicListAccessor;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.container.ContainerException;
+import org.globus.wsrf.container.ServiceHost;
+import org.globus.wsrf.core.notification.SubscriptionManager;
+import org.globus.wsrf.core.notification.service.SubscriptionManagerServiceAddressingLocator;
+import org.globus.wsrf.test.GridTestSuite;
+import org.globus.wsrf.tests.notification.NotificationTestPortType;
+import org.globus.wsrf.tests.notification.SelfSubscribeRequest;
+import org.globus.wsrf.tests.notification.SelfSubscribeResponse;
+import org.globus.wsrf.tests.notification.GenerateNotificationResponse;
+import org.globus.wsrf.tests.notification.service.NotificationTestServiceAddressingLocator;
+import org.globus.wsrf.utils.AddressingUtils;
+import org.globus.wsrf.utils.XmlUtils;
+
+public class NotificationTestService
+{
+    public static final String SERVICE_PATH =
+        "NotificationTestService";
+    public static final String TEST_NS =
+        "http://wsrf.globus.org/tests/notification";
+    public static final QName RP_SET =
+        new QName(TEST_NS, "NotificationTestRP");
+    public static final QName TEST_TOPIC =
+        new QName(TEST_NS, "TestTopic");
+    public static final QName EMPTY_TOPIC =
+        new QName(TEST_NS, "EmptyTopic");
+    public static final QName THIRD_TOPIC =
+        new QName(TEST_NS, "ThirdTopic");
+    public static final QName FOURTH_TOPIC =
+        new QName(TEST_NS, "FourthTopic");
+    public static final QName JOB_STATUS_TOPIC_RP =
+        new QName(TEST_NS, "JobStatusRP");
+    public static final QName AUTO_NOTIFY_TOPIC_RP =
+        new QName(TEST_NS, "AutoNotifyTopicRP");
+    public static final QName SEND_OLD_TOPIC_RP =
+        new QName(TEST_NS, "SendOldTopicRP");
+    public static final String JOB_STATUS_ACTIVE =
+        "Active";
+    public static final String JOB_STATUS_DONE =
+        "Done";
+
+    public GenerateNotificationResponse generateNotification(
+        QName request)
+        throws RemoteException,
+               ResourceUnknownFaultType
+    {
+        Object resource = null;
+        try
+        {
+            resource = ResourceContext.getResourceContext().getResource();
+        }
+        catch(RemoteException e)
+        {
+            throw e;
+        }
+        catch(Exception e)
+        {
+            throw new RemoteException("", e);
+        }
+
+        TopicList topicList;
+        Element message;
+        NotificationTestResource r = (NotificationTestResource)resource;
+
+        topicList = ((TopicListAccessor) resource).getTopicList();
+        //TODO: Work around Axis bug
+        if(request.getNamespaceURI().equals(""))
+        {
+            request = new QName(TEST_NS, request.getLocalPart());
+        }
+        List topicPath = new LinkedList();
+        topicPath.add(request);
+        Topic topic = topicList.getTopic(topicPath);
+        try
+        {
+            Document document = XmlUtils.newDocument();
+            if(topic.equals(r.getJobStatusTopic()))
+            {
+                r.getJobStatus().setJobState(JOB_STATUS_DONE);
+            }
+            message = document.createElementNS(
+                TEST_NS,
+                "test:TestNotification");
+            topic.notify(message);
+        }
+        catch(Exception e)
+        {
+            throw new RemoteException("", e);
+        }
+        return new GenerateNotificationResponse();
+    }
+
+    public SelfSubscribeResponse selfSubscribe(SelfSubscribeRequest req)
+        throws RemoteException
+    {
+
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+
+        if (!(consumer instanceof ServerNotificationConsumerManager))
+        {
+            throw new RemoteException("Invalid notification consumer manager");
+        }
+
+        try
+        {
+            consumer.startListening();
+        }
+        catch (Exception e)
+        {
+            throw new RemoteException("Failed to start consumer manager", e);
+        }
+
+        NotificationTestServiceAddressingLocator notificationTestLocator =
+            new NotificationTestServiceAddressingLocator();
+
+        SubscriptionManagerServiceAddressingLocator managerLocator =
+            new SubscriptionManagerServiceAddressingLocator();
+
+        try
+        {
+            TestNotifyCallback testCallback = new TestNotifyCallback();
+            EndpointReferenceType consumerEPR =
+                consumer.createNotificationConsumer(testCallback);
+            EndpointReferenceType epr =
+                AddressingUtils.createEndpointReference(
+                      ServiceHost.getBaseURL() + SERVICE_PATH,
+                      NotificationTestHome.GOOD_KEY
+            );
+            NotificationTestPortType port =
+                notificationTestLocator.getNotificationTestPortTypePort(epr);
+            Subscribe request = new Subscribe();
+            request.setConsumerReference(consumerEPR);
+            TopicExpressionType topicPath =
+                new TopicExpressionType(WSNConstants.SIMPLE_TOPIC_DIALECT,
+                                        FOURTH_TOPIC);
+            request.setTopicExpression(topicPath);
+            SubscribeResponse response = port.subscribe(request);
+
+            if (!testCallback.waitForCount(1, GridTestSuite.timeout))
+            {
+                throw new Exception("timeout");
+            }
+            if (testCallback.getNotifyCount() != 1)
+            {
+                throw new Exception("expected one notification but got: " +
+                                    testCallback.getNotifyCount());
+            }
+
+            SubscriptionManager manager =
+                managerLocator.getSubscriptionManagerPort(
+                    response.getSubscriptionReference());
+            manager.destroy(new Destroy());
+        }
+        catch (Exception e)
+        {
+            throw new RemoteException("Subscribe failed", e);
+        }
+        finally
+        {
+            try
+            {
+                consumer.stopListening();
+            }
+            catch (ContainerException e)
+            {
+                throw new RemoteException("Failed to stop consumer manager", e);
+            }
+        }
+
+        return new SelfSubscribeResponse();
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotificationTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,113 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.oasis.wsrf.lifetime.Destroy;
+import org.oasis.wsn.Subscribe;
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.SubscribeResponse;
+
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.core.notification.SubscriptionManager;
+import org.globus.wsrf.test.GridTestSuite;
+
+public class NotificationTests extends NotificationTestCase {
+
+    public NotificationTests(String name) {
+        super(name);
+    }
+
+   public void testMultipleNotifications() throws Exception {
+        TestNotifyCallback callback = new TestNotifyCallback();
+        int expectedCount = 1;
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(callback);
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse response = super.port.subscribe(request);
+        for(int i = 0; i < 10; i++) {
+            super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+            assertTrue("timed out waiting for notification #" + expectedCount,
+                       callback.waitForCount(expectedCount, GridTestSuite.timeout));
+            assertEquals(expectedCount, callback.getNotifyCount());
+            expectedCount++;
+        }
+        SubscriptionManager manager =
+            this.managerLocator.getSubscriptionManagerPort(
+                response.getSubscriptionReference());
+        manager.destroy(new Destroy());
+    }
+
+    public void testMultithreadedNotifications() throws Exception {
+
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+
+        Object lock = new Object();
+
+        int size = 10;
+        NotifyThread [] threads = new NotifyThread[size];
+        for (int i=0;i<size;i++) {
+            threads[i] = new NotifyThread(testServiceEPR, consumer, 
+                                          lock, null);
+            threads[i].start();
+        }
+
+        for (int i=0;i<size;i++) {
+            while( !threads[i].isSubscribed() ) {
+                Throwable e = threads[i].getException();
+                if (e != null) {
+                    fail(e.getMessage());
+                }
+                Thread.sleep(100);
+            }
+        }
+            
+        synchronized(lock) {
+            lock.notifyAll();
+        }
+        
+        super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+
+        Throwable e = null;
+
+        for (int i=0;i<size;i++) {
+            threads[i].join();
+            if (threads[i].getException() != null) {
+                threads[i].getException().printStackTrace();
+                if (e == null) {
+                    e = threads[i].getException();
+                }
+            }
+        }
+
+        if (e != null) {
+            fail(e.getMessage());
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotifyThread.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotifyThread.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/NotifyThread.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,121 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import org.oasis.wsrf.lifetime.Destroy;
+import org.oasis.wsn.Subscribe;
+import org.oasis.wsn.SubscribeResponse;
+import org.oasis.wsn.TopicExpressionType;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import javax.xml.rpc.Stub;
+
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.core.notification.SubscriptionManager;
+import org.globus.wsrf.security.Constants;
+import org.globus.wsrf.impl.security.descriptor.ClientSecurityDescriptor;
+import org.globus.wsrf.tests.notification.NotificationTestPortType;
+import org.globus.wsrf.tests.notification.service.NotificationTestServiceAddressingLocator;
+import org.globus.wsrf.core.notification.service.SubscriptionManagerServiceAddressingLocator;
+import org.globus.wsrf.test.GridTestSuite;
+
+public class NotifyThread extends Thread {
+
+    SubscriptionManagerServiceAddressingLocator managerLocator =
+        new SubscriptionManagerServiceAddressingLocator();
+
+    EndpointReferenceType epr;
+    NotificationConsumerManager consumer;
+    ClientSecurityDescriptor secDesc;
+    Object lock;
+
+    Throwable exception;
+    boolean subscribed = false;
+
+    public NotifyThread(EndpointReferenceType epr,
+                        NotificationConsumerManager consumer,
+                        Object lock,
+                        ClientSecurityDescriptor secDesc) {
+        this.consumer = consumer;
+        this.lock = lock;
+        this.secDesc = secDesc;
+        this.epr = epr;
+    }
+        
+    public boolean isSubscribed() {
+        return this.subscribed;
+    }
+
+    public Throwable getException() {
+        return this.exception;
+    }
+
+    public void run() {
+        try {
+            TestNotifyCallback callback = new TestNotifyCallback();
+            EndpointReferenceType consumerEPR =
+                consumer.createNotificationConsumer(callback);
+
+            Subscribe request = new Subscribe();
+            request.setConsumerReference(consumerEPR);
+            TopicExpressionType topicPath = 
+                new TopicExpressionType(
+                                        WSNConstants.SIMPLE_TOPIC_DIALECT,
+                                        NotificationTestService.TEST_TOPIC);
+            request.setTopicExpression(topicPath);
+            
+            NotificationTestServiceAddressingLocator locator =
+                new NotificationTestServiceAddressingLocator();
+            NotificationTestPortType port = 
+                locator.getNotificationTestPortTypePort(epr);
+            if (this.secDesc != null) {
+                ((Stub) port)._setProperty(Constants.CLIENT_DESCRIPTOR, 
+                                           this.secDesc);
+            }
+            SubscribeResponse response = port.subscribe(request);
+            
+            this.subscribed = true;
+            synchronized (lock) {
+                lock.wait();
+            }
+            
+            int expectedCount = 1;
+            if (!callback.waitForCount(expectedCount, 
+                                       GridTestSuite.timeout)) {
+                throw new Exception("Timeout waiting for notifcations");
+            }
+            
+            if (expectedCount != callback.getNotifyCount()) {
+                throw new Exception("Expected " + expectedCount + 
+                                    " notifications but received " + 
+                                    callback.getNotifyCount());
+            }
+            
+            SubscriptionManager manager =
+                managerLocator.getSubscriptionManagerPort(response.getSubscriptionReference());
+            if (this.secDesc != null) {
+                ((Stub) manager)._setProperty(Constants.CLIENT_DESCRIPTOR, 
+                                              this.secDesc);
+            }
+            manager.destroy(new Destroy());
+        } catch (Throwable e) {
+            this.exception = e;
+        }
+    }
+    
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,43 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import org.globus.wsrf.test.GridTestSuite;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends GridTestSuite
+{
+    public PackageTests(String name)
+    {
+        super(name);
+    }
+
+    public static Test suite() throws Exception
+    {
+        TestSuite suite = new PackageTests("NotificationTests");
+        suite.addTestSuite(GetCurrentMessageTests.class);
+        suite.addTestSuite(SubscribeTests.class);
+        suite.addTestSuite(NotificationProducerRPTests.class);
+        suite.addTestSuite(SubscriptionManagerTests.class);
+        suite.addTestSuite(NotificationConsumerTests.class);
+        suite.addTestSuite(ResourcePropertyNotificationTests.class);
+        suite.addTestSuite(NotificationTests.class);
+        suite.addTestSuite(PersistentSubscriptionTests.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistenceTestSubscribeProvider.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistenceTestSubscribeProvider.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistenceTestSubscribeProvider.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,36 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import org.oasis.wsn.Subscribe;
+
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.ResourceKey;
+
+public class PersistenceTestSubscribeProvider extends SubscribeProvider
+{
+    protected SubscribeHelper getSubscribeHelper(
+        ResourceContext context, Resource producerResource,
+        ResourceKey producerKey, String producerHomeLocation,
+        Subscribe request)
+    {
+        return new PersistentSubscribeHelper(
+            context, producerResource, producerKey,
+            producerHomeLocation, request);
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistenceTestSubscriptionHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistenceTestSubscriptionHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistenceTestSubscriptionHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,48 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import org.globus.wsrf.InvalidateResourceMapping;
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.ResourceException;
+import org.globus.wsrf.container.Lock;
+import org.globus.wsrf.container.LockManager;
+
+public class PersistenceTestSubscriptionHome extends SubscriptionHome
+    implements InvalidateResourceMapping
+{
+
+    public void invalidate(ResourceKey key) throws ResourceException
+    {
+        Lock lock = this.lockManager.getLock(key);
+        try 
+        {
+            lock.acquire();
+        } 
+        catch (InterruptedException e) 
+        {
+            throw new ResourceException(e);
+        }
+        try 
+        {
+            this.resources.remove(key);
+        }
+        finally 
+        {
+            lock.release();
+        }
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistentSubscribeHelper.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistentSubscribeHelper.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistentSubscribeHelper.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import org.oasis.wsn.Subscribe;
+
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.Resource;
+import org.globus.wsrf.ResourceKey;
+
+public class PersistentSubscribeHelper extends SubscribeHelper
+{
+    public PersistentSubscribeHelper(
+        ResourceContext context, Resource producerResource,
+        ResourceKey producerKey,
+        String producerHomeLocation,
+        Subscribe request)
+    {
+        super(context, producerResource, producerKey, producerHomeLocation,
+              request);
+    }
+
+    protected String getSubscriptionManagerServiceName()
+    {
+        return "PersistenceTestSubscriptionManager";
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistentSubscriptionTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistentSubscriptionTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/PersistentSubscriptionTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,163 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.util.Calendar;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.oasis.wsn.Subscribe;
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.SubscribeResponse;
+import org.oasis.wsrf.lifetime.Destroy;
+import org.oasis.wsrf.lifetime.ResourceUnknownFaultType;
+
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.tests.invalidate.InvalidateRequest;
+import org.globus.wsrf.core.notification.service.PersistenceTestSubscriptionManagerServiceAddressingLocator;
+import org.globus.wsrf.core.notification.PersistenceTestSubscriptionManager;
+import org.globus.wsrf.test.GridTestSuite;
+
+public class PersistentSubscriptionTests extends NotificationTestCase
+{
+    private PersistenceTestSubscriptionManagerServiceAddressingLocator managerLocator =
+        new PersistenceTestSubscriptionManagerServiceAddressingLocator();
+
+    public PersistentSubscriptionTests(String name)
+    {
+        super(name);
+    }
+
+    public void testSubscriptionResourcePersistence() throws Exception
+    {
+        TestNotifyCallback callback = new TestNotifyCallback();
+        int expectedCount = 1;
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(callback);
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse response = super.port.subscribe(request);
+        PersistenceTestSubscriptionManager manager =
+            this.managerLocator.getPersistenceTestSubscriptionManagerPort(
+                response.getSubscriptionReference());
+        manager.invalidate(new InvalidateRequest());
+        super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+        assertTrue(callback.waitForCount(expectedCount, GridTestSuite.timeout));
+        assertEquals(expectedCount, callback.getNotifyCount());
+        manager.destroy(new Destroy());
+    }
+
+    public void testSubscriptionPersistence() throws Exception
+    {
+        TestNotifyCallback callback = new TestNotifyCallback();
+        int expectedCount = 1;
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(callback);
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse response = super.port.subscribe(request);
+        PersistenceTestSubscriptionManager manager =
+            this.managerLocator.getPersistenceTestSubscriptionManagerPort(
+                response.getSubscriptionReference());
+        manager.invalidate(new InvalidateRequest());
+        super.port.invalidate(new InvalidateRequest());
+        super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+        assertTrue(callback.waitForCount(expectedCount, GridTestSuite.timeout));
+        assertEquals(expectedCount, callback.getNotifyCount());
+        manager.destroy(new Destroy());
+    }
+
+    public void testSubscriptionPersistenceTimeout() throws Exception
+    {
+        TestNotifyCallback callback = new TestNotifyCallback();
+        int expectedCount = 1;
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(callback);
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+
+        Calendar termTime = Calendar.getInstance();
+        termTime.add(Calendar.SECOND, 30);
+        request.setInitialTerminationTime(termTime);
+
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse response = super.port.subscribe(request);
+        PersistenceTestSubscriptionManager manager =
+            this.managerLocator.getPersistenceTestSubscriptionManagerPort(
+                response.getSubscriptionReference());
+        manager.invalidate(new InvalidateRequest());
+
+        // sleep 1 min
+        Thread.sleep(60 * 1000);
+
+        try 
+        {
+            manager.destroy(new Destroy());
+        } 
+        catch (ResourceUnknownFaultType e) 
+        {
+            //it's ok
+        }
+    }
+
+    public void testSubscriptionListenerPersistence() throws Exception
+    {
+        TestNotifyCallback callback = new TestNotifyCallback();
+        int expectedCount = 1;
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(callback);
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse response = super.port.subscribe(request);
+        PersistenceTestSubscriptionManager manager =
+            this.managerLocator.getPersistenceTestSubscriptionManagerPort(
+                response.getSubscriptionReference());
+        super.port.invalidate(new InvalidateRequest());
+        super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+        assertTrue(callback.waitForCount(expectedCount, GridTestSuite.timeout));
+        assertEquals(expectedCount, callback.getNotifyCount());
+        manager.destroy(new Destroy());
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/ResourcePropertyNotificationTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/ResourcePropertyNotificationTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/ResourcePropertyNotificationTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,240 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.Constants;
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.core.notification.ResourcePropertyValueChangeNotificationElementType;
+import org.globus.wsrf.encoding.ObjectSerializer;
+import org.globus.wsrf.test.GridTestSuite;
+import org.globus.wsrf.tests.notification.JobStatusType;
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.Subscribe;
+import org.oasis.wsn.SubscribeResponse;
+import org.oasis.wsrf.properties.InsertType;
+import org.oasis.wsrf.properties.ResourcePropertyValueChangeNotificationType;
+import org.oasis.wsrf.properties.SetResourceProperties_Element;
+
+public class ResourcePropertyNotificationTests extends NotificationTestCase
+{
+    private JobStatusType jobStatus = null;
+    private Boolean oldAutoNotify = null;
+    private Boolean autoNotify = null;
+
+    public ResourcePropertyNotificationTests(String name)
+    {
+        super(name);
+    }
+
+    public void testResourcePropertyNotification() throws Exception
+    {
+        TestRPNotifyCallback callback = new TestRPNotifyCallback();
+        int expectedCount = 1;
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(callback);
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.JOB_STATUS_TOPIC_RP);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse response = super.port.subscribe(request);
+        super.port.generateNotification(
+            NotificationTestService.JOB_STATUS_TOPIC_RP);
+
+        assertTrue(callback.waitForCount(expectedCount, GridTestSuite.timeout));
+        assertEquals(expectedCount, callback.getNotifyCount());
+        assertTrue(this.jobStatus != null);
+        assertEquals(this.jobStatus.getJobState(),
+                     NotificationTestService.JOB_STATUS_DONE);
+        super.destroySubscription(response.getSubscriptionReference());
+    }
+
+    public void testResourcePropertyAutoNotify() throws Exception
+    {
+        TestRPNotifyCallback callback = new TestRPNotifyCallback();
+        int expectedCount = 1;
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(callback);
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.AUTO_NOTIFY_TOPIC_RP);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse response = super.port.subscribe(request);
+        SetResourceProperties_Element setRPRequest = 
+            new SetResourceProperties_Element();
+        InsertType insert = new InsertType();
+        MessageElement [] elements = new MessageElement[1];
+        elements[0] = (MessageElement)
+            ObjectSerializer.toSOAPElement(
+                new Boolean(true),
+                NotificationTestService.AUTO_NOTIFY_TOPIC_RP);
+        insert.set_any(elements);
+        setRPRequest.setInsert(insert);
+        super.port.setResourceProperties(setRPRequest);
+
+        assertTrue(callback.waitForCount(expectedCount, GridTestSuite.timeout));
+        assertEquals(expectedCount, callback.getNotifyCount());
+        assertTrue(this.autoNotify != null);
+        assertTrue(this.autoNotify.booleanValue());
+        assertEquals(this.oldAutoNotify, null);
+        super.destroySubscription(response.getSubscriptionReference());
+    }
+
+/* The below does not work as expected */
+/*
+    public void testResourcePropertySendOld() throws Exception
+    {
+        int expectedCount = super.notifyCount + 1;
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(this);
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.AUTO_NOTIFY_TOPIC_RP);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse response = super.port.subscribe(request);
+        _SetResourceProperties setRPRequest = new _SetResourceProperties();
+        UpdateType update = new UpdateType();
+        MessageElement [] elements = new MessageElement[1];
+        elements[0] = (MessageElement)
+            ObjectSerializer.toSOAPElement(
+                new Boolean(true),
+                NotificationTestService.SEND_OLD_TOPIC_RP);
+        update.set_any(elements);
+        setRPRequest.setUpdate(update);
+        super.port.setResourceProperties(setRPRequest);
+        Boolean oldValue;
+        if(this.autoNotify == null)
+        {
+            oldValue = new Boolean(false);
+            InsertType insert = new InsertType();
+            elements[0] = (MessageElement)
+                ObjectSerializer.toSOAPElement(
+                    oldValue,
+                    NotificationTestService.AUTO_NOTIFY_TOPIC_RP);
+            insert.set_any(elements);
+            setRPRequest = new _SetResourceProperties();
+            setRPRequest.setInsert(insert);
+            port.setResourceProperties(setRPRequest);
+            expectedCount++;
+        }
+        else
+        {
+            oldValue = this.autoNotify;
+        }
+        setRPRequest = new _SetResourceProperties();
+        Boolean newValue = new Boolean(!oldValue.booleanValue());
+        elements[0] = (MessageElement)
+            ObjectSerializer.toSOAPElement(
+                newValue,
+                NotificationTestService.AUTO_NOTIFY_TOPIC_RP);
+        update.set_any(elements);
+        setRPRequest.setUpdate(update);
+        port.setResourceProperties(setRPRequest);
+        waitForCount(expectedCount, GridTestSuite.timeout);
+        assertEquals(expectedCount, super.notifyCount);
+        assertEquals(oldValue, this.oldAutoNotify);
+        assertEquals(newValue, this.autoNotify);
+        super.destroySubscription(response.getSubscriptionReference());
+    }
+*/
+
+    private class TestRPNotifyCallback extends TestNotifyCallback
+    {
+        public synchronized void deliver(List topicPath,
+                                         EndpointReferenceType producer,
+                                         Object message)
+        {
+            ResourcePropertyValueChangeNotificationType changeMessage =
+                ((ResourcePropertyValueChangeNotificationElementType) message).
+                getResourcePropertyValueChangeNotification();
+
+            if(changeMessage != null)
+            {
+                if(((QName)topicPath.get(0)).equals(
+                    NotificationTestService.JOB_STATUS_TOPIC_RP))
+                {
+                    try
+                    {
+                        ResourcePropertyNotificationTests.this.jobStatus =
+                            (JobStatusType) changeMessage.getNewValue().
+                                get_any()[0].getValueAsType(
+                                    new QName(
+                                        NotificationTestService.TEST_NS,
+                                        "JobStatusRP"),
+                                    JobStatusType.class);
+                    }
+                    catch(Exception e)
+                    {
+                        e.printStackTrace();
+                    }
+                }
+                else if(((QName)topicPath.get(0)).equals(
+                    NotificationTestService.AUTO_NOTIFY_TOPIC_RP))
+                {
+                    try
+                    {
+                        ResourcePropertyNotificationTests.this.autoNotify =
+                            (Boolean) changeMessage.getNewValue().
+                                get_any()[0].getValueAsType(
+                                    Constants.XSD_BOOLEAN);
+                    }
+                    catch(Exception e)
+                    {
+                        e.printStackTrace();
+                    }
+
+                    if(changeMessage.getOldValue() != null)
+                    {
+                        try
+                        {
+                            ResourcePropertyNotificationTests.this.oldAutoNotify
+                                = (Boolean) changeMessage.getOldValue().
+                                    get_any()[0].getValueAsType(
+                                        Constants.XSD_BOOLEAN);
+                        }
+                        catch(Exception e)
+                        {
+                            e.printStackTrace();
+                        }
+                    }
+                }
+            }
+            super.deliver(topicPath, producer, message);
+        }
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/SecurityTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/SecurityTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/SecurityTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,33 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import org.globus.wsrf.test.GridTestSuite;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class SecurityTests extends GridTestSuite {
+
+    public SecurityTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new SecurityTests("SecureNotificationsTest");
+        suite.addTestSuite(TestSecureNotifications.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/SubscribeTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/SubscribeTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/SubscribeTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,120 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.test.GridTestSuite;
+import org.oasis.wsn.ResourceUnknownFaultType;
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.TopicNotSupportedFaultType;
+import org.oasis.wsn.TopicPathDialectUnknownFaultType;
+import org.oasis.wsn.Subscribe;
+import org.oasis.wsn.SubscribeResponse;
+
+public class SubscribeTests extends NotificationTestCase
+{
+    public SubscribeTests(String name)
+    {
+        super(name);
+    }
+
+    public void testSubscribe() throws Exception
+    {
+        TestNotifyCallback callback = new TestNotifyCallback();
+        int expectedCount = 1;
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(callback);
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        SubscribeResponse response = super.port.subscribe(request);
+        super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+        assertTrue(callback.waitForCount(expectedCount, GridTestSuite.timeout));
+        assertEquals(expectedCount, callback.getNotifyCount());
+        super.destroySubscription(response.getSubscriptionReference());
+    }
+
+    public void testSubscribeResourceUnknown() throws Exception
+    {
+        ResourceUnknownFaultType fault = null;
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(badEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        try
+        {
+            badPort.subscribe(request);
+        }
+        catch(ResourceUnknownFaultType e)
+        {
+            fault = e;
+        }
+        assertTrue(fault != null);
+    }
+
+    public void testSubscribeTopicPathDialectUnknown() throws Exception
+    {
+        TopicPathDialectUnknownFaultType fault = null;
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(super.testServiceEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.CONCRETE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        try
+        {
+            super.port.subscribe(request);
+        }
+        catch(TopicPathDialectUnknownFaultType e)
+        {
+            fault = e;
+        }
+        assertTrue(fault != null);
+    }
+
+    public void testSubscribeUnsupportedTopic() throws Exception
+    {
+        TopicNotSupportedFaultType fault = null;
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(super.testServiceEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            new QName("foo"));
+        request.setTopicExpression(topicPath);
+        try
+        {
+            super.port.subscribe(request);
+        }
+        catch(TopicNotSupportedFaultType e)
+        {
+            fault = e;
+        }
+        assertTrue(fault != null);
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/SubscriptionManagerTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/SubscriptionManagerTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/SubscriptionManagerTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,352 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.util.Calendar;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.core.notification.SubscriptionManager;
+import org.globus.wsrf.core.notification.service.SubscriptionManagerServiceAddressingLocator;
+import org.globus.wsrf.impl.SimpleResourceKey;
+import org.globus.wsrf.test.GridTestSuite;
+import org.globus.wsrf.utils.AddressingUtils;
+
+import org.oasis.wsrf.lifetime.Destroy;
+import org.oasis.wsrf.lifetime.SetTerminationTime;
+import org.oasis.wsn.ResourceUnknownFaultType;
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.Subscribe;
+import org.oasis.wsn.SubscribeResponse;
+import org.oasis.wsn.PauseSubscription;
+import org.oasis.wsn.ResumeSubscription;
+import org.oasis.wsrf.properties.QueryExpressionType;
+import org.oasis.wsrf.properties.GetResourcePropertyResponse;
+
+public class SubscriptionManagerTests extends NotificationTestCase
+{
+    private SubscriptionManagerServiceAddressingLocator managerLocator =
+        new SubscriptionManagerServiceAddressingLocator();
+
+    private EndpointReferenceType consumerEPR = null;
+    private TestNotifyCallback callback = null;
+    private SubscriptionManager manager = null;
+    private SubscriptionManager badManager = null;
+
+    public SubscriptionManagerTests(String name)
+    {
+        super(name);
+    }
+
+    /* Not a very good test - not sure how to make it better */
+    public void testPauseResume() throws Exception
+    {
+        int expectedCount = this.callback.getNotifyCount() + 1;
+        this.manager.pauseSubscription(new PauseSubscription());
+        super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+        this.manager.resumeSubscription(new ResumeSubscription());
+        super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+
+        assertTrue(this.callback.waitForCount(expectedCount,
+                                              GridTestSuite.timeout));
+        assertEquals(expectedCount, this.callback.getNotifyCount());
+    }
+
+    public void testPauseResourceUnknown() throws Exception
+    {
+        ResourceUnknownFaultType fault = null;
+        try
+        {
+            this.badManager.pauseSubscription(new PauseSubscription());
+        }
+        catch(ResourceUnknownFaultType e)
+        {
+            fault = e;
+        }
+        assertTrue(fault != null);
+    }
+
+    public void testResumeResourceUnknown() throws Exception
+    {
+        ResourceUnknownFaultType fault = null;
+        try
+        {
+            this.badManager.resumeSubscription(new ResumeSubscription());
+        }
+        catch(ResourceUnknownFaultType e)
+        {
+            fault = e;
+        }
+        assertTrue(fault != null);
+    }
+
+    /* Core doesn't use PauseFailed and ResumeFailed, so can't test those */
+
+    public void testDestroySubscription() throws Exception
+    {
+        ResourceUnknownFaultType fault = null;
+        int expectedCount = 0;
+        TestNotifyCallback callback = new TestNotifyCallback();
+        EndpointReferenceType managerEPR = this.subscribe(callback);
+        SubscriptionManager manager =
+            this.managerLocator.getSubscriptionManagerPort(
+                managerEPR);
+        manager.destroy(new Destroy());
+        try
+        {
+            manager.pauseSubscription(new PauseSubscription());
+        }
+        catch(ResourceUnknownFaultType e)
+        {
+            fault = e;
+        }
+        assertTrue(fault != null);
+        super.port.generateNotification(NotificationTestService.TEST_TOPIC);
+
+        // no notification should be generated
+        Thread.sleep(15000);
+        assertEquals(expectedCount, callback.getNotifyCount());
+    }
+
+    /* Sweeper runs every 60s right now */
+
+    public void testTerminateSubscription() throws Exception
+    {
+        ResourceUnknownFaultType fault = null;
+        int expectedCount = 0;
+        TestNotifyCallback callback = new TestNotifyCallback();
+        EndpointReferenceType managerEPR = this.subscribe(callback);
+        SubscriptionManager manager =
+            this.managerLocator.getSubscriptionManagerPort(
+                managerEPR);
+        SetTerminationTime terminationTimeRequest = new SetTerminationTime();
+        Calendar terminationTime = Calendar.getInstance();
+        terminationTime.add(Calendar.SECOND, 5);
+        terminationTimeRequest.setRequestedTerminationTime(terminationTime);
+        manager.setTerminationTime(terminationTimeRequest);
+
+        int wait = 0;
+        while(wait < GridTestSuite.timeout) {
+            try
+            {
+                manager.resumeSubscription(new ResumeSubscription());
+                wait += 1000 * 45;
+                Thread.sleep(1000 * 45);
+            }
+            catch(ResourceUnknownFaultType e)
+            {
+                fault = e;
+                break;
+            }
+        }
+
+        assertTrue("timeout or exception not generated", fault != null);
+        port.generateNotification(NotificationTestService.TEST_TOPIC);
+
+        // no notification should be generated
+        Thread.sleep(15000);
+        assertEquals(expectedCount, callback.getNotifyCount());
+    }
+
+    public void testSubscriptionTimeRPs() throws Exception
+    {
+        GetResourcePropertyResponse response =
+            this.manager.getResourceProperty(WSRFConstants.TERMINATION_TIME);
+        MessageElement[] timeElements = response.get_any();
+        assertTrue(timeElements.length == 1);
+        assertEquals(timeElements[0].getQName(),
+                     WSRFConstants.TERMINATION_TIME);
+        Calendar terminationTime = (Calendar) timeElements[0].getValueAsType(
+            org.apache.axis.Constants.XSD_DATETIME);
+        response = this.manager.getResourceProperty(
+            WSNConstants.CREATION_TIME);
+        timeElements = response.get_any();
+        assertTrue(timeElements.length == 1);
+        assertEquals(timeElements[0].getQName(), WSNConstants.CREATION_TIME);
+        Calendar creationTime = (Calendar) timeElements[0].getValueAsType(
+            org.apache.axis.Constants.XSD_DATETIME);
+        assertTrue(terminationTime.after(creationTime));
+        response = this.manager.getResourceProperty(WSRFConstants.CURRENT_TIME);
+        timeElements = response.get_any();
+        assertTrue(timeElements.length == 1);
+        assertEquals(timeElements[0].getQName(), WSRFConstants.CURRENT_TIME);
+        Calendar currentTime = (Calendar) timeElements[0].getValueAsType(
+            org.apache.axis.Constants.XSD_DATETIME);
+        assertTrue(terminationTime.after(currentTime));
+     }
+
+    public void testConsumerReferenceRP() throws Exception
+    {
+        GetResourcePropertyResponse response =
+            this.manager.getResourceProperty(WSNConstants.CONSUMER_REFERENCE);
+        MessageElement[] responseElements = response.get_any();
+        assertTrue(responseElements.length == 1);
+        assertEquals(responseElements[0].getQName(),
+                     WSNConstants.CONSUMER_REFERENCE);
+        EndpointReferenceType consumerReference = (EndpointReferenceType)
+            responseElements[0].getValueAsType(
+                EndpointReferenceType.getTypeDesc().getXmlType());
+        assertEquals(consumerReference.getAddress().toString(),
+                     this.consumerEPR.getAddress().toString());
+        MessageElement[] rpReferenceProps =
+            consumerReference.getProperties().get_any();
+        MessageElement[] referenceProps =
+            this.consumerEPR.getProperties().get_any();
+        assertEquals(rpReferenceProps.length, referenceProps.length);
+        assertEquals(rpReferenceProps[0].getQName(),
+                     referenceProps[0].getQName());
+        assertEquals(rpReferenceProps[0].getValue(),
+                     referenceProps[0].getValue());
+    }
+
+    public void testTopicExpressionRP() throws Exception
+    {
+        GetResourcePropertyResponse response =
+            this.manager.getResourceProperty(WSNConstants.TOPIC_EXPRESSION);
+        MessageElement[] responseElements = response.get_any();
+        assertTrue(responseElements.length == 1);
+        assertEquals(responseElements[0].getQName(),
+                     WSNConstants.TOPIC_EXPRESSION);
+        TopicExpressionType topic = (TopicExpressionType)
+            responseElements[0].getValueAsType(
+                TopicExpressionType.getTypeDesc().getXmlType());
+        assertEquals(WSNConstants.SIMPLE_TOPIC_DIALECT, 
+                     topic.getDialect().toString());
+        assertEquals(NotificationTestService.TEST_TOPIC, 
+                     topic.getValue());
+    }
+
+    public void testUseNotifyRP() throws Exception
+    {
+        GetResourcePropertyResponse response =
+            this.manager.getResourceProperty(WSNConstants.USE_NOTIFY);
+        MessageElement[] responseElements = response.get_any();
+        assertTrue(responseElements.length == 1);
+        assertEquals(responseElements[0].getQName(),
+                     WSNConstants.USE_NOTIFY);
+        assertEquals((Boolean) responseElements[0].getValueAsType(
+            org.apache.axis.Constants.XSD_BOOLEAN), Boolean.TRUE);
+    }
+
+    public void testPreConditionRP() throws Exception
+    {
+        GetResourcePropertyResponse response =
+            this.manager.getResourceProperty(WSNConstants.PRECONDITION);
+        MessageElement[] responseElements = response.get_any();
+        assertTrue(responseElements.length == 1);
+        assertEquals(responseElements[0].getQName(),
+                     WSNConstants.PRECONDITION);
+        QueryExpressionType query =
+            (QueryExpressionType) responseElements[0].getValueAsType(
+                QueryExpressionType.getTypeDesc().getXmlType());
+        assertEquals(WSRFConstants.XPATH_1_DIALECT,
+                     query.getDialect().toString());
+        assertEquals("/foo", query.getValue());
+    }
+
+    public void testSelectorRP() throws Exception
+    {
+        GetResourcePropertyResponse response =
+            this.manager.getResourceProperty(WSNConstants.SELECTOR);
+        MessageElement[] responseElements = response.get_any();
+        assertTrue(responseElements.length == 1);
+        assertEquals(responseElements[0].getQName(),
+                     WSNConstants.SELECTOR);
+        QueryExpressionType query =
+            (QueryExpressionType) responseElements[0].getValueAsType(
+                QueryExpressionType.getTypeDesc().getXmlType());
+        assertEquals(WSRFConstants.XPATH_1_DIALECT,
+                     query.getDialect().toString());
+        assertEquals("/foo", query.getValue());
+    }
+
+    public void testPolicyRP() throws Exception
+    {
+        GetResourcePropertyResponse response =
+            this.manager.getResourceProperty(WSNConstants.SUBSCRIPTION_POLICY);
+        MessageElement[] responseElements = response.get_any();
+        assertTrue(responseElements.length == 1);
+        assertEquals(responseElements[0].getQName(),
+                     WSNConstants.SUBSCRIPTION_POLICY);
+        assertEquals("foo", responseElements[0].getValue());
+    }
+
+    private EndpointReferenceType subscribe(TestNotifyCallback callback)
+        throws Exception
+    {
+        if(callback == null)
+        {
+            if(this.callback == null)
+            {
+                this.callback = new TestNotifyCallback();
+            }
+            callback = this.callback;
+        }
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+        this.consumerEPR =
+            consumer.createNotificationConsumer(callback);
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(this.consumerEPR);
+        TopicExpressionType topicPath = new TopicExpressionType(
+            WSNConstants.SIMPLE_TOPIC_DIALECT,
+            NotificationTestService.TEST_TOPIC);
+        request.setTopicExpression(topicPath);
+        Calendar terminationTime = Calendar.getInstance();
+        terminationTime.add(Calendar.SECOND, 200);
+        request.setInitialTerminationTime(terminationTime);
+        request.setSubscriptionPolicy("foo");
+        QueryExpressionType query = new QueryExpressionType();
+        query.setDialect(WSRFConstants.XPATH_1_DIALECT);
+        query.setValue("/foo");
+        request.setPrecondition(query);
+        request.setSelector(query);
+        SubscribeResponse response = super.port.subscribe(request);
+        return response.getSubscriptionReference();
+    }
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        EndpointReferenceType managerEPR = this.subscribe(null);
+        this.manager =
+            this.managerLocator.getSubscriptionManagerPort(
+                managerEPR);
+        EndpointReferenceType badManagerEPR =
+            AddressingUtils.createEndpointReference(
+                managerEPR.getAddress().toString(),
+                new SimpleResourceKey(new QName(Constants.CORE_NS,
+                                                "SubscriptionKey"),
+                                      "1"));
+        this.badManager =
+            this.managerLocator.getSubscriptionManagerPort(
+                badManagerEPR);
+    }
+
+    protected void tearDown() throws Exception
+    {
+        this.manager.destroy(new Destroy());
+        super.tearDown();
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/TestNotifyCallback.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/TestNotifyCallback.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/TestNotifyCallback.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,72 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.util.List;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.globus.wsrf.NotifyCallback;
+
+import javax.xml.namespace.QName;
+
+public class TestNotifyCallback implements NotifyCallback
+{
+    private int notifyCount = 0;
+    private QName notificationTopic = null;
+    private Object message = null;
+
+    public int getNotifyCount()
+    {
+        return notifyCount;
+    }
+
+    public QName getNotificationTopic()
+    {
+        return notificationTopic;
+    }
+
+    public Object getMessage()
+    {
+        return message;
+    }
+
+    public synchronized void deliver(List topicPath,
+                                     EndpointReferenceType producer,
+                                     Object message)
+    {
+        this.message = message;
+        this.notificationTopic = (QName) topicPath.get(0);
+        this.notifyCount++;
+        notify();
+    }
+
+    public synchronized boolean waitForCount(int count, int maxWait)
+        throws InterruptedException
+    {
+        int oldNotifyCount;
+        while( (oldNotifyCount = this.notifyCount) != count)
+        {
+            wait(maxWait);
+            if (oldNotifyCount == this.notifyCount)
+            {
+                // timeout
+                return false;
+            }
+        }
+        return true;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/TestSecureNotifications.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/TestSecureNotifications.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/notification/TestSecureNotifications.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,338 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.notification;
+
+import java.util.Vector;
+
+import javax.xml.rpc.Stub;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.axis.types.URI;
+
+import org.oasis.wsn.TopicExpressionType;
+import org.oasis.wsn.Subscribe;
+import org.oasis.wsn.SubscribeResponse;
+import org.oasis.wsrf.properties.ResourcePropertyValueChangeNotificationType;
+
+import org.globus.wsrf.NotificationConsumerManager;
+import org.globus.wsrf.WSNConstants;
+import org.globus.wsrf.core.notification.ResourcePropertyValueChangeNotificationElementType;
+import org.globus.wsrf.impl.security.SecurityTestResource;
+import org.globus.wsrf.impl.security.TestConstants;
+import org.globus.wsrf.impl.security.authentication.Constants;
+import org.globus.wsrf.impl.security.authorization.Authorization;
+import org.globus.wsrf.impl.security.descriptor.ClientSecurityDescriptor;
+import org.globus.wsrf.impl.security.descriptor.GSISecureConvAuthMethod;
+import org.globus.wsrf.impl.security.descriptor.GSISecureMsgAuthMethod;
+import org.globus.wsrf.impl.security.descriptor.ResourceSecurityDescriptor;
+import org.globus.wsrf.test.GridTestSuite;
+import org.globus.wsrf.tests.security.SecurityTestPortType;
+import org.globus.wsrf.tests.security.CreateResourceResponse;
+import org.globus.wsrf.tests.security.service.SecurityTestServiceAddressingLocator;
+
+public class TestSecureNotifications extends NotificationTestCase {
+
+    static Log logger =
+        LogFactory.getLog(TestSecureNotifications.class.getName());
+    Authorization authz = null;
+
+    public TestSecureNotifications(String name) {
+        super(name);
+        authz = TestConstants.getConfiguredClientAuthz();
+    }
+
+    public void testSubscribeSecMsg() throws Exception {
+        EndpointReferenceType res1EPR = createResource();
+        EndpointReferenceType subscribeEPR =
+            subscribeTest(res1EPR, Constants.GSI_SEC_MSG, 10);
+        super.destroySubscription(subscribeEPR, Constants.GSI_SEC_MSG);
+    }
+
+    public void testSubscribeSecConv() throws Exception {
+        EndpointReferenceType res1EPR = createResource();
+        EndpointReferenceType subscribeEPR =
+            subscribeTest(res1EPR, Constants.GSI_SEC_CONV, 20);
+        super.destroySubscription(subscribeEPR, Constants.GSI_SEC_CONV);
+    }
+
+    public void testSubscribeResourceSecurity() throws Exception {
+        EndpointReferenceType res1EPR = createResource();
+        EndpointReferenceType subscribeEPR =
+            subscribeTest(res1EPR, Constants.GSI_SEC_CONV, 20);
+        String errorMessage = null;
+        try
+        {
+            super.destroySubscription(subscribeEPR);
+        }
+        catch(Exception e)
+        {
+            errorMessage = e.getMessage();
+        }
+        assertEquals(
+            "GSI Secure Message or GSI Secure Conversation " +
+            "authentication required for " +
+            "\"{http://wsrf.globus.org/core/notification}destroy\" operation.",
+            errorMessage);
+    }
+
+    public void testNotificationSecConv() throws Exception {
+        EndpointReferenceType res2EPR = createResource();
+        multipleNotificationsTest(res2EPR, Constants.GSI_SEC_CONV);
+    }
+
+    public void testNotificationSecMsg() throws Exception {
+        EndpointReferenceType res2EPR = createResource();
+        multipleNotificationsTest(res2EPR, Constants.GSI_SEC_MSG);
+    }
+
+    private EndpointReferenceType createResource() throws Exception {
+
+        String testServiceAddrs = TEST_CONTAINER.getBaseURL() +
+                                  TestConstants.SECURITY_SERVICE_PATH;
+        EndpointReferenceType testServiceEPR =
+            new EndpointReferenceType(new URI(testServiceAddrs));
+
+        // Create a resource
+        SecurityTestServiceAddressingLocator locator =
+            new SecurityTestServiceAddressingLocator();
+        SecurityTestPortType testPort =
+            locator.getSecurityTestPortTypePort(testServiceEPR);
+        CreateResourceResponse response =
+            testPort.createResource(false);
+        EndpointReferenceType res1EPR = response.getEndpointReference();
+        logger.debug("Created a resource");
+        return res1EPR;
+    }
+
+    private EndpointReferenceType subscribeTest(
+        EndpointReferenceType res1EPR, String msgType, int setVal)
+        throws Exception {
+
+        TestNotifyCallback callback = new TestNotifyCallback();
+        int expectedCount = 1;
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+
+        ResourceSecurityDescriptor resDesc =
+            new ResourceSecurityDescriptor();
+	// FIXME
+	//        resDesc.setAuthz("self");
+        resDesc.setAuthz("none");
+        Vector authMethod = new Vector();
+        if (msgType.equals(Constants.GSI_SEC_CONV)) {
+            authMethod.add(GSISecureConvAuthMethod.BOTH);
+        } else if (msgType.equals(Constants.GSI_SEC_MSG)) {
+            authMethod.add(GSISecureMsgAuthMethod.BOTH);
+        }
+        resDesc.setAuthMethods(authMethod, true);
+
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(callback, resDesc);
+        logger.debug("Created notification consumer");
+
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicExpression = new TopicExpressionType();
+        topicExpression.setDialect(WSNConstants.SIMPLE_TOPIC_DIALECT);
+        topicExpression.setValue(SecurityTestResource.VALUE);
+        request.setTopicExpression(topicExpression);
+        logger.debug("Created subscribe request");
+
+        SecurityTestServiceAddressingLocator resLocator =
+            new SecurityTestServiceAddressingLocator();
+        SecurityTestPortType testPort =
+            resLocator.getSecurityTestPortTypePort(res1EPR);
+        ((Stub)testPort)._setProperty(msgType,
+                                      Constants.SIGNATURE);
+        ((Stub)testPort)._setProperty(Constants.AUTHORIZATION,
+                                      authz);
+        SubscribeResponse response = testPort.subscribe(request);
+        logger.debug("Subscribe called");
+
+        // set value which should trigger notification
+        testPort.setValue(setVal);
+
+        assertTrue(callback.waitForCount(1, GridTestSuite.timeout));
+        assertEquals(expectedCount, callback.getNotifyCount());
+        Object message = callback.getMessage();
+        ResourcePropertyValueChangeNotificationType changeMessage =
+            ((ResourcePropertyValueChangeNotificationElementType) message).
+            getResourcePropertyValueChangeNotification();
+
+        assertTrue(changeMessage != null);
+        String val = changeMessage.getNewValue().get_any()[0].getValue();
+        logger.debug("Value is " + val);
+        assertTrue(Integer.toString(setVal).equals(val));
+        return response.getSubscriptionReference();
+    }
+
+    public void multipleNotificationsTest(EndpointReferenceType res1EPR,
+                                          String msgType) throws Exception {
+
+        System.out.println("Msg type " + msgType);
+        TestNotifyCallback callback = new TestNotifyCallback();
+        NotificationConsumerManager consumer =
+            NotificationConsumerManager.getInstance();
+        consumer.startListening();
+
+        ResourceSecurityDescriptor resDesc =
+            new ResourceSecurityDescriptor();
+	// FIXME
+	//        resDesc.setAuthz("self");
+        resDesc.setAuthz("none");
+        ClientSecurityDescriptor desc = new ClientSecurityDescriptor();
+        desc.setAuthz(authz);
+        Vector authMethod = new Vector();
+        if (msgType.equals(Constants.GSI_SEC_CONV)) {
+            authMethod.add(GSISecureConvAuthMethod.BOTH);
+            desc.setGSISecureConv(Constants.SIGNATURE);
+        } else if (msgType.equals(Constants.GSI_SEC_MSG)) {
+            authMethod.add(GSISecureMsgAuthMethod.BOTH);
+            desc.setGSISecureMsg(Constants.SIGNATURE);
+        }
+        resDesc.setAuthMethods(authMethod, true);
+        EndpointReferenceType consumerEPR =
+            consumer.createNotificationConsumer(callback, resDesc);
+
+        Subscribe request = new Subscribe();
+        request.setConsumerReference(consumerEPR);
+        TopicExpressionType topicExpression = new TopicExpressionType();
+        topicExpression.setDialect(WSNConstants.SIMPLE_TOPIC_DIALECT);
+        topicExpression.setValue(SecurityTestResource.VALUE);
+        request.setTopicExpression(topicExpression);
+
+        SecurityTestServiceAddressingLocator resLocator =
+            new SecurityTestServiceAddressingLocator();
+        SecurityTestPortType testPort =
+            resLocator.getSecurityTestPortTypePort(res1EPR);
+        ((Stub)testPort)._setProperty(msgType,
+                                      Constants.SIGNATURE);
+        ((Stub)testPort)._setProperty(Constants.AUTHORIZATION, authz);
+        SubscribeResponse response = testPort.subscribe(request);
+
+        int numClients = 2;
+        int numIters = 3;
+        Sem sem = new Sem(numClients);
+        for (int i=0; i<numClients; i++) {
+            NotificationTestClient client =
+                new NotificationTestClient(res1EPR, sem, numIters, msgType);
+            client.start();
+        }
+
+        Exception ex = null;
+
+        try {
+            ex = sem.waitFor(GridTestSuite.timeout);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+
+
+        if (ex != null)
+            fail("Some client failed with " + ex.getMessage());
+
+        assertTrue(callback.waitForCount(numClients * numIters,
+                                         GridTestSuite.timeout));
+
+        // just to give the axis a chance to return soap responses
+        Thread.sleep(5000);
+        super.destroySubscription(response.getSubscriptionReference(), desc);
+    }
+
+    public class NotificationTestClient extends Thread {
+
+        EndpointReferenceType epr;
+        Sem sem;
+        int numOfCalls;
+        String msgSecType;
+
+        public NotificationTestClient(EndpointReferenceType epr,
+                                      Sem sem,
+                                      int numOfCalls,
+                                      String msgSecType) {
+            this.epr = epr;
+            this.sem = sem;
+            this.numOfCalls = numOfCalls;
+            this.msgSecType = msgSecType;
+        }
+
+        public void run() {
+            Exception exception = null;
+
+            try {
+                SecurityTestServiceAddressingLocator resLocator =
+                    new SecurityTestServiceAddressingLocator();
+                SecurityTestPortType testPort =
+                    resLocator.getSecurityTestPortTypePort(this.epr);
+
+                ((Stub)testPort)._setProperty(this.msgSecType,
+                                              Constants.SIGNATURE);
+                ((Stub)testPort)._setProperty(Constants.AUTHORIZATION,
+                                              authz);
+
+                for (int i = 0; i < numOfCalls; i++) {
+                    testPort.setValue(i);
+                }
+            } catch (Exception e) {
+                exception = e;
+                e.printStackTrace();
+            } finally {
+                sem.signal(exception);
+            }
+        }
+    }
+
+    class Sem {
+        int clients;
+        int totalClients;
+        Exception exception;
+
+        public Sem(int totalClients) {
+            this.totalClients = totalClients;
+            this.clients = 0;
+        }
+
+        public synchronized Exception waitFor(int timeout)
+            throws Exception {
+            while (totalClients != clients) {
+                int old = clients;
+                wait(timeout);
+
+                if (old == clients) {
+                    throw new Exception(
+                        "Timeout. Received " + clients + "/" + totalClients +
+                        " signals."
+                    );
+                }
+            }
+
+            return exception;
+        }
+
+        public synchronized void signal(Exception e) {
+            if (exception == null) {
+                exception = e;
+            }
+
+            clients++;
+            notify();
+        }
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/GetMultipleResourcePropertiesTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/GetMultipleResourcePropertiesTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/GetMultipleResourcePropertiesTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,176 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.properties;
+
+import java.util.Calendar;
+
+import org.globus.wsrf.impl.TestHome;
+
+import org.apache.axis.message.MessageElement;
+
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.tests.basic.TestPortType;
+
+import org.oasis.wsrf.properties.ResourceUnknownFaultType;
+import org.oasis.wsrf.properties.GetMultipleResourceProperties_Element;
+import org.oasis.wsrf.properties.GetMultipleResourcePropertiesResponse;
+import org.oasis.wsrf.properties.InvalidResourcePropertyQNameFaultType;
+import org.oasis.wsrf.lifetime.SetTerminationTime;
+import org.oasis.wsrf.lifetime.SetTerminationTimeResponse;
+
+import javax.xml.namespace.QName;
+
+public class GetMultipleResourcePropertiesTests extends PropertiesTestCase {
+
+    private static final QName [] PROP_NAMES = 
+        new QName[] {WSRFConstants.TERMINATION_TIME,
+                     WSRFConstants.CURRENT_TIME};
+
+    public GetMultipleResourcePropertiesTests(String name) {
+        super(name);
+    }
+
+    public void testUnknownResource() throws Exception {
+        TestPortType port = 
+            locator.getTestPortTypePort(createEPR(TestHome.BAD_KEY));
+
+        GetMultipleResourceProperties_Element request =
+            new GetMultipleResourceProperties_Element();
+        request.setResourceProperty(PROP_NAMES);
+
+        try {
+            GetMultipleResourcePropertiesResponse reponse = 
+                port.getMultipleResourceProperties(request);
+            fail("Did not throw exception");
+        } catch (ResourceUnknownFaultType e) {
+            //it's ok
+        }
+    }
+
+    public void testGetMultipleResourceProperties() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        GetMultipleResourceProperties_Element propRequest = null;
+        GetMultipleResourcePropertiesResponse propResponse = null;
+
+        propRequest = new GetMultipleResourceProperties_Element();
+        propRequest.setResourceProperty(PROP_NAMES);
+        
+        propResponse = port.getMultipleResourceProperties(propRequest);
+
+        MessageElement [] any = null;
+
+        any = propResponse.get_any();
+        assertTrue(any != null);
+        assertEquals(2, any.length);
+        assertEquals(WSRFConstants.TERMINATION_TIME, any[0].getQName());
+        assertEquals("true", any[0].getAttributeNS(Constants.XSI_NS, "nil"));
+        assertEquals(WSRFConstants.CURRENT_TIME, any[1].getQName());
+
+        // sets termination time
+        Calendar termTime = Calendar.getInstance();
+        termTime.add(Calendar.SECOND, 30);
+        
+        SetTerminationTime timeRequest = new SetTerminationTime();
+        timeRequest.setRequestedTerminationTime(termTime);
+        
+        SetTerminationTimeResponse timeResponse =
+            port.setTerminationTime(timeRequest);
+
+        propResponse = port.getMultipleResourceProperties(propRequest);
+
+        any = propResponse.get_any();
+        assertTrue(any != null);
+        assertEquals(2, any.length);
+        
+        boolean found = false;
+        for (int i=0;i<PROP_NAMES.length;i++) {
+            found = false;
+            for (int j=0;j<any.length;j++) {
+                if (PROP_NAMES[i].equals(any[j].getQName())) {
+                    found = true;
+                    break;
+                }
+            }
+            if (!found) {
+                fail("Did not return expected RP");
+            }
+        }
+    }
+
+    public void testGetUnknownResourceProperties() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        GetMultipleResourcePropertiesResponse propResponse = null;
+        GetMultipleResourceProperties_Element propRequest = null;
+
+        // test 1: null request
+        try {
+            propResponse = port.getMultipleResourceProperties(propRequest);
+            fail("Did not throw exception");
+        } catch (InvalidResourcePropertyQNameFaultType e) {
+            // that's what we want
+        }
+
+        // test 2: empty request
+        propRequest = new GetMultipleResourceProperties_Element();
+        
+        try {
+            propResponse = port.getMultipleResourceProperties(propRequest);
+            fail("Did not throw exception");
+        } catch (InvalidResourcePropertyQNameFaultType e) {
+            // that's what we want
+        }
+
+        // test 3: empty properties
+        propRequest.setResourceProperty(new QName[] {});
+
+        try {
+            propResponse = port.getMultipleResourceProperties(propRequest);
+            fail("Did not throw exception");
+        } catch (InvalidResourcePropertyQNameFaultType e) {
+            // that's what we want
+        }
+
+        QName badRP = new QName("http://foo", "bar");
+            
+        // test 4: one bad RP
+        propRequest.setResourceProperty(new QName[] {badRP});
+        
+        try {
+            propResponse = port.getMultipleResourceProperties(propRequest);
+            fail("Did not throw exception");
+        } catch (InvalidResourcePropertyQNameFaultType e) {
+            // that's what we want
+        }
+
+        // test 4: one good, one bad RP
+        propRequest.setResourceProperty(
+             new QName[] {badRP, WSRFConstants.CURRENT_TIME}
+        );
+        
+        try {
+            propResponse = port.getMultipleResourceProperties(propRequest);
+            fail("Did not throw exception");
+        } catch (InvalidResourcePropertyQNameFaultType e) {
+            // that's what we want
+        }
+    }
+    
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/GetResourcePropertyTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/GetResourcePropertyTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/GetResourcePropertyTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,91 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.properties;
+
+import java.util.Calendar;
+
+import org.globus.wsrf.impl.TestHome;
+
+import org.apache.axis.message.MessageElement;
+
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.encoding.ObjectDeserializer;
+import org.globus.wsrf.tests.basic.TestPortType;
+
+import org.oasis.wsrf.properties.ResourceUnknownFaultType;
+import org.oasis.wsrf.properties.GetResourcePropertyResponse;
+import org.oasis.wsrf.properties.InvalidResourcePropertyQNameFaultType;
+
+import javax.xml.namespace.QName;
+
+public class GetResourcePropertyTests extends PropertiesTestCase {
+
+    public GetResourcePropertyTests(String name) {
+        super(name);
+    }
+
+    public void testUnknownResource() throws Exception {
+        TestPortType port = 
+            locator.getTestPortTypePort(createEPR(TestHome.BAD_KEY));
+
+        try {
+            GetResourcePropertyResponse propResponse =
+                port.getResourceProperty(WSRFConstants.TERMINATION_TIME);
+            fail("Did not throw exception");
+        } catch (ResourceUnknownFaultType e) {
+            //it's ok
+        }
+    }
+
+    public void testGetResourceProperty() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        GetResourcePropertyResponse propResponse =
+            port.getResourceProperty(WSRFConstants.CURRENT_TIME);
+
+        MessageElement [] any = propResponse.get_any();
+        assertTrue(any != null);
+        assertTrue(any.length > 0);
+        
+        Object obj = 
+            ObjectDeserializer.toObject(any[0], Calendar.class);
+        assertTrue(obj instanceof Calendar);
+    }
+
+    public void testGetUnknownResourceProperty() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        GetResourcePropertyResponse propResponse = null;
+
+        try {
+            propResponse = port.getResourceProperty(null);
+            fail("Did not throw exception");
+        } catch (InvalidResourcePropertyQNameFaultType e) {
+            // that's what we want
+        }
+
+        try {
+            propResponse = port.getResourceProperty(new QName("http://foo",
+                                                              "bar"));
+            fail("Did not throw exception");
+        } catch (InvalidResourcePropertyQNameFaultType e) {
+            // that's what we want
+        }
+    }
+    
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,37 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.properties;
+
+import org.globus.wsrf.test.GridTestSuite;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends GridTestSuite {
+
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("PropertiesTests");
+        suite.addTestSuite(GetResourcePropertyTests.class);
+        suite.addTestSuite(GetMultipleResourcePropertiesTests.class);
+        suite.addTestSuite(QueryResourcePropertiesTests.class);
+        suite.addTestSuite(SetResourcePropertiesTests.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/PropertiesTestCase.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/PropertiesTestCase.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/PropertiesTestCase.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,84 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.properties;
+
+import org.globus.wsrf.impl.TestService;
+
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.tests.basic.service.TestServiceAddressingLocator;
+import org.globus.wsrf.tests.basic.TestPortType;
+
+import org.globus.wsrf.tests.basic.CreateResource;
+import org.globus.wsrf.tests.basic.CreateResourceResponse;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.axis.message.addressing.ReferencePropertiesType;
+import org.apache.axis.types.URI;
+
+import org.globus.wsrf.test.GridTestCase;
+
+public class PropertiesTestCase extends GridTestCase {
+
+    public TestServiceAddressingLocator locator = 
+        new TestServiceAddressingLocator();
+
+    private EndpointReferenceType testServiceEPR = null;
+
+    public PropertiesTestCase(String name) {
+        super(name);
+    }
+
+    protected EndpointReferenceType createResource(TestPortType port)
+        throws Exception {
+        CreateResourceResponse response = 
+            port.createResource(new CreateResource());
+        EndpointReferenceType epr = response.getEndpointReference();
+        assertTrue(epr != null);
+        return epr;
+    }
+
+    protected EndpointReferenceType createEPR()
+        throws Exception {
+        return createEPR(null);
+    }
+    
+    protected EndpointReferenceType createEPR(ResourceKey key)
+        throws Exception {
+        String address = 
+            TEST_CONTAINER.getBaseURL() + TestService.SERVICE_PATH;
+        EndpointReferenceType epr = 
+            new EndpointReferenceType(new URI(address));
+
+        if (key != null) {
+            ReferencePropertiesType props = new ReferencePropertiesType();
+            props.add(key.toSOAPElement());
+            epr.setProperties(props);
+        }
+        
+        return epr;
+    }
+
+    public EndpointReferenceType getServiceAddress() throws Exception {
+        if (this.testServiceEPR == null) {
+            String address = 
+                TEST_CONTAINER.getBaseURL() + TestService.SERVICE_PATH;
+            this.testServiceEPR = 
+                new EndpointReferenceType(new URI(address));
+        }
+        return this.testServiceEPR;
+    }
+    
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/QueryResourcePropertiesTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/QueryResourcePropertiesTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/QueryResourcePropertiesTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,275 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.properties;
+
+import java.util.Iterator;
+import java.io.IOException;
+
+import org.globus.wsrf.impl.TestHome;
+import org.globus.wsrf.impl.TestResource;
+import org.globus.wsrf.encoding.DialectDependentSerializer;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.Constants;
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.message.Text;
+import org.apache.axis.encoding.ser.SimpleSerializerFactory;
+
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.utils.AnyHelper;
+import org.globus.wsrf.tests.basic.TestPortType;
+
+import org.oasis.wsrf.properties.QueryExpressionType;
+import org.oasis.wsrf.properties.QueryResourceProperties_Element;
+import org.oasis.wsrf.properties.QueryResourcePropertiesResponse;
+import org.oasis.wsrf.properties.InvalidQueryExpressionFaultType;
+import org.oasis.wsrf.properties.QueryEvaluationErrorFaultType;
+import org.oasis.wsrf.properties.ResourceUnknownFaultType;
+import org.oasis.wsrf.properties.UnknownQueryExpressionDialectFaultType;
+
+import org.apache.axis.types.URI;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Node;
+
+import javax.xml.rpc.Service;
+import javax.xml.rpc.encoding.TypeMappingRegistry;
+import javax.xml.rpc.encoding.TypeMapping;
+
+public class QueryResourcePropertiesTests extends PropertiesTestCase {
+
+    private final static String SIMPLE_QUERY = 
+        "boolean(/*/*[namespace-uri()='" + WSRFConstants.LIFETIME_NS + "' and local-name()='TerminationTime'])";
+
+    // return the entire RP document
+    private final static String COMPLEX_QUERY =
+        "/";
+
+    public QueryResourcePropertiesTests(String name) {
+        super(name);
+    }
+
+    private QueryExpressionType createQueryExpression(String dialect,
+                                                      String queryString) 
+        throws IOException {
+        QueryExpressionType query = new QueryExpressionType();
+        query.setDialect(dialect);
+        
+        if (queryString != null) {
+            query.setValue(queryString);
+        }
+
+        return query;
+    }
+    
+    public void testUnknownResource() throws Exception {
+        TestPortType port = 
+            locator.getTestPortTypePort(createEPR(TestHome.BAD_KEY));
+
+        QueryResourceProperties_Element queryRequest = new QueryResourceProperties_Element();
+        queryRequest.setQueryExpression(
+                 createQueryExpression(WSRFConstants.XPATH_1_DIALECT, 
+                                       COMPLEX_QUERY)
+        );
+
+        try {
+            QueryResourcePropertiesResponse queryResponse =
+                port.queryResourceProperties(queryRequest);
+            fail("Did not throw exception");
+        } catch (ResourceUnknownFaultType e) {
+            //it's ok
+        }
+    }
+
+    public void testUnknownQueryExpressionDialect() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        QueryResourceProperties_Element queryRequest = new QueryResourceProperties_Element();
+        String dialect = "http://foobar";
+        queryRequest.setQueryExpression(
+                 createQueryExpression(dialect, COMPLEX_QUERY)
+        );
+
+        // register client mapping for fake dialect
+        TypeMappingRegistry tmr = ((Service)locator).getTypeMappingRegistry();
+        TypeMapping tm = tmr.getTypeMapping("");
+
+        DialectDependentSerializer sf = 
+            (DialectDependentSerializer)tm.getSerializer(
+                                  QueryExpressionType.class, 
+                                  null).getSerializerAs("");
+        sf.registerSerializerFactory(new URI(dialect), 
+                                     new SimpleSerializerFactory(
+                                         String.class,
+                                         Constants.XSD_STRING));
+
+        try {
+            QueryResourcePropertiesResponse queryResponse =
+                port.queryResourceProperties(queryRequest);
+            fail("Did not throw exception");
+        } catch (UnknownQueryExpressionDialectFaultType e) {
+            //it's ok
+        }
+    }
+
+    public void testQueryEvaluationError() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        QueryResourceProperties_Element queryRequest = new QueryResourceProperties_Element();
+        queryRequest.setQueryExpression(
+                 createQueryExpression(WSRFConstants.XPATH_1_DIALECT, "\\")
+        );
+
+        try {
+            QueryResourcePropertiesResponse queryResponse =
+                port.queryResourceProperties(queryRequest);
+            fail("Did not throw exception as expected");
+        } catch (QueryEvaluationErrorFaultType e) {
+            //it's ok
+        }
+    }
+
+    public void testInvalidQueryExpression() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        QueryResourcePropertiesResponse queryResponse = null;
+
+        QueryResourceProperties_Element queryRequest = new QueryResourceProperties_Element();
+        queryRequest.setQueryExpression(
+                 createQueryExpression(WSRFConstants.XPATH_1_DIALECT, "")
+        );
+
+        try {
+            queryResponse = port.queryResourceProperties(queryRequest);
+            fail("Did not throw exception as expected");
+        } catch (InvalidQueryExpressionFaultType e) {
+            //it's ok
+        }
+
+        queryRequest.setQueryExpression(
+                 createQueryExpression(WSRFConstants.XPATH_1_DIALECT, null)
+        );
+
+        try {
+            queryResponse = port.queryResourceProperties(queryRequest);
+            fail("Did not throw exception as expected");
+        } catch (InvalidQueryExpressionFaultType e) {
+            //it's ok
+        }
+    }
+
+    // these hopefully oneday be more specific in the spec
+    public void testOtherErrors() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        QueryResourcePropertiesResponse queryResponse = null;
+
+        QueryResourceProperties_Element queryRequest = null;
+
+        // no request
+        try {
+            queryResponse = port.queryResourceProperties(queryRequest);
+            fail("Did not throw exception as expected");
+        } catch (AxisFault e) {
+            // TODO: very unspecific
+        }
+
+        queryRequest = new QueryResourceProperties_Element();
+
+        try {
+            queryResponse = port.queryResourceProperties(queryRequest);
+            fail("Did not throw exception as expected");
+        } catch (AxisFault e) {
+            // TODO: very unspecific
+        }
+
+        queryRequest.setQueryExpression(new QueryExpressionType());
+
+        try {
+            queryResponse = port.queryResourceProperties(queryRequest);
+            fail("Did not throw exception as expected");
+        } catch (AxisFault e) {
+            // TODO: very unspecific
+        }
+    }
+
+    public void testSimpleContentQuery() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+        
+        QueryResourceProperties_Element queryRequest = new QueryResourceProperties_Element();
+
+        queryRequest.setQueryExpression(
+                 createQueryExpression(WSRFConstants.XPATH_1_DIALECT,
+                                       SIMPLE_QUERY)
+        );
+
+        QueryResourcePropertiesResponse queryResponse =
+            port.queryResourceProperties(queryRequest);
+        
+        MessageElement [] any = queryResponse.get_any();
+        assertTrue(any != null);
+        assertTrue(any.length > 0);
+        assertEquals(Node.TEXT_NODE, any[0].getNodeType());
+        assertEquals("true", any[0].getNodeValue());
+    }
+    
+    public void testComplexContentQuery() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+        
+        QueryResourceProperties_Element queryRequest = new QueryResourceProperties_Element();
+
+        queryRequest.setQueryExpression(
+                 createQueryExpression(WSRFConstants.XPATH_1_DIALECT,
+                                       COMPLEX_QUERY)
+        );
+
+        QueryResourcePropertiesResponse queryResponse =
+            port.queryResourceProperties(queryRequest);
+        
+        MessageElement [] any = queryResponse.get_any();
+        assertTrue(any != null);
+        assertTrue(any.length > 0);
+
+        System.out.println(AnyHelper.toSingleString(any));
+
+        QName [] propNames =
+            new QName[] {TestResource.VALUE_RP,
+                         WSRFConstants.CURRENT_TIME};
+
+        boolean found = false;
+        for (int i=0;i<propNames.length;i++) {
+            found = false;
+            Iterator iter = any[0].getChildElements();
+            while(iter.hasNext()) {
+                if (propNames[i].equals(((MessageElement)iter.next()).getQName())) {
+                    found = true;
+                    break;
+                }
+            }
+            if (!found) {
+                fail("Did not return expected RP: " + propNames[i]);
+            }
+        }
+    }
+    
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/SetResourcePropertiesTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/SetResourcePropertiesTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/properties/SetResourcePropertiesTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,231 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.properties;
+
+import java.util.Calendar;
+
+import org.globus.wsrf.impl.TestHome;
+import org.globus.wsrf.impl.TestResource;
+
+import org.apache.axis.message.MessageElement;
+
+import org.globus.wsrf.WSRFConstants;
+import org.globus.wsrf.encoding.ObjectDeserializer;
+import org.globus.wsrf.encoding.ObjectSerializer;
+import org.globus.wsrf.tests.basic.TestPortType;
+
+import org.oasis.wsrf.properties.ResourceUnknownFaultType;
+import org.oasis.wsrf.properties.GetResourcePropertyResponse;
+import org.oasis.wsrf.properties.InvalidResourcePropertyQNameFaultType;
+import org.oasis.wsrf.properties.SetResourcePropertyRequestFailedFaultType;
+import org.oasis.wsrf.properties.UnableToModifyResourcePropertyFaultType;
+import org.oasis.wsrf.properties.SetResourceProperties_Element;
+import org.oasis.wsrf.properties.SetResourcePropertiesResponse;
+import org.oasis.wsrf.properties.DeleteType;
+import org.oasis.wsrf.properties.InsertType;
+import org.oasis.wsrf.properties.UpdateType;
+
+import javax.xml.namespace.QName;
+
+public class SetResourcePropertiesTests extends PropertiesTestCase {
+
+    public SetResourcePropertiesTests(String name) {
+        super(name);
+    }
+
+    public void testUnknownResource() throws Exception {
+        TestPortType port = 
+            locator.getTestPortTypePort(createEPR(TestHome.BAD_KEY));
+
+        SetResourceProperties_Element propRequest = 
+            new SetResourceProperties_Element();
+        
+        try {
+            SetResourcePropertiesResponse propResponse = 
+                port.setResourceProperties(propRequest);
+            fail("Did not throw exception");
+        } catch (ResourceUnknownFaultType e) {
+            //it's ok
+        }
+    }
+    
+    // test changing of CurrentTime RP via SetRP operation.
+    public void testChangeCurrentTime() throws Exception {
+        testChangeTimeRP(WSRFConstants.CURRENT_TIME);
+    }
+    
+    // test changing of TerminationTime RP via SetRP operation.
+    public void testChangeTerminationTime() throws Exception {
+        testChangeTimeRP(WSRFConstants.TERMINATION_TIME);
+    }
+
+    private void testChangeTimeRP(QName name) throws Exception {
+        MessageElement [] elements = new MessageElement[1];
+        SetResourceProperties_Element request = null;
+
+        Calendar value = Calendar.getInstance();
+        value.add(Calendar.SECOND, 30);
+
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        // test insert
+        InsertType insert = new InsertType();
+        elements[0] =
+            (MessageElement)ObjectSerializer.toSOAPElement(value, name);
+        insert.set_any(elements);
+        
+        request = new SetResourceProperties_Element();
+        request.setInsert(insert);
+        
+        try {
+            port.setResourceProperties(request);
+            fail("did not throw an exception");
+        } catch (UnableToModifyResourcePropertyFaultType e) {
+            // that's what we want
+        }
+
+        // test update
+        UpdateType update = new UpdateType();
+        elements[0] =
+            (MessageElement)ObjectSerializer.toSOAPElement(value, name);
+        update.set_any(elements);
+        
+        request = new SetResourceProperties_Element();
+        request.setUpdate(update);
+        
+        try {
+            port.setResourceProperties(request);
+            fail("did not throw an exception");
+        } catch (UnableToModifyResourcePropertyFaultType e) {
+            // that's what we want
+        }
+
+        // test delete
+        DeleteType delete = new DeleteType();
+        delete.setResourceProperty(name);
+
+        request = new SetResourceProperties_Element();
+        request.setDelete(delete);
+                
+        try {
+            port.setResourceProperties(request);
+            fail("did not throw an exception");
+        } catch (UnableToModifyResourcePropertyFaultType e) {
+            // that's what we want
+        }
+    }
+
+    public void testDeleteNoRP() throws Exception {
+        testDelete(null);
+    }
+    
+    public void testDeleteWrongRP() throws Exception {
+        testDelete(new QName("http://foo", "bar"));
+    }
+
+    private void testDelete(QName rp) throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+        
+        // test delete
+        DeleteType delete = new DeleteType();
+        delete.setResourceProperty(rp);
+        
+        SetResourceProperties_Element request = new SetResourceProperties_Element();
+        request.setDelete(delete);
+                
+        try {
+            port.setResourceProperties(request);
+            fail("did not throw an exception");
+        } catch (InvalidResourcePropertyQNameFaultType e) {
+            // that's what we want
+        }
+    }
+
+    public void testModifyRP() throws Exception {
+        TestPortType port = locator.getTestPortTypePort(getServiceAddress());
+        port = locator.getTestPortTypePort(createResource(port));
+
+        SetResourceProperties_Element request = null;
+        GetResourcePropertyResponse propResponse = null;
+        MessageElement [] result = null;
+
+        QName rp = TestResource.VALUE_RP;
+
+        // test delete
+        DeleteType delete = new DeleteType();
+        delete.setResourceProperty(rp);
+        
+        request = new SetResourceProperties_Element();
+        request.setDelete(delete);
+        port.setResourceProperties(request);
+        
+        propResponse = port.getResourceProperty(rp);
+        result = propResponse.get_any();
+        assertTrue(result == null);
+
+        MessageElement [] elements = null;
+
+        // test insert
+        InsertType insert = new InsertType();
+        int num = 2;
+        elements = new MessageElement[num];
+        for (int i=0;i<num;i++) {
+            elements[i] =
+                (MessageElement)ObjectSerializer.toSOAPElement(new Integer(i), 
+                                                               rp);
+        }
+        insert.set_any(elements);
+
+        request = new SetResourceProperties_Element();
+        request.setInsert(insert);
+
+        port.setResourceProperties(request);
+
+        propResponse = port.getResourceProperty(rp);
+        result = propResponse.get_any();
+        assertTrue(result != null);
+        assertEquals(num, result.length);
+        for (int i=0;i<num;i++) {
+            Integer value = 
+                (Integer)ObjectDeserializer.toObject(result[i], Integer.class);
+            assertEquals(new Integer(i), value);
+        }
+
+        // test update
+        UpdateType update = new UpdateType();
+        elements = new MessageElement[1];
+        elements[0] =
+            (MessageElement)ObjectSerializer.toSOAPElement(new Integer(90), 
+                                                           rp);
+        update.set_any(elements);
+
+        request = new SetResourceProperties_Element();
+        request.setUpdate(update);
+        
+        port.setResourceProperties(request);
+
+        propResponse = port.getResourceProperty(rp);
+        result = propResponse.get_any();
+        assertTrue(result != null);
+        assertEquals(1, result.length);
+        Integer value = 
+            (Integer)ObjectDeserializer.toObject(result[0], Integer.class);
+        assertEquals(new Integer(90), value);
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecureServiceAccessTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecureServiceAccessTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecureServiceAccessTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTestResource.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTestResource.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTestResource.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTestResourceHome.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTestResourceHome.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTestResourceHome.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTestService.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTestService.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTestService.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,374 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security;
+
+import java.rmi.RemoteException;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import java.io.IOException;
+
+import org.globus.wsrf.config.ConfigException;
+
+import org.globus.wsrf.tests.security.GsiSec;
+import org.globus.wsrf.tests.security.GetValue;
+import org.globus.wsrf.tests.security.GsiSecConvDeleg;
+import org.globus.wsrf.tests.security.GsiSecConvIntegrity;
+import org.globus.wsrf.tests.security.GsiSecConvOnly;
+import org.globus.wsrf.tests.security.GsiSecConvPrivacy;
+import org.globus.wsrf.tests.security.GsiTransportIntegrity;
+import org.globus.wsrf.tests.security.GsiTransportOnly;
+import org.globus.wsrf.tests.security.GsiTransportPrivacy;
+import org.globus.wsrf.tests.security.GsiSecMsgOnly;
+import org.globus.wsrf.tests.security.SetServiceAuthzOutput;
+import org.globus.wsrf.tests.security.CreateResourceResponse;
+import org.globus.wsrf.tests.security.SetAnonymousAuthzResponse;
+import org.globus.wsrf.tests.security.SetAnonymousAuthz;
+
+
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.ResourceContext;
+import org.globus.wsrf.utils.AddressingUtils;
+import org.globus.wsrf.utils.ContextUtils;
+
+import org.globus.wsrf.container.ServiceHost;
+
+import javax.security.auth.Subject;
+
+import org.globus.wsrf.security.SecurityManager;
+
+import org.globus.wsrf.impl.security.descriptor.ServiceSecurityConfig;
+import org.globus.wsrf.impl.security.descriptor.TestContainerSecurityConfig;
+
+import org.globus.wsrf.impl.security.authorization.Authorization;
+
+import org.globus.wsrf.impl.security.util.PDPUtils;
+
+import org.globus.wsrf.impl.security.descriptor.ContainerSecurityConfig;
+import org.globus.wsrf.impl.security.descriptor.SecurityPropertiesHelper;
+import org.globus.wsrf.impl.security.descriptor.ServiceSecurityDescriptor;
+
+import org.globus.security.gridmap.GridMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.MessageContext;
+import org.apache.axis.handlers.soap.SOAPService;
+
+/**
+ * This class is used by two test services. The first one is used to
+ * test various authentication schemes, with authz set to self. In the
+ * second case, the custom authz option with SAMLAuthzCallout is
+ * tested. If property customAuthzTest is set to true, then the
+ * security descriptor is altered to set authz to custom, load custom
+ * authz class and authz service. Authz service is set to string
+ * passed to that noAuth operation, if null, it is constructed to be
+ * TestAuthzService in the same container as the service. The propery
+ * customAuthzTest is reset, so the above is not repeated for every
+ * call to noAuth method.
+ */
+public class SecurityTestService {
+
+    public static final String CRED_FROM_CONTEXT = "credFromContext";
+
+    private static final String CONTAINER_DESC =
+        "org/globus/wsrf/impl/security/container-security-config.xml";
+
+    public static final String CUSTOM_AUTHZ_TEST = "customAuthzTest";
+    public static final String authzClassName =
+        "org.globus.wsrf.impl.security.authorization.SAMLAuthorizationCallout";
+
+    static Log logger = LogFactory.getLog(SecurityTestService.class.getName());
+
+    public void noAuth(String authzService) throws RemoteException {
+        logger.debug("No Auth");
+
+        MessageContext msgCtx = MessageContext.getCurrentContext();
+        String customAuthTest =
+            (String)ContextUtils.getServiceProperty(msgCtx, CUSTOM_AUTHZ_TEST);
+        if ((customAuthTest != null) && (customAuthTest.equals("true"))) {
+            logger.debug("reworking security settings");
+            // set authz service
+            try {
+                if (authzService == null) {
+                    authzService = ServiceHost.getBaseURL(msgCtx) +
+                                   TestConstants.TEST_AUTHZ_SERVICE;
+                }
+                SOAPService service =
+                    (SOAPService)msgCtx.getService();
+                service.setOption("authzService", authzService);
+                logger.debug("Authz service set to " + authzService);
+                // reset so its not done in each call
+                service.setOption(CUSTOM_AUTHZ_TEST, "");
+            } catch (IOException exp) {
+                throw new RemoteException("", exp);
+            }
+            logger.error(ContextUtils.getTargetServicePath(msgCtx));
+            // set custom authz class (would not have been initialized
+            // since authz was initially null
+            String servicePath = ContextUtils.getTargetServicePath(msgCtx);
+            try {
+                ServiceSecurityDescriptor desc =
+                    (ServiceSecurityDescriptor)ServiceSecurityConfig
+                    .getSecurityDescriptor(servicePath);
+                desc.setAuthzChain(
+                    PDPUtils.getServiceAuthzChain(Authorization.AUTHZ_SAML,
+                                                  TestConstants.SECURITY_SERVICE_PATH));
+                ServiceSecurityConfig.setSecurityDescriptor(desc, servicePath);
+            } catch (ConfigException exp) {
+                throw new RemoteException("", exp);
+            }
+        }
+    }
+
+    public void gsiSecConvDeleg(GsiSecConvDeleg param)
+        throws RemoteException {
+        logger.debug("Sec Conv Deleg");
+    }
+
+    public void gsiTransportIntegrity(GsiTransportIntegrity param)
+        throws RemoteException {
+        logger.error("tansport integrity");
+    }
+
+    public void gsiTransportPrivacy(GsiTransportPrivacy param)
+        throws RemoteException {
+        logger.error("transport privacy");
+    }
+
+    public void gsiTransportOnly(GsiTransportOnly param)
+        throws RemoteException {
+        logger.error("transport only");
+    }
+
+    public void gsiSecConvIntegrity(GsiSecConvIntegrity param)
+        throws RemoteException {
+        logger.debug("Sec Conv integrity");
+    }
+
+    public void gsiSecConvPrivacy(GsiSecConvPrivacy param)
+        throws RemoteException {
+        logger.debug("Sec Conv privacy");
+    }
+
+    public void gsiSecConvOnly(GsiSecConvOnly param) throws RemoteException {
+        logger.debug("sec conv only");
+    }
+
+    public void gsiSecMsgOnly(GsiSecMsgOnly param) throws RemoteException {
+        logger.debug("sec msg only");
+    }
+
+    public void gsiSec(GsiSec param) throws RemoteException {
+        logger.debug("any gsi sec only");
+    }
+
+    public CreateResourceResponse createResource(boolean param)
+        throws RemoteException {
+
+        // Alter global property
+        if (param) {
+            // Force a initialization
+            try {
+                TestContainerSecurityConfig
+                    .initContainerConfig(CONTAINER_DESC);
+                ContainerSecurityConfig containerConfig =
+                    ContainerSecurityConfig.getConfig();
+            } catch (Exception exp) {
+                throw new RemoteException("", exp);
+            }
+        }
+
+        ResourceContext ctx = null;
+        SecurityTestResourceHome home = null;
+        ResourceKey key = null;
+
+        try {
+            ctx = ResourceContext.getResourceContext();
+            home = (SecurityTestResourceHome) ctx.getResourceHome();
+            key = home.create();
+        } catch(Exception e) {
+            throw new RemoteException("", e);
+        }
+
+        EndpointReferenceType epr = null;
+        try {
+            epr = AddressingUtils.createEndpointReference(ctx, key);
+        } catch(Exception e) {
+            throw new RemoteException("", e);
+        }
+
+        CreateResourceResponse response = new CreateResourceResponse();
+        response.setEndpointReference(epr);
+        return response;
+    }
+
+    // Assume if authzMethod is set to "cred", then invocation subject
+    // is set as service subject.
+    public void alterSecurityDesc(String authMethodName)
+        throws RemoteException {
+
+        logger.debug("Alter security desc " + authMethodName);
+
+        if ((authMethodName != null) &&
+            (authMethodName.equals(CRED_FROM_CONTEXT))) {
+
+                Subject sub = null;
+                try {
+                    sub = ServiceSecurityConfig
+                        .getSubject(TestConstants.SECURITY_SERVICE_PATH);
+                } catch (ConfigException exp) {
+                    throw new RemoteException("Error getting subject", exp);
+                }
+                if (sub != null)
+                    throw new RemoteException("Inital subject is not null");
+
+                SecurityManager man = SecurityManager.getManager();
+                man.setServiceOwnerFromContext();
+                Subject invokedSub = man.getServiceSubject();
+                if (invokedSub == null)
+                    throw new RemoteException("Invoked subject is null");
+                logger.debug("Invoked subject" + invokedSub);
+
+                logger.debug("Now test resource");
+                SecurityTestResource res = getResource();
+                res.alterSecurityDesc(authMethodName);
+                return;
+            }
+
+
+        SecurityTestResource res = getResource();
+        logger.debug("invoking alter sec");
+        res.alterSecurityDesc(authMethodName);
+    }
+
+    public void setAuthz(String authz) throws RemoteException {
+
+        logger.debug("Alter security desc " + authz);
+
+        SecurityTestResource res = getResource();
+        try {
+            logger.debug("invoking alter sec");
+            res.setAuthz(authz);
+        } catch (Exception exp) {
+            throw new RemoteException("Error setting security desc", exp);
+        }
+    }
+
+    public SetAnonymousAuthzResponse setAnonymousAuthz(
+        SetAnonymousAuthz setAnonymousAuthz) throws RemoteException {
+        logger.debug("Changing to identity authz with anonymous authorized user");
+
+        SecurityTestResource res = getResource();
+        try {
+            logger.debug("invoking alter sec");
+            res.setAnonymousAuthz();
+        } catch (Exception exp) {
+            throw new RemoteException("Error setting security desc", exp);
+        }
+        return new SetAnonymousAuthzResponse();
+    }
+
+    public void setValue(int val) throws RemoteException {
+
+        logger.debug("Set value " + val);
+        SecurityTestResource res = getResource();
+        res.setValue(val);
+    }
+
+    public int getValue(GetValue param) throws RemoteException {
+
+        logger.debug("Get value ");
+        SecurityTestResource res = getResource();
+        return res.getValue();
+    }
+
+    public String getSecurityProperty(String argName) throws RemoteException {
+        String value = null;
+        try {
+            if (argName.equals("replayWindow")) {
+                value = SecurityPropertiesHelper
+                    .getReplayAttackWindow(TestConstants.SECURITY_SERVICE_PATH,
+                                           null);
+            } else if (argName.equals("replayFilter")) {
+                value = SecurityPropertiesHelper
+                    .getReplayAttackFilter(TestConstants.SECURITY_SERVICE_PATH,
+                                           null);
+            }
+        } catch (ConfigException exp) {
+            throw new RemoteException("", exp);
+        }
+        return value;
+    }
+
+    public SetServiceAuthzOutput setServiceAuthz(String parameters)
+        throws RemoteException {
+
+        // this is set for authz to fail, if used!
+        if ((parameters != null) && (parameters.equals("self"))) {
+            try {
+                String prop = (String)ContextUtils
+                    .getServiceProperty(MessageContext.getCurrentContext(),
+                                        TestConstants.SECURITY_SERVICE_PATH,
+                                        Authorization.IDENTITY_PREFIX + "-"
+                                        + Authorization.AUTHZ_IDENTITY);
+                if ((prop != null) && (parameters != null)) {
+                    parameters = "identity";
+                }
+            } catch (Exception exp) {
+                throw new RemoteException("", exp);
+            }
+        }
+        System.out.println("CHECK THIS " + parameters);
+        try {
+            ServiceSecurityDescriptor desc =
+                ServiceSecurityConfig
+                .getSecurityDescriptor(TestConstants.SECURITY_SERVICE_PATH);
+            desc.setAuthzChain(PDPUtils
+                               .getServiceAuthzChain(parameters,
+                                                     TestConstants.SECURITY_SERVICE_PATH));
+            if ((parameters != null) && (parameters.equals("gridmap"))) {
+                GridMap gridMap = new GridMap();
+                gridMap.map("Some DN", "some id");
+                desc.setGridMap(gridMap);
+            }
+            ServiceSecurityConfig
+                .setSecurityDescriptor(desc,
+                                       TestConstants.SECURITY_SERVICE_PATH);
+        } catch (ConfigException exp) {
+            throw new RemoteException("", exp);
+        }
+        return new SetServiceAuthzOutput();
+    }
+
+    private SecurityTestResource getResource() throws RemoteException {
+
+        Object obj = null;
+        try {
+            obj = ResourceContext.getResourceContext().getResource();
+        } catch(Exception e) {
+            throw new RemoteException("Error getting resource", e);
+        }
+
+        if (obj == null) {
+            logger.debug("Resource is null");
+            throw new RemoteException("bad key set, resource not found");
+        }
+
+        return (SecurityTestResource)obj;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/SecurityTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,39 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security;
+
+import org.globus.wsrf.test.GridTestSuite;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestResult;
+
+public class SecurityTests extends GridTestSuite {
+
+    public SecurityTests(String name) {
+        super(name);
+    }
+    
+    public void run(TestResult result) {
+	super.run(result);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new SecurityTests("SecureServiceAccessTests");
+	suite.addTestSuite(SecureServiceAccessTest.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/TestConstants.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/TestConstants.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/TestConstants.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,56 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security;
+
+import org.globus.wsrf.impl.security.authorization.Authorization;
+import org.globus.wsrf.impl.security.authorization.SelfAuthorization;
+import org.globus.wsrf.impl.security.authorization.HostAuthorization;
+
+public class TestConstants {
+
+    public static final String SECURITY_SERVICE_PATH = "SecurityTestService";
+    public static final String CUSTOM_AUTHZ_SERVICE_PATH = 
+        "AuthzCalloutTestService";
+    public static final String TEST_AUTHZ_SERVICE = "TestAuthzService";
+    public static final String TEST_CLIENT_AUTHZ_PROP = "TEST_CLIENT_AUTHZ"; 
+
+    public static Authorization getConfiguredClientAuthz() {
+        Authorization authz = null;
+        String authzStr = 
+            System.getProperty(TestConstants.TEST_CLIENT_AUTHZ_PROP);
+        if ((authzStr != null) &&
+            (authzStr.equals(Authorization.AUTHZ_HOST))) {
+            authz = HostAuthorization.getInstance();
+        } else {
+            authz = SelfAuthorization.getInstance();
+        }
+        return authz;
+    }
+
+    public static org.globus.gsi.gssapi.auth.Authorization 
+        getConfiguredClientGSIAuthz() {
+        org.globus.gsi.gssapi.auth.Authorization authz = null;
+        String authzStr = 
+            System.getProperty(TestConstants.TEST_CLIENT_AUTHZ_PROP);
+        if ((authzStr != null) &&
+            (authzStr.equals(Authorization.AUTHZ_HOST))) {
+            authz = org.globus.gsi.gssapi.auth.HostAuthorization.getInstance();
+        } else {
+            authz = org.globus.gsi.gssapi.auth.SelfAuthorization.getInstance();
+        }
+        return authz;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/SecurityTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/SecurityTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/SecurityTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,36 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authentication;
+
+import org.globus.wsrf.test.GridTestSuite;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class SecurityTests extends GridTestSuite {
+
+    public SecurityTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new SecurityTests("SoapSecurityTests");
+        suite.addTestSuite(TestGssXMLSignature.class);
+        suite.addTestSuite(TestGssXMLEncryption.class);
+        suite.addTestSuite(TestWSSecurity.class);
+        suite.addTestSuite(TestReplayAttackFilter.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestGssXMLEncryption.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestGssXMLEncryption.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestGssXMLEncryption.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,219 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authentication;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.Message;
+import org.apache.axis.MessageContext;
+import org.apache.axis.client.AxisClient;
+import org.apache.axis.configuration.NullProvider;
+import org.apache.axis.message.SOAPBodyElement;
+import org.apache.axis.message.SOAPEnvelope;
+
+import org.gridforum.jgss.ExtendedGSSManager;
+import org.ietf.jgss.GSSContext;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSManager;
+
+import org.globus.gsi.gssapi.GSSConstants;
+import org.globus.wsrf.impl.security.authentication.encryption.GssEncryptedSOAPEnvelopeBuilder;
+import org.globus.wsrf.impl.security.authentication.secureconv.service.SecurityContext;
+import org.globus.wsrf.impl.security.authentication.wssec.GSSConfig;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+
+public class TestGssXMLEncryption extends TestCase {
+    static Log logger = LogFactory.getLog(TestGssXMLEncryption.class.getName());
+    SecurityContext clientContext;
+    SecurityContext serverContext;
+    MessageContext msgContext;
+    static final String NS = "http://www.w3.org/2000/09/xmldsig#";
+    static final String soapMsg =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+        "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
+        "<SOAP-ENV:Body>\r\n" +
+        "<add xmlns=\"http://samples.wsrf.globus.org/counter/counter_port_type\">\r\n" +
+        "<value xmlns=\"\">15</value>\r\n" + "</add>\r\n" +
+        "</SOAP-ENV:Body>\r\n" + "</SOAP-ENV:Envelope>";
+    SOAPEnvelope clearEnvelope;
+
+    static {
+        GSSConfig.init();
+    }
+
+    public TestGssXMLEncryption(String name) {
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestGssXMLEncryption.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    protected void setUp() throws Exception {
+        createContexts();
+
+        AxisClient tmpEngine = new AxisClient(new NullProvider());
+        msgContext = new MessageContext(tmpEngine);
+
+        clearEnvelope = getSOAPEnvelope();
+    }
+
+    protected SOAPEnvelope getSOAPEnvelope() throws Exception {
+        InputStream in = new ByteArrayInputStream(soapMsg.getBytes());
+        Message msg = new Message(in);
+        msg.setMessageContext(msgContext);
+
+        return msg.getSOAPEnvelope();
+    }
+
+    protected void createContexts() throws Exception {
+        GSSManager manager = ExtendedGSSManager.getInstance();
+        GSSContext context = manager.createContext((GSSCredential) null);
+        String id = "" + context.hashCode();
+        serverContext = new SecurityContext(context, id);
+        context =
+            manager.createContext(null, GSSConstants.MECH_OID, null,
+                                  GSSContext.DEFAULT_LIFETIME);
+        clientContext = new SecurityContext(context, id);
+
+        clientContext.getContext().requestConf(false);
+        clientContext.getContext().requestCredDeleg(false);
+    }
+
+    protected void tearDown() throws Exception {
+        if (clientContext != null) {
+            clientContext.getContext().dispose();
+        }
+
+        if (serverContext != null) {
+            serverContext.getContext().dispose();
+        }
+    }
+
+    private void establishContext() throws Exception {
+        assertTrue("client ctx already established.",
+                   !clientContext.getContext().isEstablished());
+        assertTrue("server ctx already established.",
+                   !serverContext.getContext().isEstablished());
+
+        byte[] inToken = new byte[0];
+        byte[] outToken = null;
+
+        while (!clientContext.getContext().isEstablished()) {
+            outToken = clientContext.getContext().initSecContext(inToken, 0,
+                                                    inToken.length);
+
+            if (outToken != null) {
+                inToken = serverContext.getContext().acceptSecContext(outToken, 0,
+                                                         outToken.length);
+            }
+        }
+
+        assertTrue("client ctx not established.",
+                   clientContext.getContext().isEstablished());
+        assertTrue("server ctx not established.",
+                   serverContext.getContext().isEstablished());
+    }
+
+    // tests
+    public void testSuccessfulDecrypt() throws Exception {
+        establishContext();
+
+        SOAPEnvelope encryptedEnvelope = null;
+        GssEncryptedSOAPEnvelopeBuilder builder =
+            new GssEncryptedSOAPEnvelopeBuilder(null, clientContext);
+        encryptedEnvelope = (SOAPEnvelope) builder.build(clearEnvelope);
+        decrypt(encryptedEnvelope, serverContext);
+    }
+
+    public void testRemoveBodyDecrypt() throws Exception {
+        establishContext();
+
+        SOAPEnvelope encryptedEnvelope = null;
+        GssEncryptedSOAPEnvelopeBuilder builder =
+            new GssEncryptedSOAPEnvelopeBuilder(null, clientContext);
+        encryptedEnvelope = (SOAPEnvelope) builder.build(clearEnvelope);
+
+        SOAPBodyElement el = encryptedEnvelope.getFirstBody();
+
+        encryptedEnvelope.removeBodyElement(el);
+
+        try {
+            decrypt(encryptedEnvelope, serverContext);
+            fail("Encryption verification did not fail as expected.");
+        } catch (Exception e) {
+            // this should fail
+            logger.debug(e);
+        }
+    }
+
+    // should fail
+    public void testDecryptWithWrongContext() throws Exception {
+        establishContext();
+
+        SecurityContext pClientContext = clientContext;
+        SecurityContext pServerContext = serverContext;
+
+        createContexts();
+
+        establishContext();
+
+        SOAPEnvelope encryptedEnvelope = null;
+        GssEncryptedSOAPEnvelopeBuilder builder =
+            new GssEncryptedSOAPEnvelopeBuilder(null, clientContext);
+        encryptedEnvelope = (SOAPEnvelope) builder.build(clearEnvelope);
+
+        try {
+            // verify with old server context
+            decrypt(encryptedEnvelope, pServerContext);
+            fail("Encryption verification did not fail as expected.");
+        } catch (Exception e) {
+            // this should fail
+            logger.debug(e);
+        } finally {
+            try {
+                pClientContext.getContext().dispose();
+            } catch (Exception e) {
+            }
+
+            try {
+                pServerContext.getContext().dispose();
+            } catch (Exception e) {
+            }
+        }
+    }
+
+    private void decrypt(
+        SOAPEnvelope env,
+        SecurityContext context
+    ) throws Exception {
+        VerifyWSSecurity h = new VerifyWSSecurity(context.getContext());
+        msgContext.setProperty(Constants.CONTEXT, context);
+        h.processSecurityHeader(env, "", msgContext, false);
+        msgContext.setProperty(Constants.CONTEXT, null);
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestGssXMLSignature.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestGssXMLSignature.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestGssXMLSignature.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,305 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authentication;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.apache.xml.security.signature.XMLSignatureException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.Message;
+import org.apache.axis.MessageContext;
+import org.apache.axis.client.AxisClient;
+import org.apache.axis.configuration.NullProvider;
+import org.apache.axis.message.SOAPBodyElement;
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.axis.message.SOAPHeaderElement;
+
+import org.gridforum.jgss.ExtendedGSSManager;
+import org.ietf.jgss.GSSContext;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSManager;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+import org.globus.gsi.gssapi.GSSConstants;
+import org.globus.wsrf.impl.security.authentication.signature.GssSignedSOAPEnvelopeBuilder;
+import org.globus.wsrf.impl.security.authentication.wssec.GSSConfig;
+import org.globus.wsrf.impl.security.authentication.wssec.WSSecurityException;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class TestGssXMLSignature extends TestCase {
+    static Log logger = LogFactory.getLog(TestGssXMLSignature.class.getName());
+    GSSContext clientContext;
+    GSSContext serverContext;
+    MessageContext msgContext;
+    static final String NS = "http://www.w3.org/2000/09/xmldsig#";
+    static final String soapMsg =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+        "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n" +
+        "<SOAP-ENV:Body>\r\n" +
+        "<add xmlns=\"http://samples.wsrf.globus.org/counter/counter_port_type\">\r\n" +
+        "<value xmlns=\"\">15</value>\r\n" + "</add>\r\n" +
+        "</SOAP-ENV:Body>\r\n" + "</SOAP-ENV:Envelope>";
+    SOAPEnvelope unsignedEnvelope;
+
+    static {
+        GSSConfig.init();
+    }
+
+    public TestGssXMLSignature(String name) {
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestGssXMLSignature.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    protected void setUp() throws Exception {
+        createContexts();
+
+        AxisClient tmpEngine = new AxisClient(new NullProvider());
+        msgContext = new MessageContext(tmpEngine);
+
+        unsignedEnvelope = getSOAPEnvelope();
+    }
+
+    protected SOAPEnvelope getSOAPEnvelope() throws Exception {
+        InputStream in = new ByteArrayInputStream(soapMsg.getBytes());
+        Message msg = new Message(in);
+        msg.setMessageContext(msgContext);
+
+        return msg.getSOAPEnvelope();
+    }
+
+    protected void createContexts() throws Exception {
+        GSSManager manager = ExtendedGSSManager.getInstance();
+
+        serverContext = manager.createContext((GSSCredential) null);
+
+        clientContext =
+            manager.createContext(null, GSSConstants.MECH_OID, null,
+                                  GSSContext.DEFAULT_LIFETIME);
+
+        clientContext.requestConf(false);
+        clientContext.requestCredDeleg(false);
+    }
+
+    protected void tearDown() throws Exception {
+        if (clientContext != null) {
+            clientContext.dispose();
+        }
+
+        if (serverContext != null) {
+            serverContext.dispose();
+        }
+    }
+
+    private void establishContext() throws Exception {
+        assertTrue("client ctx already established.",
+                   !clientContext.isEstablished());
+        assertTrue("server ctx already established.",
+                   !serverContext.isEstablished());
+
+        byte[] inToken = new byte[0];
+        byte[] outToken = null;
+
+        while (!clientContext.isEstablished()) {
+            outToken = clientContext.initSecContext(inToken, 0,
+                                                    inToken.length);
+
+            if (outToken != null) {
+                inToken = serverContext.acceptSecContext(outToken, 0,
+                                                         outToken.length);
+            }
+        }
+
+        assertTrue("client ctx not established.",
+                   clientContext.isEstablished());
+        assertTrue("server ctx not established.",
+                   serverContext.isEstablished());
+    }
+
+    // tests
+    public void testSuccessfulVerify() throws Exception {
+        establishContext();
+
+        GssSignedSOAPEnvelopeBuilder builder =
+            new GssSignedSOAPEnvelopeBuilder(msgContext, clientContext);
+
+        SOAPEnvelope signedEnvelope =
+            (SOAPEnvelope) builder.build(unsignedEnvelope);
+
+        verify(signedEnvelope, serverContext);
+    }
+
+    public void testRemoveBodyVerify() throws Exception {
+        establishContext();
+
+        GssSignedSOAPEnvelopeBuilder builder =
+            new GssSignedSOAPEnvelopeBuilder(msgContext, clientContext);
+
+        SOAPEnvelope signedEnvelope =
+            (SOAPEnvelope) builder.build(unsignedEnvelope);
+
+        SOAPBodyElement el = signedEnvelope.getFirstBody();
+
+        signedEnvelope.removeBodyElement(el);
+
+        try {
+            verify(signedEnvelope, serverContext);
+            fail("Signature verification did not fail as expected.");
+        } catch (WSSecurityException e) {
+            // this should fail
+            logger.debug(e);
+        }
+    }
+
+    public void testChangeBodyVerify() throws Exception {
+        establishContext();
+
+        GssSignedSOAPEnvelopeBuilder builder =
+            new GssSignedSOAPEnvelopeBuilder(msgContext, clientContext);
+
+        SOAPEnvelope signedEnvelope =
+            (SOAPEnvelope) builder.build(unsignedEnvelope);
+
+        SOAPBodyElement el = signedEnvelope.getFirstBody();
+
+        signedEnvelope.removeBodyElement(el);
+
+        Element newEl = el.getAsDOM();
+
+        // Text text = (Text)newEl.getChildNodes().item(1).getFirstChild();
+        Text text =
+            (Text) ((Element) newEl).getElementsByTagName("value").item(0)
+                    .getFirstChild();
+
+        text.setData("16");
+
+        SOAPBodyElement ee = new SOAPBodyElement(newEl);
+
+        signedEnvelope.addBodyElement(ee);
+
+        try {
+            verify(signedEnvelope, serverContext);
+            fail("Signature verification did not fail as expected.");
+        } catch (WSSecurityException e) {
+            // this should fail
+            logger.debug(e);
+        }
+    }
+
+    public void testChangeDigest() throws Exception {
+        establishContext();
+
+        GssSignedSOAPEnvelopeBuilder builder =
+            new GssSignedSOAPEnvelopeBuilder(msgContext, clientContext);
+
+        SOAPEnvelope signedEnvelope =
+            (SOAPEnvelope) builder.build(unsignedEnvelope);
+
+        SOAPHeaderElement header =
+            (SOAPHeaderElement) signedEnvelope.getHeaders().elementAt(0);
+
+        signedEnvelope.removeHeader(header);
+
+        Element headerElement = header.getAsDOM();
+
+        Node digestValue =
+            ((Element) headerElement.getFirstChild()).getElementsByTagNameNS(
+                NS, "DigestValue"
+            ).item(0);
+
+        Text digest = (Text) digestValue.getFirstChild();
+
+        String data = digest.getData();
+        int half = data.length() / 2;
+        StringBuffer buf = new StringBuffer(data.length());
+        buf.append(data.substring(0, half));
+        buf.append("6");
+        buf.append(data.substring(half + 1));
+
+        digest.setData(buf.toString());
+
+        signedEnvelope.addHeader(new SOAPHeaderElement(headerElement));
+
+        try {
+            verify(signedEnvelope, serverContext);
+            fail("Signature verification did not fail as expected.");
+        } catch (WSSecurityException e) {
+            // this should fail
+            logger.debug(e);
+        }
+    }
+
+    // should fails with Bad Record MAC
+    public void testVerifyWithWrongContext() throws Exception {
+        establishContext();
+
+        GSSContext pClientContext = clientContext;
+        GSSContext pServerContext = serverContext;
+
+        createContexts();
+
+        establishContext();
+
+        // sign with new client context
+        GssSignedSOAPEnvelopeBuilder builder =
+            new GssSignedSOAPEnvelopeBuilder(msgContext, clientContext);
+
+        SOAPEnvelope signedEnvelope =
+            (SOAPEnvelope) builder.build(unsignedEnvelope);
+
+        try {
+            // verify with old server context
+            verify(signedEnvelope, pServerContext);
+            fail("Signature verification did not fail as expected.");
+        } catch (XMLSignatureException e) {
+            // this should fail
+            logger.debug(e);
+        } finally {
+            try {
+                pClientContext.dispose();
+            } catch (Exception e) {
+            }
+
+            try {
+                pServerContext.dispose();
+            } catch (Exception e) {
+            }
+        }
+    }
+
+    private void verify(
+        SOAPEnvelope env,
+        GSSContext context
+    ) throws Exception {
+        VerifyWSSecurity h = new VerifyWSSecurity(context);
+        Document doc = h.processSecurityHeader(env, "", msgContext, false);
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestReplayAttackFilter.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestReplayAttackFilter.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestReplayAttackFilter.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,101 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authentication;
+
+import java.util.Calendar;
+import java.util.Random;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.impl.security.authentication.wssec.WSSecurityException;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class TestReplayAttackFilter extends TestCase {
+
+    private static Log logger =
+        LogFactory.getLog(TestReplayAttackFilter.class.getName());
+
+    public TestReplayAttackFilter(String name) {
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestReplayAttackFilter.class);
+    }
+
+    public void testTimestamp() throws Exception {
+        // Valid instance should go thro'
+        Calendar tsstore = Calendar.getInstance();
+        Calendar ts1 = Calendar.getInstance();
+        ts1.setTime(tsstore.getTime());
+        Random random = new Random(System.currentTimeMillis());
+        String nonceVal1 = new Integer(random.nextInt()).toString();
+        VerifyReplayFilter replay = new VerifyReplayFilter();
+        replay.checkMessageValidity(nonceVal1, ts1);
+
+        // after one min, send in same nonce value
+        Thread.sleep(60000);
+        // Replay same msg as is.
+        boolean exp = false;
+        ts1.setTime(tsstore.getTime());
+        try {
+            replay.checkMessageValidity(nonceVal1, ts1);
+        } catch (WSSecurityException e) {
+            assertTrue(e.getErrorCode() == WSSecurityException.FAILURE);
+            assertTrue(e.getMessage().indexOf("Duplicate") != -1);
+            exp = true;
+        }
+        assertTrue(exp);
+
+        // Replay msg with same nonce value, but time changed to be
+        // within window
+        ts1.setTime(tsstore.getTime());
+        ts1.add(Calendar.MINUTE, 2);
+        exp = false;
+        try {
+            replay.checkMessageValidity(nonceVal1, ts1);
+        } catch (WSSecurityException e) {
+            assertTrue(e.getErrorCode() == WSSecurityException.FAILURE);
+            assertTrue(e.getMessage().indexOf("Duplicate") != -1);
+            exp = true;
+        }
+        assertTrue(exp);
+
+        // Replay msg with same nonce value, but time changed to be
+        // outside window
+        ts1.add(Calendar.MINUTE, 6);
+        exp = false;
+        try {
+            replay.checkMessageValidity(nonceVal1, ts1);
+        } catch (WSSecurityException e) {
+            assertTrue(e.getErrorCode() == WSSecurityException.MESSAGE_EXPIRED);
+            exp = true;
+        }
+        assertTrue(exp);
+
+        // Diff nonce value, same timestamp should go thro'
+        String nonceVal2 = new Integer(random.nextInt()).toString();
+        Calendar ts3 = Calendar.getInstance();
+        Calendar ts4 = Calendar.getInstance();
+        ts4.setTime(ts3.getTime());
+        replay.checkMessageValidity(nonceVal2, ts3);
+        String nonceVal3 = new Integer(random.nextInt()).toString();
+        replay.checkMessageValidity(nonceVal3, ts4);
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestWSSecurity.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestWSSecurity.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/TestWSSecurity.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,450 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authentication;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.security.cert.X509Certificate;
+import java.util.HashMap;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.Message;
+import org.apache.axis.MessageContext;
+import org.apache.axis.client.AxisClient;
+import org.apache.axis.configuration.NullProvider;
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.axis.message.addressing.Constants;
+
+import org.gridforum.jgss.ExtendedGSSManager;
+import org.ietf.jgss.GSSContext;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSManager;
+
+import org.globus.gsi.GlobusCredential;
+import org.globus.gsi.gssapi.GSSConstants;
+import org.globus.wsrf.impl.security.authentication.encryption.GssEncryptedSOAPEnvelopeBuilder;
+import org.globus.wsrf.impl.security.authentication.encryption.X509WSEncryptedSOAPEnvelopeBuilder;
+import org.globus.wsrf.impl.security.authentication.secureconv.service.SecurityContext;
+import org.globus.wsrf.impl.security.authentication.signature.GssSignedSOAPEnvelopeBuilder;
+import org.globus.wsrf.impl.security.authentication.signature.X509WSSignedSOAPEnvelopeBuilder;
+import org.globus.wsrf.impl.security.authentication.wssec.GSSConfig;
+import org.globus.wsrf.impl.security.authentication.wssec.WSSecurityException;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class TestWSSecurity extends TestCase {
+    private static Log logger =
+        LogFactory.getLog(TestWSSecurity.class.getName());
+    SecurityContext clientContext;
+    SecurityContext serverContext;
+    MessageContext msgContext;
+    static final String NS = "http://www.w3.org/2000/09/xmldsig#";
+    static final String soapMsg =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+        "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas."
+        + "xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/"
+        + "XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance"
+        + "\" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/03/addressing\">"
+        + "<SOAP-ENV:Header> <wsa:To SOAP-ENV:mustUnderstand=\"0\" "
+        + "xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401"
+        + "-wss-wssecurity-utility-1.0.xsd\">http://140.221.57.28:8080/wsrf/"
+        + "services/SecureCounterService</wsa:To><wsa:Action  SOAP-ENV:must"
+        + "Understand=\"0\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01"
+        + "/oasis-200401-wss-wssecurity-utility-1.0.xsd\">http://counter.com/"
+        + "CounterPortType/addRequest</wsa:Action><wsa:From SOAP-ENV:must"
+        + "Understand=\"0\"><Address xmlns=\"http://schemas.xmlsoap.org/ws/"
+        + "2004/03/addressing\">http://schemas.xmlsoap.org/ws/2004/03/"
+        + "addressing/role/anonymous</Address></wsa:From><ns1:CounterKey "
+        + "SOAP-ENV:mustUnderstand=\"0\" xmlns:ns1=\"http://counter.com\" "
+        + "xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/"
+        + "oasis-200401-wss-wssecurity-utility-1.0.xsd\">4686652</ns1:Counter"
+        + "Key></SOAP-ENV:Header><SOAP-ENV:Body><add xmlns=\"http://samples."
+        + "wsrf.globus.org/counter/counter_port_type\"><value xmlns=\"\">15"
+        + "</value></add></SOAP-ENV:Body>\r\n       \r\n"
+        + "</SOAP-ENV:Envelope>";
+
+    static final String soapMsgWithID =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+        "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas."
+        + "xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/"
+        + "XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance"
+        + "\" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/03/addressing\">"
+        + "<SOAP-ENV:Header> <wsa:MessageID wsu:Id=\"id-145910\" "
+        + "SOAP-ENV:mustUnderstand=\"0\" xmlns:wsu=\"http://docs.oasis-open."
+        + "org/wss/2004/01/oasis-200401-"
+        + "wss-wssecurity-utility-1.0.xsd\">uuid:6b4d3d80-2f7a-11d9-a445-"
+        + "9feae912fa6b</wsa:MessageID>"
+        + "<wsa:To SOAP-ENV:mustUnderstand=\"0\" "
+        + "xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401"
+        + "-wss-wssecurity-utility-1.0.xsd\">http://140.221.57.28:8080/wsrf/"
+        + "services/SecureCounterService</wsa:To><wsa:Action  SOAP-ENV:must"
+        + "Understand=\"0\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01"
+        + "/oasis-200401-wss-wssecurity-utility-1.0.xsd\">http://counter.com/"
+        + "CounterPortType/addRequest</wsa:Action><wsa:From SOAP-ENV:must"
+        + "Understand=\"0\"><Address xmlns=\"http://schemas.xmlsoap.org/ws/"
+        + "2004/03/addressing\">http://schemas.xmlsoap.org/ws/2004/03/"
+        + "addressing/role/anonymous</Address></wsa:From><ns1:CounterKey "
+        + "SOAP-ENV:mustUnderstand=\"0\" xmlns:ns1=\"http://counter.com\" "
+        + "xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/"
+        + "oasis-200401-wss-wssecurity-utility-1.0.xsd\">4686652</ns1:Counter"
+        + "Key></SOAP-ENV:Header><SOAP-ENV:Body><add xmlns=\"http://samples."
+        + "wsrf.globus.org/counter/counter_port_type\"><value xmlns=\"\">15"
+        + "</value></add></SOAP-ENV:Body>\r\n       \r\n"
+        + "</SOAP-ENV:Envelope>";
+
+    SOAPEnvelope unsignedEnvelope;
+    SOAPEnvelope unsignedEnvelopeWithID;
+    X509Certificate keyCert = null;
+
+    static {
+        GSSConfig.init();
+    }
+
+    public TestWSSecurity(String name) {
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestWSSecurity.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    protected void setUp() throws Exception {
+        createContexts();
+
+        AxisClient tmpEngine = new AxisClient(new NullProvider());
+        msgContext = new MessageContext(tmpEngine);
+        HashMap map = new HashMap();
+        map.put(new QName(Constants.NS_URI_ADDRESSING, Constants.TO), "");
+        map.put(new QName(Constants.NS_URI_ADDRESSING, Constants.ACTION), "");
+        map.put(new QName(Constants.NS_URI_ADDRESSING, Constants.FROM), "");
+        map.put(new QName("http://counter.com", "CounterKey"), "");
+        msgContext.setProperty(
+         org.globus.wsrf.impl.security.authentication.Constants
+         .SECURE_HEADERS, map);
+        msgContext.setProperty(
+         org.globus.wsrf.impl.security.authentication.Constants
+         .ENFORCED_SECURE_HEADERS, map);
+        unsignedEnvelope = getSOAPEnvelope(soapMsg);
+        unsignedEnvelopeWithID = getSOAPEnvelope(soapMsgWithID);
+        GlobusCredential credential = GlobusCredential.getDefaultCredential();
+        keyCert = credential.getCertificateChain()[0];
+    }
+
+    protected SOAPEnvelope getSOAPEnvelope(String soapmsg) throws Exception {
+        InputStream in = new ByteArrayInputStream(soapmsg.getBytes());
+        Message msg = new Message(in);
+        msg.setMessageContext(msgContext);
+
+        return msg.getSOAPEnvelope();
+    }
+
+    protected void createContexts() throws Exception {
+        GSSManager manager = ExtendedGSSManager.getInstance();
+
+        GSSContext context = manager.createContext((GSSCredential) null);
+        String id = "" + context.hashCode();
+        serverContext = new SecurityContext(context, id);
+        context =
+            manager.createContext(null, GSSConstants.MECH_OID, null,
+                                  GSSContext.DEFAULT_LIFETIME);
+        clientContext = new SecurityContext(context, id);
+
+        clientContext.getContext().requestConf(false);
+        clientContext.getContext().requestCredDeleg(false);
+    }
+
+    protected void tearDown() throws Exception {
+        if (clientContext != null) {
+            clientContext.getContext().dispose();
+        }
+
+        if (serverContext != null) {
+            serverContext.getContext().dispose();
+        }
+    }
+
+    private void establishContext() throws Exception {
+        assertTrue("client ctx already established.",
+                   !clientContext.getContext().isEstablished());
+        assertTrue("server ctx already established.",
+                   !serverContext.getContext().isEstablished());
+
+        byte[] inToken = new byte[0];
+        byte[] outToken = null;
+
+        while (!clientContext.getContext().isEstablished()) {
+            outToken = clientContext.getContext().initSecContext(inToken, 0,
+                                                    inToken.length);
+
+            if (outToken != null) {
+                inToken = serverContext.getContext().acceptSecContext(outToken, 0,
+                                                         outToken.length);
+            }
+        }
+
+        assertTrue("client ctx not established.",
+                   clientContext.getContext().isEstablished());
+        assertTrue("server ctx not established.",
+                   serverContext.getContext().isEstablished());
+    }
+
+    // tests
+    // double GssSignature, GssSignatureAndGssEncryption,
+    // GssEncryptionAndGssSignature and DoubleGssEncryption will fail
+    // becuase of the order of processing the tokens for the same context!
+    public void testGssSignatue() throws Exception {
+        establishContext();
+
+        SOAPEnvelope envelope = null;
+
+        GssSignedSOAPEnvelopeBuilder builder =
+            new GssSignedSOAPEnvelopeBuilder(msgContext,
+                                             clientContext.getContext());
+        envelope = (SOAPEnvelope) builder.build(unsignedEnvelope);
+
+        verify(envelope, serverContext, false);
+    }
+
+    public void testGssEncryption() throws Exception {
+        establishContext();
+
+        SOAPEnvelope envelope = null;
+
+        GssEncryptedSOAPEnvelopeBuilder builder =
+            new GssEncryptedSOAPEnvelopeBuilder(msgContext, clientContext);
+        envelope = (SOAPEnvelope) builder.build(unsignedEnvelope);
+        verify(envelope, serverContext, false);
+    }
+
+    public void testX509Signature() throws Exception {
+        SOAPEnvelope envelope = null;
+
+        X509WSSignedSOAPEnvelopeBuilder builder =
+            new X509WSSignedSOAPEnvelopeBuilder(msgContext, null);
+
+        envelope = (SOAPEnvelope) builder.build(unsignedEnvelopeWithID);
+
+        verify(envelope, null, true);
+
+    }
+
+    public void testX509Encryption() throws Exception {
+        SOAPEnvelope envelope = null;
+
+        X509WSEncryptedSOAPEnvelopeBuilder builder =
+            new X509WSEncryptedSOAPEnvelopeBuilder(keyCert);
+
+        envelope = (SOAPEnvelope) builder.build(unsignedEnvelopeWithID);
+
+        verify(envelope, null, true);
+    }
+
+    public void testDoubleX509Encryption() throws Exception {
+        SOAPEnvelope envelope = null;
+
+        X509WSEncryptedSOAPEnvelopeBuilder builder =
+            new X509WSEncryptedSOAPEnvelopeBuilder(keyCert);
+
+        envelope = (SOAPEnvelope) builder.build(unsignedEnvelopeWithID);
+        envelope = (SOAPEnvelope) builder.build(envelope);
+
+        verify(envelope, null, true);
+    }
+
+    public void testGssSignatureAndX509Encryption() throws Exception {
+        establishContext();
+
+        SOAPEnvelope envelope = null;
+
+        GssSignedSOAPEnvelopeBuilder gssBuilder =
+            new GssSignedSOAPEnvelopeBuilder(msgContext,
+                                             clientContext.getContext());
+
+        envelope = (SOAPEnvelope) gssBuilder.build(unsignedEnvelopeWithID);
+
+        X509WSEncryptedSOAPEnvelopeBuilder builder =
+            new X509WSEncryptedSOAPEnvelopeBuilder(keyCert);
+
+        envelope = (SOAPEnvelope) builder.build(envelope);
+
+        verify(envelope, serverContext, true);
+    }
+
+    public void testX509EncryptionAndGssSignature() throws Exception {
+        establishContext();
+
+        SOAPEnvelope envelope = null;
+
+        X509WSEncryptedSOAPEnvelopeBuilder builder =
+            new X509WSEncryptedSOAPEnvelopeBuilder(keyCert);
+
+        envelope = (SOAPEnvelope) builder.build(unsignedEnvelopeWithID);
+
+        GssSignedSOAPEnvelopeBuilder gssBuilder =
+            new GssSignedSOAPEnvelopeBuilder(msgContext,
+                                             clientContext.getContext());
+
+        envelope = (SOAPEnvelope) gssBuilder.build(envelope);
+
+        verify(envelope, serverContext, true);
+    }
+
+    public void testX509EncryptionAndGssEncryption() throws Exception {
+        establishContext();
+
+        SOAPEnvelope envelope = null;
+
+        X509WSEncryptedSOAPEnvelopeBuilder builder =
+            new X509WSEncryptedSOAPEnvelopeBuilder(keyCert);
+
+        envelope = (SOAPEnvelope) builder.build(unsignedEnvelopeWithID);
+
+        GssEncryptedSOAPEnvelopeBuilder gssBuilder =
+            new GssEncryptedSOAPEnvelopeBuilder(msgContext, clientContext);
+        envelope = (SOAPEnvelope) gssBuilder.build(envelope);
+        verify(envelope, serverContext, true);
+    }
+
+    public void testGssEncryptionAndX509Encryption() throws Exception {
+        establishContext();
+
+        SOAPEnvelope envelope = null;
+
+        GssEncryptedSOAPEnvelopeBuilder gssBuilder =
+            new GssEncryptedSOAPEnvelopeBuilder(msgContext, clientContext);
+        envelope = (SOAPEnvelope) gssBuilder.build(unsignedEnvelopeWithID);
+        X509WSEncryptedSOAPEnvelopeBuilder builder =
+            new X509WSEncryptedSOAPEnvelopeBuilder(keyCert);
+        envelope = (SOAPEnvelope) builder.build(envelope);
+        verify(envelope, serverContext, true);
+    }
+
+    public void testDoubleX509Signature() throws Exception {
+        establishContext();
+
+        SOAPEnvelope envelope = null;
+
+        X509WSSignedSOAPEnvelopeBuilder builder =
+            new X509WSSignedSOAPEnvelopeBuilder(msgContext, null);
+
+        envelope = (SOAPEnvelope) builder.build(unsignedEnvelopeWithID);
+
+        envelope = (SOAPEnvelope) builder.build(envelope);
+
+        verify(envelope, serverContext, true);
+    }
+
+    public void testGssSignatureAndX509Signature() throws Exception {
+        establishContext();
+
+        SOAPEnvelope envelope = null;
+
+        GssSignedSOAPEnvelopeBuilder gssBuilder =
+            new GssSignedSOAPEnvelopeBuilder(msgContext,
+                                             clientContext.getContext());
+
+        envelope = (SOAPEnvelope) gssBuilder.build(unsignedEnvelopeWithID);
+
+        X509WSSignedSOAPEnvelopeBuilder x509Builder =
+            new X509WSSignedSOAPEnvelopeBuilder(msgContext, null);
+
+        envelope = (SOAPEnvelope) x509Builder.build(envelope);
+
+        verify(envelope, serverContext, true);
+    }
+
+    public void testX509SignatureAndGssSignature() throws Exception {
+        establishContext();
+
+        SOAPEnvelope envelope = null;
+
+        AxisClient tmpEngine = new AxisClient(new NullProvider());
+        MessageContext tmpCtx = new MessageContext(tmpEngine);
+        // no secure headers
+        X509WSSignedSOAPEnvelopeBuilder x509Builder =
+            new X509WSSignedSOAPEnvelopeBuilder(tmpCtx, null);
+
+        envelope = (SOAPEnvelope) x509Builder.build(unsignedEnvelopeWithID);
+
+        GssSignedSOAPEnvelopeBuilder gssBuilder =
+            new GssSignedSOAPEnvelopeBuilder(msgContext,
+                                             clientContext.getContext());
+
+        envelope = (SOAPEnvelope) gssBuilder.build(envelope);
+
+        boolean exception = false;
+        try {
+            verify(envelope, serverContext, true);
+        } catch (WSSecurityException exp) {
+            if (exp.getMessage()
+                .indexOf("the headers used in dispatch") != -1) {
+                exception = true;
+            } else {
+                logger.error(exp);
+            }
+        }
+        assertTrue(exception);
+
+        x509Builder = new X509WSSignedSOAPEnvelopeBuilder(msgContext, null);
+        envelope = (SOAPEnvelope) x509Builder.build(unsignedEnvelopeWithID);
+        gssBuilder =
+            new GssSignedSOAPEnvelopeBuilder(msgContext,
+                                             clientContext.getContext());
+
+        envelope = (SOAPEnvelope) gssBuilder.build(envelope);
+        verify(envelope, serverContext, true);
+    }
+
+    public void testX509SignatureAndGssEncryption() throws Exception {
+        establishContext();
+
+        SOAPEnvelope envelope = null;
+
+        X509WSSignedSOAPEnvelopeBuilder x509Builder =
+            new X509WSSignedSOAPEnvelopeBuilder(msgContext, null);
+
+        envelope = (SOAPEnvelope) x509Builder.build(unsignedEnvelopeWithID);
+
+        GssEncryptedSOAPEnvelopeBuilder gssBuilder =
+            new GssEncryptedSOAPEnvelopeBuilder(msgContext, clientContext);
+        envelope = (SOAPEnvelope) gssBuilder.build(envelope);
+        verify(envelope, serverContext, true);
+    }
+
+    private void verify(SOAPEnvelope env, SecurityContext context,
+                        boolean timestamp) throws Exception {
+
+        VerifyWSSecurity h = new VerifyWSSecurity((context == null) ?
+                                                  null :
+                                                  context.getContext());
+        msgContext.setProperty(
+            org.globus.wsrf.impl.security.authentication.Constants.CONTEXT,
+            context);
+        h.processSecurityHeader(env, "", msgContext, timestamp);
+        msgContext.setProperty(
+            org.globus.wsrf.impl.security.authentication.Constants.CONTEXT,
+            null);
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/VerifyReplayFilter.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/VerifyReplayFilter.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/VerifyReplayFilter.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,32 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authentication;
+
+import org.globus.wsrf.impl.security.authentication.wssec.ReplayAttackFilter;
+import org.globus.wsrf.impl.security.authentication.wssec.WSSecurityException;
+
+import java.util.Calendar;
+
+public class VerifyReplayFilter extends ReplayAttackFilter {
+
+    public VerifyReplayFilter() {
+    }
+
+    public void checkMessageValidity(String nonceValue, Calendar created) 
+	throws WSSecurityException {
+	super.checkMessageValidity(nonceValue, created);
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/VerifyWSSecurity.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/VerifyWSSecurity.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authentication/VerifyWSSecurity.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,146 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authentication;
+
+import java.security.PrivateKey;
+
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPHeaderElement;
+
+import org.apache.xml.security.signature.XMLSignature;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.ietf.jgss.GSSContext;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.globus.gsi.GlobusCredential;
+import org.globus.gsi.proxy.ProxyPathValidator;
+import org.globus.gsi.proxy.ProxyPolicyHandler;
+import org.globus.wsrf.impl.security.authentication.secureconv.service.SecurityContext;
+import org.globus.wsrf.impl.security.authentication.wssec.WSSecurityEngine;
+import org.globus.wsrf.providers.GSSPublicKey;
+
+import javax.xml.namespace.QName;
+
+public class VerifyWSSecurity extends WSSecurityEngine {
+
+    private static Log logger =
+        LogFactory.getLog(VerifyWSSecurity.class.getName());
+
+    private GSSContext context;
+
+    public VerifyWSSecurity(GSSContext context) {
+        this.context = context;
+    }
+
+    public Document processSecurityHeader(SOAPEnvelope env,
+                                          MessageContext msgCtx)
+        throws Exception {
+        logger.error("processes header");
+        return processSecurityHeader(env, msgCtx, false);
+    }
+
+    public boolean verifyGssXMLSignature(XMLSignature sig,
+                                         MessageContext msgContext)
+        throws Exception {
+
+        boolean result;
+        logger.debug("Enter: verifyGssXMLSignature");
+
+        result = sig.checkSignatureValue(new GSSPublicKey(
+            String.valueOf(this.context.hashCode()), this.context));
+
+        logger.debug("Exit: verifyGssXMLSignature");
+
+        return result; // DOM unmodified
+    }
+
+    public boolean verifyXMLSignature(XMLSignature sig,
+                                      MessageContext msgCtx)
+        throws Exception {
+
+        ProxyPathValidator validator = new ProxyPathValidator();
+        return verifyXMLSignature(sig, msgCtx, validator);
+    }
+
+    /* public boolean decryptGssXMLEncryption(GSSEncryptedData encryptedData,
+                                           MessageContext msgContext)
+        throws Exception {
+
+        logger.debug("Enter: decryptGssXMLEncryption");
+
+        encryptedData.decryptAndReplace(context);
+
+        logger.debug("Exit: decryptGssXMLEncryption");
+
+        return true; // DOM modified
+    } */
+    public void prepareEncryptionContext(
+        String contextId,
+        MessageContext msgContext) throws Exception {
+        logger.debug("Enter: initContext");
+        // get secure context from the msg context
+        msgContext.setProperty(Constants.CONTEXT,
+                               new SecurityContext(context, contextId));
+    }
+
+
+    protected QName getResourceKeyHeaderQName(MessageContext msgCtx)
+        throws Exception {
+        return null;
+    }
+
+    public boolean decryptXMLEncryption(Element element,
+                                        MessageContext msgCtx)
+        throws Exception {
+
+        GlobusCredential credential = GlobusCredential.getDefaultCredential();
+        PrivateKey privateKey = credential.getPrivateKey();
+        return decryptXMLEncryption(element, privateKey);
+    }
+
+    public void processTimestampHeader(Element timestampElem,
+                                       MessageContext msgCtx,
+                                       SOAPHeaderElement messageIDHeader)
+        throws Exception {
+
+        if (messageIDHeader == null) {
+            throw new Exception("MessageID Header is not present. "
+                                + "Element is null");
+        }
+
+        logger.debug("Calling timestamp in verifyWS");
+        if (timestampElem != null) {
+            checkMessageValidity(timestampElem, messageIDHeader, null);
+        } else {
+            if (rejectMsgSansTimestampHeader(msgCtx, null)) {
+                throw new Exception("Timestamp is required");
+            }
+        }
+    }
+
+    protected void checkMessageValidity(Element timestampElem,
+                                        SOAPHeaderElement messageIDHeader,
+                                        String replayAttackWindow)
+        throws Exception {
+        VerifyReplayFilter filter = new VerifyReplayFilter();
+        checkMessageValidity(filter, timestampElem, messageIDHeader);
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/SecurityTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/SecurityTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/SecurityTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,44 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authorization;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestResult;
+
+import org.globus.wsrf.test.GridTestSuite;
+
+public class SecurityTests extends GridTestSuite {
+
+    public SecurityTests(String name) {
+        super(name);
+    }
+
+    public void run(TestResult result) {
+	super.run(result);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new SecurityTests("AuthorizationTests");
+        suite.addTestSuite(TestSelfAuthorization.class);
+        suite.addTestSuite(TestGridMapAuthorization.class);
+        suite.addTestSuite(TestAuthorizationCallout.class);
+        suite.addTestSuite(TestServiceAuthzChain.class);
+        suite.addTestSuite(TestLocalConfig.class);
+        return suite;
+    }
+}
+

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestAuthorizationCallout.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestAuthorizationCallout.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestAuthorizationCallout.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,309 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authorization;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.axis.types.URI;
+import org.globus.axis.gsi.GSIConstants;
+import org.apache.axis.message.addressing.EndpointReferenceType;
+
+import org.globus.wsrf.tests.security.GsiSec;
+import org.globus.wsrf.tests.security.GsiSecConvDeleg;
+import org.globus.wsrf.tests.security.GsiSecConvIntegrity;
+import org.globus.wsrf.tests.security.GsiSecConvOnly;
+import org.globus.wsrf.tests.security.GsiSecConvPrivacy;
+import org.globus.wsrf.tests.security.GsiSecMsgOnly;
+import org.globus.wsrf.tests.security.CreateResourceResponse;
+
+import org.globus.wsrf.tests.security.SecurityTestPortType;
+
+import org.globus.wsrf.tests.security.service.SecurityTestServiceAddressingLocator;
+
+import javax.xml.rpc.Stub;
+
+import org.globus.wsrf.test.GridTestCase;
+
+import org.globus.wsrf.impl.security.TestConstants;
+
+import org.globus.wsrf.impl.security.authentication.Constants;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class TestAuthorizationCallout extends GridTestCase {
+
+    static Log logger =
+        LogFactory.getLog(TestAuthorizationCallout.class.getName());
+    Authorization authz = null;
+
+    public TestAuthorizationCallout(String name) {
+        super(name);
+        authz = TestConstants.getConfiguredClientAuthz();
+        logger.debug("Authz is " + authz.getClass().getName());
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestAuthorizationCallout.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    public void testSecureAccess() throws Exception {
+        assertTrue(TEST_CONTAINER != null);
+        String testServiceAddrs = TEST_CONTAINER.getBaseURL() +
+            TestConstants.CUSTOM_AUTHZ_SERVICE_PATH;
+        logger.debug("Test " + testServiceAddrs);
+
+        EndpointReferenceType testServiceEPR =
+            new EndpointReferenceType(new URI(testServiceAddrs));
+
+        SecurityTestServiceAddressingLocator locator1 =
+            new SecurityTestServiceAddressingLocator();
+        SecurityTestPortType testPort1 =
+            locator1.getSecurityTestPortTypePort(testServiceEPR);
+
+        // This should be the first call on the service for the authz
+        // to be set to custom authz and point to the configured test
+        // authz  service. The service is configured to decline any
+        // methods with subject name being wildcard and access to
+        // methods : gsiSecConvOnly, gsiSecConvIntegrity, gsiSec
+        String authzServiceUrl = TEST_CONTAINER.getBaseURL()
+            + TestConstants.TEST_AUTHZ_SERVICE;
+        testPort1.noAuth(authzServiceUrl);
+
+        serviceSecurityTest(testServiceEPR);
+
+        // Create a resource
+        SecurityTestServiceAddressingLocator locator =
+            new SecurityTestServiceAddressingLocator();
+        SecurityTestPortType testPort =
+            locator.getSecurityTestPortTypePort(testServiceEPR);
+        setGSISecConv(testPort, true, true);
+	CreateResourceResponse response =
+	    testPort.createResource(false);
+	EndpointReferenceType res1EPR = response.getEndpointReference();
+        serviceSecurityTest(res1EPR);
+    }
+
+    public void serviceSecurityTest(EndpointReferenceType testEPR)
+        throws Exception {
+
+        SecurityTestServiceAddressingLocator locator =
+            new SecurityTestServiceAddressingLocator();
+        SecurityTestPortType testPort =
+            locator.getSecurityTestPortTypePort(testEPR);
+
+        logger.debug("No Auth tests");
+        secureInvocations(testPort, true, null, false,
+                          "authentication", false, "authentication", false,
+                          "authentication", false, "authentication", false,
+                          "authentication", false, "authentication");
+
+        logger.debug("Sec Conv with integrity tests");
+        // secure conv integrity with no delegation
+        SecurityTestServiceAddressingLocator locator1 =
+            new SecurityTestServiceAddressingLocator();
+        testPort = locator1.getSecurityTestPortTypePort(testEPR);
+
+        // secure conversation, signature, no delegation
+        setGSISecConv(testPort, true, false);
+        // Changed noAuth to work now, since the subject being null is
+        // not used as test to see if authenticaiton was done. So no
+        // authz is done.
+        secureInvocations(testPort, true, null, true, null,
+                          false, "authorization", false, "authentication",
+                          false, "authorization", false, "authentication",
+                          false, "authorization");
+
+        logger.debug("Sec Conv with integrity and deleg tests");
+        // secure conv integrity with delegation
+        SecurityTestServiceAddressingLocator locator2 =
+            new SecurityTestServiceAddressingLocator();
+        testPort = locator2.getSecurityTestPortTypePort(testEPR);
+        setGSISecConv(testPort, true, true);
+        secureInvocations(testPort, true, null, true, null, false,
+                          "authorization", false, "authentication",
+                          false, "authorization", false, "authentication",
+                          false, "authorization");
+
+        logger.debug("Sec Conv with privacy and deleg tests");
+        // secure conv privacy with deleg
+        SecurityTestServiceAddressingLocator locator3 =
+            new SecurityTestServiceAddressingLocator();
+        testPort = locator3.getSecurityTestPortTypePort(testEPR);
+        setGSISecConv(testPort, false, true);
+        secureInvocations(testPort, true, null, true, null, false,
+                          "authentication", true, null, false, "authorization",
+                          false, "authentication", false, "authorization");
+
+        logger.debug("Sec Msg tests");
+        // secure msg
+        SecurityTestServiceAddressingLocator locator4 =
+            new SecurityTestServiceAddressingLocator();
+        testPort = locator4.getSecurityTestPortTypePort(testEPR);
+        setGSISecMsg(testPort);
+        secureInvocations(testPort, true, null, false, "authentication", false,
+                          "authentication", false, "authentication", false,
+                          "authentication", true, null, false,
+                          "authorization");
+    }
+
+    private void  secureInvocations(SecurityTestPortType testPort,
+                                    boolean noAuth,
+                                    String noAuthErr,
+                                    boolean gsiSecConvDeleg,
+                                    String gsiSecConvDelegErr,
+                                    boolean gsiSecConvIntegrity,
+                                    String gsiSecConvIntegrityErr,
+                                    boolean gsiSecConvPrivacy,
+                                    String gsiSecConvPrivacyErr,
+                                    boolean gsiSecConvOnly,
+                                    String gsiSecConvOnlyErr,
+                                    boolean gsiSecMsgOnly,
+                                    String gsiSecMsgOnlyErr,
+                                    boolean gsiSec,
+                                    String gsiSecErr)
+        throws Exception {
+
+        logger.debug("No auth");
+        boolean exp = true;
+        try {
+            testPort.noAuth(null);
+        } catch (Exception e) {
+            if ((noAuthErr != null) &&
+                (e.getMessage().indexOf(noAuthErr) != -1))
+                exp = false;
+            else
+                logger.error("",e);
+        }
+        assertTrue(exp == noAuth);
+
+        logger.debug("GSI Sec Conv Integrity");
+        exp = true;
+        try {
+            testPort.gsiSecConvIntegrity(new GsiSecConvIntegrity());
+        } catch (Exception e) {
+            logger.debug(gsiSecConvIntegrityErr);
+            if ((gsiSecConvIntegrityErr != null) &&
+                (e.getMessage().indexOf(gsiSecConvIntegrityErr) != -1))
+                exp = false;
+            else
+                logger.error("",e);
+        }
+        assertTrue(exp == gsiSecConvIntegrity);
+
+        logger.debug("GSI Sec Conv Privacy");
+        exp = true;
+        try {
+            testPort.gsiSecConvPrivacy(new GsiSecConvPrivacy());
+        } catch (Exception e) {
+            if ((gsiSecConvPrivacyErr != null) &&
+                (e.getMessage().indexOf(gsiSecConvPrivacyErr) != -1))
+                exp = false;
+            else
+                logger.error("",e);
+        }
+        assertTrue(exp == gsiSecConvPrivacy);
+
+        logger.debug("GSI Sec Conv Delegation");
+        exp = true;
+        try {
+            testPort.gsiSecConvDeleg(new GsiSecConvDeleg());
+        } catch (Exception e) {
+            logger.debug(gsiSecConvDelegErr);
+            if ((gsiSecConvDelegErr != null) &&
+                (e.getMessage().indexOf(gsiSecConvDelegErr) != -1))
+                exp = false;
+            else
+                logger.error("",e);
+        }
+        assertTrue(exp == gsiSecConvDeleg);
+
+        logger.debug("GSI Sec Conv Only");
+        exp = true;
+        try {
+            testPort.gsiSecConvOnly(new GsiSecConvOnly());
+        } catch (Exception e) {
+            logger.debug(gsiSecConvOnlyErr);
+            if ((gsiSecConvOnlyErr != null) &&
+                (e.getMessage().indexOf(gsiSecConvOnlyErr) != -1))
+                exp = false;
+            else
+                logger.error("",e);
+        }
+        assertTrue(exp == gsiSecConvOnly);
+
+        logger.debug("GSI Sec Msg");
+        exp = true;
+        try {
+            testPort.gsiSecMsgOnly(new GsiSecMsgOnly());
+        } catch (Exception e) {
+            logger.debug(gsiSecMsgOnlyErr);
+            if ((gsiSecMsgOnlyErr != null) &&
+                (e.getMessage().indexOf(gsiSecMsgOnlyErr) != -1))
+                exp = false;
+            else
+                logger.error("",e);
+        }
+        assertTrue(exp == gsiSecMsgOnly);
+
+        logger.debug("GSI Security");
+        exp = true;
+        try {
+            testPort.gsiSec(new GsiSec());
+        } catch (Exception e) {
+            logger.debug(gsiSecErr);
+            if ((gsiSecErr != null) &&
+                (e.getMessage().indexOf(gsiSecErr) != -1))
+                exp = false;
+            else
+                logger.error("",e);
+        }
+        assertTrue(exp == gsiSec);
+    }
+
+    private void setGSISecConv(SecurityTestPortType testPort,
+                               boolean sig, boolean deleg) {
+
+        if (sig) {
+            ((Stub)testPort)._setProperty(Constants.GSI_SEC_CONV,
+                                          Constants.SIGNATURE);
+        } else {
+            ((Stub)testPort)._setProperty(Constants.GSI_SEC_CONV,
+                                          Constants.ENCRYPTION);
+        }
+
+        if (deleg) {
+            ((Stub)testPort)._setProperty(GSIConstants.GSI_MODE,
+                                          GSIConstants.GSI_MODE_FULL_DELEG);
+        } else {
+            ((Stub)testPort)._setProperty(GSIConstants.GSI_MODE,
+                                          GSIConstants.GSI_MODE_NO_DELEG);
+        }
+        ((Stub)testPort)._setProperty(Constants.AUTHORIZATION, authz);
+    }
+
+    private void setGSISecMsg(SecurityTestPortType testPort) {
+
+        ((Stub)testPort)._setProperty(Constants.GSI_SEC_MSG,
+                                      Constants.SIGNATURE);
+        ((Stub)testPort)._setProperty(Constants.AUTHORIZATION, authz);
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestAuthorizationChain.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestAuthorizationChain.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestAuthorizationChain.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,50 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authorization;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.MessageContext;
+
+import javax.security.auth.Subject;
+
+import org.globus.wsrf.security.authorization.Interceptor;
+
+import org.globus.wsrf.impl.security.authorization.exceptions.AuthorizationException;
+
+public class TestAuthorizationChain extends ServiceAuthorizationChain {
+    
+    public TestAuthorizationChain(Interceptor[] interceptors, 
+                                  String id) 
+        throws Exception {
+
+	this.interceptor = interceptors;
+        this.initialized = true;
+        this.interceptorName = new String[this.interceptor.length];
+        for (int i=0; i<this.interceptor.length; i++) {
+            this.interceptorName[i] = "temp";
+            this.interceptor[i].initialize(null, this.interceptorName[i], 
+                                           id);
+        }
+    }
+
+    public boolean authorize(Subject peerSubject, MessageContext context) 
+        throws AuthorizationException {
+
+        // Dummy operation name
+        QName opName = new QName("http://temp.ns", "dummyOp");
+	return authorize(peerSubject, context, opName);
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestGridMapAuthorization.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestGridMapAuthorization.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestGridMapAuthorization.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,121 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authorization;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.globus.wsrf.impl.security.descriptor.ServiceSecurityConfig;
+import org.globus.wsrf.jndi.JNDIUtils;
+
+import org.apache.axis.MessageContext;
+
+import org.globus.gsi.jaas.GlobusPrincipal;
+import org.globus.security.gridmap.GridMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.naming.Context;
+
+import javax.security.auth.Subject;
+
+import org.globus.wsrf.security.authorization.PDP;
+import org.globus.wsrf.impl.security.authorization.exceptions.AuthorizationException;
+
+public class TestGridMapAuthorization extends TestCase {
+    static Log logger =
+        LogFactory.getLog(TestGridMapAuthorization.class.getName());
+    private Subject anonSubject = new Subject();
+    private String USER1 = "/CN=foo";
+    private String USER2 = "/CN=bar";
+
+    public TestGridMapAuthorization(String name) throws Exception {
+        super(name);
+	Context initialContext = JNDIUtils.initJNDI();
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestGridMapAuthorization.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    public void testAnonymous() throws Exception {
+        PDP pdp = GridMapAuthorization.getInstance();
+
+	String servicePath = "service1";
+        GridMap map = new GridMap();
+        map.map(USER2, "nobody");
+	storeServiceGridMap(servicePath, map);
+
+	boolean exp = false;
+        try {
+            pdp.initialize(null, null, servicePath);
+            pdp.isPermitted(anonSubject, new MessageContext(null), null);
+            fail("Failed to throw exception");
+        } catch (AuthorizationException e) {
+	    if (e.getMessage().indexOf("anonymous") != -1)
+		exp = true;
+            e.printStackTrace();
+        }
+	assertTrue(exp);
+    }
+
+    public void testFail() throws Exception {
+        PDP pdp = GridMapAuthorization.getInstance();
+
+	String servicePath = "service2";
+        GridMap map = new GridMap();
+        map.map(USER2, "nobody");
+	storeServiceGridMap(servicePath, map);
+
+        Subject callerSubject = new Subject();
+        callerSubject.getPrincipals().add(new GlobusPrincipal(USER1));
+
+        pdp.initialize(null, null, servicePath);
+        assertFalse(pdp.isPermitted(callerSubject, new MessageContext(null), 
+                                    null));
+    }
+
+    public void testSuccess() throws Exception {
+        PDP pdp = GridMapAuthorization.getInstance();
+
+	String servicePath = "service3";
+        GridMap map = new GridMap();
+        map.map(USER2, "nobody");
+        map.map(USER1, "nobody");
+	storeServiceGridMap(servicePath, map);
+
+        Subject callerSubject = new Subject();
+        callerSubject.getPrincipals().add(new GlobusPrincipal(USER1));
+
+        pdp.initialize(null, null, servicePath);
+	assertTrue(pdp.isPermitted(callerSubject, new MessageContext(null), 
+                                   null));
+    }
+
+    private void storeServiceGridMap(String servicePath, GridMap map)
+	throws Exception {
+	// This should create required JNDI context for security proeprties
+	ServiceSecurityConfig.initialize(servicePath, null);
+	// Store subject for service in JNDI
+	ServiceSecurityConfig.setGridMap(map, servicePath);	
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestLocalConfig.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestLocalConfig.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestLocalConfig.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,103 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authorization;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import java.io.File;
+
+import javax.xml.namespace.QName;
+
+import org.globus.gsi.jaas.GlobusPrincipal;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.security.auth.Subject;
+
+import org.apache.axis.MessageContext;
+
+import org.globus.wsrf.security.authorization.PDP;
+
+public class TestLocalConfig extends TestCase {
+    static Log logger =
+        LogFactory.getLog(TestLocalConfig.class.getName());
+
+    String PDP_NAME = "testConfig";
+    private Subject anonSubject = new Subject();
+    private QName readQName = new QName("http://org.test", "read");
+    private QName writeQName = new QName("http://org.test", "write");
+    private QName execQName = new QName("http://org.test", "exec");
+    private ResourcePDPConfig resourceConfig = null;
+    private String USER1 = "/CN=foo";
+    private String USER2 = "/CN=bar";
+    private String USER3 = "/CN=tmp";
+
+    public TestLocalConfig(String name) 
+	throws Exception {
+        super(name);
+        String globusLocation = System.getProperty("GLOBUS_LOCATION");
+        // XXX: Hardcoded gar id namez
+        String testConf = globusLocation + File.separator + "etc"
+            + File.separator + "globus_wsrf_test_unit" + File.separator + 
+            "local-config-authz-test.conf";
+        resourceConfig = new ResourcePDPConfig("test");
+        resourceConfig.setProperty(PDP_NAME, 
+                                   LocalConfigPDP.SECURITY_CONFIG_FILE, 
+                                   testConf);
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestLocalConfig.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    public void testAnonymous() throws Exception {
+        
+	PDP pdp = new LocalConfigPDP();
+        pdp.initialize(resourceConfig, PDP_NAME, "dummyService");
+        assertFalse(pdp.isPermitted(anonSubject, new MessageContext(null), 
+                                    readQName));
+    }
+
+    public void testSubject() throws Exception {
+
+        Subject callerSubject = new Subject();
+        callerSubject.getPrincipals().add(new GlobusPrincipal(USER2));
+
+	PDP pdp = new LocalConfigPDP();
+        pdp.initialize(resourceConfig, PDP_NAME, "dummyService");
+        assertTrue(pdp.isPermitted(callerSubject, new MessageContext(null), 
+                                   readQName));
+        assertFalse(pdp.isPermitted(callerSubject, new MessageContext(null), 
+                                   writeQName));
+
+        callerSubject = new Subject();
+        callerSubject.getPrincipals().add(new GlobusPrincipal(USER3));
+        assertFalse(pdp.isPermitted(callerSubject, new MessageContext(null), 
+                                   writeQName));
+
+        callerSubject = new Subject();
+        callerSubject.getPrincipals().add(new GlobusPrincipal(USER1));
+        assertTrue(pdp.isPermitted(callerSubject, new MessageContext(null), 
+                                   execQName));
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestSelfAuthorization.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestSelfAuthorization.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestSelfAuthorization.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,129 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authorization;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import javax.naming.Context;
+
+import org.globus.wsrf.impl.security.descriptor.ServiceSecurityConfig;
+
+import org.globus.gsi.jaas.GlobusPrincipal;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.jndi.JNDIUtils;
+
+import javax.security.auth.Subject;
+
+import org.apache.axis.MessageContext;
+
+import org.globus.wsrf.security.authorization.PDP;
+import org.globus.wsrf.impl.security.authorization.exceptions.AuthorizationException;
+
+public class TestSelfAuthorization extends TestCase {
+    static Log logger =
+        LogFactory.getLog(TestSelfAuthorization.class.getName());
+
+    private Subject anonSubject = new Subject();
+    private String USER1 = "/CN=foo";
+    private String USER2 = "/CN=bar";
+    private String USER3 = "/CN=tmp";
+
+    public TestSelfAuthorization(String name) 
+	throws Exception {
+        super(name);
+	Context initialContext = JNDIUtils.initJNDI();
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestSelfAuthorization.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    public void testAnonymous() throws Exception {
+        
+	PDP pdp = SelfAuthorization.getInstance();
+	// Service path
+	String servicePath = "tempService1";
+	// Create and store service subject
+        Subject serviceSubject = new Subject();
+        serviceSubject.getPrincipals().add(new GlobusPrincipal(USER1));
+	storeServiceSubject(servicePath, serviceSubject);
+
+	boolean exp = false;
+        try {
+            pdp.initialize(null, null, servicePath);
+            pdp.isPermitted(anonSubject, new MessageContext(null), null);
+            fail("Failed to throw exception");
+        } catch (AuthorizationException e) {
+	    if (e.getMessage().indexOf("anonymous") != -1)
+		exp = true;
+            e.printStackTrace();
+        }
+	assertTrue(exp);
+    }
+
+    public void testFail() throws Exception {
+        PDP pdp = SelfAuthorization.getInstance();
+
+	String servicePath = "tempService2";
+	// Create and store service subject
+        Subject serviceSubject = new Subject();
+        serviceSubject.getPrincipals().add(new GlobusPrincipal(USER1));
+	storeServiceSubject(servicePath, serviceSubject);
+	
+        Subject callerSubject = new Subject();
+        callerSubject.getPrincipals().add(new GlobusPrincipal(USER2));
+
+        pdp.initialize(null, null, servicePath);
+        assertFalse(pdp.isPermitted(callerSubject, new MessageContext(null), 
+                                    null));
+    }
+
+    public void testSuccess() throws Exception {
+        PDP pdp = SelfAuthorization.getInstance();
+
+	// trying to overwitre subject from previous case
+	String servicePath = "tempService2";
+
+        Subject serviceSubject = new Subject();
+        serviceSubject.getPrincipals().add(new GlobusPrincipal(USER3));
+	storeServiceSubject(servicePath, serviceSubject);
+
+        Subject callerSubject = new Subject();
+        callerSubject.getPrincipals().add(new GlobusPrincipal(USER2));
+        callerSubject.getPrincipals().add(new GlobusPrincipal(USER3));
+
+        pdp.initialize(null, null, servicePath);
+        assertTrue(pdp.isPermitted(callerSubject, new MessageContext(null), 
+                                    null));
+    }
+
+    private void storeServiceSubject(String servicePath, Subject subject)
+	throws Exception {
+	// This should create required JNDI context for security properties
+	ServiceSecurityConfig.initialize(servicePath, null);
+	// Store subject for service in JNDI
+	ServiceSecurityConfig.setSubject(subject, servicePath);
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestServiceAuthzChain.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestServiceAuthzChain.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/authorization/TestServiceAuthzChain.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,185 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.authorization;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import javax.naming.Context;
+
+import org.globus.wsrf.impl.security.descriptor.ServiceSecurityConfig;
+
+import org.globus.gsi.jaas.GlobusPrincipal;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.jndi.JNDIUtils;
+
+import javax.security.auth.Subject;
+
+import org.globus.security.gridmap.GridMap;
+
+import org.apache.axis.MessageContext;
+
+import org.globus.wsrf.security.authorization.PDP;
+import org.globus.wsrf.security.authorization.Interceptor;
+
+import org.globus.wsrf.impl.security.authorization.exceptions.AuthorizationException;
+
+public class TestServiceAuthzChain extends TestCase {
+
+    static Log logger =
+        LogFactory.getLog(TestServiceAuthzChain.class.getName());
+
+    private Subject anonSubject = new Subject();
+    private String USER1 = "/CN=foo";
+    private String USER2 = "/CN=bar";
+    private String USER3 = "/CN=tmp";
+
+    public TestServiceAuthzChain(String name) 
+	throws Exception {
+        super(name);
+	Context initialContext = JNDIUtils.initJNDI();
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestSelfAuthorization.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    public void nottestAnonymous() throws Exception {
+        
+
+	// Service path
+	String servicePath = "tempService1";
+	// This should create required JNDI context for security proeprties
+	ServiceSecurityConfig.initialize(servicePath, null);
+
+	// Create and store service subject
+        Subject serviceSubject = new Subject();
+        serviceSubject.getPrincipals().add(new GlobusPrincipal(USER1));
+	storeServiceSubject(servicePath, serviceSubject);
+
+        // Create and store gridmap
+        GridMap map = new GridMap();
+        map.map(USER2, "nobody");
+	storeServiceGridMap(servicePath, map);
+
+	PDP pdpSelf = SelfAuthorization.getInstance();
+        PDP pdpGridmap = GridMapAuthorization.getInstance();
+
+        Interceptor interceptors[] = new Interceptor[] { pdpSelf, pdpGridmap };
+        TestAuthorizationChain testChain = 
+            new TestAuthorizationChain(interceptors, servicePath);
+
+	boolean exp = false;
+        try {
+            testChain.authorize(anonSubject, new MessageContext(null), 
+                                servicePath);
+            fail("Failed to throw exception");
+        } catch (AuthorizationException e) {
+	    if (e.getMessage().indexOf("anonymous") != -1)
+		exp = true;
+            e.printStackTrace();
+        }
+	assertTrue(exp);
+    }
+
+    public void testMultiplePDPs() throws Exception {
+
+
+	String servicePath = "tempService2";
+	ServiceSecurityConfig.initialize(servicePath, null);
+
+	// Create and store service subject
+        Subject serviceSubject = new Subject();
+        serviceSubject.getPrincipals().add(new GlobusPrincipal(USER1));
+	storeServiceSubject(servicePath, serviceSubject);
+	
+        // Create and store gridmap
+        GridMap map = new GridMap();
+        map.map(USER1, "nobody");
+        map.map(USER2, "nobody2");
+	storeServiceGridMap(servicePath, map);
+
+        Subject callerSubject = new Subject();
+        callerSubject.getPrincipals().add(new GlobusPrincipal(USER2));
+
+        PDP pdpSelf = SelfAuthorization.getInstance();
+        PDP pdpGridmap = GridMapAuthorization.getInstance();
+
+        Interceptor interceptors[] = new Interceptor[] { pdpSelf, pdpGridmap };
+        TestAuthorizationChain testChain = 
+            new TestAuthorizationChain(interceptors, servicePath);
+
+        boolean exp = false;
+        try {
+            testChain.authorize(callerSubject, new MessageContext(null), 
+                                servicePath);
+            fail("Failed to throw exception");
+        } catch (AuthorizationException e) {
+	    if (e.getMessage().indexOf("not authorized") != -1)
+		exp = true;
+            e.printStackTrace();
+        }
+        assertTrue(exp);
+
+        callerSubject = new Subject();
+        callerSubject.getPrincipals().add(new GlobusPrincipal(USER1));
+
+        // Should go thro'
+        testChain.authorize(callerSubject, new MessageContext(null), 
+                            servicePath);
+
+        
+        PDP pdpIden = new IdentityAuthorization(USER2);
+
+        interceptors = new Interceptor[] { pdpSelf, pdpGridmap,  pdpIden};
+        testChain = 
+            new TestAuthorizationChain(interceptors, servicePath);
+
+        exp = false;
+        try {
+            testChain.authorize(callerSubject, new MessageContext(null), 
+                                servicePath);
+            fail("Failed to throw exception");
+        } catch (AuthorizationException e) {
+	    if (e.getMessage().indexOf("not authorized") != -1)
+		exp = true;
+            e.printStackTrace();
+        }
+        assertTrue(exp);
+
+    }
+
+    private void storeServiceSubject(String servicePath, Subject subject)
+	throws Exception {
+	// Store subject for service in JNDI
+	ServiceSecurityConfig.setSubject(subject, servicePath);
+    }
+
+    private void storeServiceGridMap(String servicePath, GridMap map)
+	throws Exception {
+	// Store subject for service in JNDI
+	ServiceSecurityConfig.setGridMap(map, servicePath);	
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/client-security-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/client-security-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/client-security-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<securityConfig xmlns="http://www.globus.org">
+    <authz value="self"/>
+    <GSISecureConversation>
+        <integrity/>
+	<delegation value="full"/>
+    </GSISecureConversation>
+</securityConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/container-security-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/container-security-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/container-security-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,7 @@
+<securityConfig xmlns="http://www.globus.org">
+  <reject-limited-proxy value="true"/>
+  <authz value="gridmap"/>
+  <context-timer-interval value="12000"/>
+  <replay-attack-window value="10000"/>
+  <replay-attack-filter value="randomValue"/>
+</securityConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/SecurityTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/SecurityTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/SecurityTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,35 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.descriptor;
+
+import org.globus.wsrf.test.GridTestSuite;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class SecurityTests extends GridTestSuite {
+
+    public SecurityTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new SecurityTests("DescriptorTests");
+        suite.addTestSuite(TestSecurityDescriptor.class);
+	suite.addTestSuite(TestSecurityConfig.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/TestContainerSecurityConfig.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/TestContainerSecurityConfig.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/TestContainerSecurityConfig.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1 @@
+/*

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/TestSecurityConfig.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/TestSecurityConfig.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/TestSecurityConfig.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,420 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.descriptor;
+
+import java.util.List;
+import java.util.Vector;
+
+import javax.security.auth.Subject;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.axis.gsi.GSIConstants;
+import org.globus.gsi.jaas.GlobusPrincipal;
+import org.globus.security.gridmap.GridMap;
+import org.globus.wsrf.impl.security.authentication.Constants;
+import org.globus.wsrf.impl.security.authorization.HostAuthorization;
+import org.globus.wsrf.jndi.JNDIUtils;
+import org.globus.wsrf.security.SecureResource;
+import org.globus.wsrf.security.SecurityManager;
+import org.globus.wsrf.test.GridTestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestSecurityConfig extends GridTestCase {
+
+    static Log logger =
+        LogFactory.getLog(TestSecurityConfig.class.getName());
+
+    private String USER1 = "/CN=foo";
+    private String service1Path = "TestService1";
+    private String service2Path = "TestService2";
+    private Subject service1Subject = null;
+    private Subject service2Subject = null;
+    private Subject containerSubject = null;
+    private GridMap service1GridMap = null;
+    private GridMap service2GridMap = null;
+    private GridMap containerGridMap = null;
+    private String containerReplayWin = "10000";
+    private String replayInterval = "randomVal1";
+    private String contextInterval = "ramdomVal2";
+    private String service2ReplayWin = "20000";
+
+    public TestSecurityConfig(String name) throws Exception {
+        super(name);
+        // Initialize JNDI
+        JNDIUtils.initJNDI();
+        logger.debug("Done");
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestSecurityConfig.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    public void testServiceSecurityConfig() throws Exception {
+
+        assertTrue(TEST_CONTAINER != null);
+
+        // Store security properties for a service and retrieve. No
+        // container stuff stored.
+        service1Test();
+        logger.debug("service 1 Done");
+
+        // Here context and replay timer shld be null
+        ContainerSecurityDescriptor desc =
+            ContainerSecurityConfig.getConfig().getSecurityDescriptor();
+        assertTrue(desc.getReplayTimerInterval() == null);
+        assertTrue(desc.getContextTimerInterval() == null);
+
+        // Store container stuff
+        containerTest();
+        logger.debug("container Done");
+
+        ContainerSecurityDescriptor desc1 =
+            ContainerSecurityConfig.getConfig().getSecurityDescriptor();
+        assertTrue(replayInterval.equals(desc1.getReplayTimerInterval()));
+        assertTrue(contextInterval.equals(desc1.getContextTimerInterval()));
+
+        // Store a second service to check if properties are placed in
+        // correct location. Reset subject and gridamp to be null;
+        service2Test();
+        logger.debug("service 2 Done");
+        // Retrieve properties of both services thrr' helper API.
+        serviceHelperTest();
+        logger.debug("service helper Done");
+
+        clientDescriptorTest();
+    }
+
+    private void clientDescriptorTest() throws Exception {
+
+        ClientSecurityDescriptor desc =
+            ClientSecurityConfig.initialize("org/globus/wsrf/impl/security/descriptor/client-security-desc.xml");
+        assertTrue(Constants.ENCRYPTION.equals(desc.getGSISecureMsg()));
+        assertTrue(Constants.SIGNATURE.equals(desc.getGSISecureConv()));
+        assertTrue(Boolean.TRUE.equals(desc.getAnonymous()));
+        assertTrue(GSIConstants.GSI_MODE_FULL_DELEG
+                   .equals(desc.getDelegation()));
+        assertTrue(desc.getAuthz() instanceof HostAuthorization);
+    }
+
+    private void service1Test() throws Exception {
+
+        logger.debug("service one test");
+        // Initialize
+        ServiceSecurityConfig.initialize(this.service1Path, null);
+        logger.debug("service1Path initialized");
+        // Subject should be null as yet.
+        assertTrue(ServiceSecurityConfig.getSubject(this.service1Path)
+                   == null);
+        // Refresh shld not throw an error despite not having credential
+        ServiceSecurityConfig.refresh(this.service1Path);
+        logger.debug("refresh done");
+        // Create and store subject
+        this.service1Subject = new Subject();
+        this.service1Subject.getPrincipals().add(new GlobusPrincipal(USER1));
+        ServiceSecurityConfig.setSubject(this.service1Subject,
+                                         this.service1Path);
+
+        // Try refresh, will not happen since no security descriptor,
+        // but shld not throw errors
+        ServiceSecurityConfig.refresh(this.service1Path);
+
+        Subject subject = ServiceSecurityConfig.getSubject(this.service1Path);
+        assertTrue(subject != null);
+        assertTrue(subject.equals(this.service1Subject));
+
+        // Create and store gridmap
+        this.service1GridMap = new GridMap();
+        this.service1GridMap.map(USER1, "nobody");
+        ServiceSecurityConfig.setGridMap(this.service1GridMap,
+                                         this.service1Path);
+
+        GridMap gridMap = ServiceSecurityConfig.getGridMap(this.service1Path);
+        assertTrue(gridMap != null);
+        assertTrue(gridMap.equals(this.service1GridMap));
+
+        // Create and store security descriptor, overwriting what
+        // exists before
+        ServiceSecurityDescriptor desc = new ServiceSecurityDescriptor();
+        desc.setRunAsType(RunAsConstants.CALLER);
+        // Default method auth
+        Vector methods = new Vector();
+        QName qName1 = new QName(SecurityDescriptor.NS, "method1");
+        methods.add(qName1);
+        QName qName2 = new QName(SecurityDescriptor.NS, "method2");
+        methods.add(qName2);
+        desc.setAuthMethods(methods);
+        // Set rejected proxy
+        desc.setRejectLimitedProxy("false");
+        desc.setSubject(subject);
+        desc.setGridMap(gridMap);
+        // Store descriptor
+        ServiceSecurityConfig.setSecurityDescriptor(desc, this.service1Path);
+
+        // Retrieve all the above
+        // Subject
+        subject = ServiceSecurityConfig.getSubject(this.service1Path);
+        assertTrue(subject != null);
+        assertTrue(subject.equals(this.service1Subject));
+
+        // gridmap
+        gridMap = ServiceSecurityConfig.getGridMap(this.service1Path);
+        assertTrue(gridMap != null);
+        assertTrue(gridMap.equals(this.service1GridMap));
+
+        // security desc
+        ServiceSecurityDescriptor secDesc =
+            (ServiceSecurityDescriptor)ServiceSecurityConfig
+            .getSecurityDescriptor(this.service1Path);
+        assertTrue(secDesc != null);
+        compare(desc.getAuthMethods(qName1), secDesc.getAuthMethods(qName1));
+        compare(desc.getAuthMethods(qName2), secDesc.getAuthMethods(qName2));
+
+        assertTrue(desc.getRejectLimitedProxyState() != null);
+        assertTrue(desc.getRejectLimitedProxyState().equals("false"));
+    }
+
+    private void containerTest() throws Exception {
+
+        logger.debug("container test");
+
+        ContainerSecurityConfig config = ContainerSecurityConfig.getConfig();
+        Subject contSubject = config.getSubject();
+        // gets default
+        assertTrue(contSubject != null);
+        logger.debug(contSubject);
+
+        // Create and store subject
+        this.containerSubject = new Subject();
+        this.containerSubject.getPrincipals().add(new GlobusPrincipal(
+            "containerUser"));
+        ContainerSecurityConfig.getConfig().setSubject(this.containerSubject);
+
+        // Create and store gridmap
+        this.containerGridMap= new GridMap();
+        this.containerGridMap.map(USER1, "containerLogin");
+        ContainerSecurityConfig.getConfig().setGridMap(this.containerGridMap);
+
+        // Retrieve all the above
+        Subject retSubject = ContainerSecurityConfig.getConfig().getSubject();
+        assertTrue(retSubject != null);
+        assertTrue(this.containerSubject.equals(retSubject));
+        logger.debug("Container " + this.containerSubject);
+
+        GridMap retGridMap = ContainerSecurityConfig.getConfig().getGridMap();
+        assertTrue(this.containerGridMap.equals(retGridMap));
+
+        // Create and store sec desc
+        ContainerSecurityDescriptor desc = new ContainerSecurityDescriptor();
+        desc.setRejectLimitedProxy("true");
+        desc.setSubject(this.containerSubject);
+        desc.setGridMap(this.containerGridMap);
+        desc.setReplayAttackWindow(containerReplayWin);
+        desc.setReplayTimerInterval(replayInterval);
+        desc.setContextTimerInterval(contextInterval);
+        ContainerSecurityConfig.getConfig().setSecurityDescriptor(desc);
+
+        ContainerSecurityDescriptor retDesc =
+            ContainerSecurityConfig.getConfig().getSecurityDescriptor();
+        assertTrue(retDesc != null);
+        assertTrue(retDesc.getRejectLimitedProxyState() != null);
+        assertTrue(retDesc.getRejectLimitedProxyState().equals("true"));
+
+        retSubject = ContainerSecurityConfig.getConfig().getSubject();
+        assertTrue(retSubject != null);
+        assertTrue(this.containerSubject.equals(retSubject));
+        logger.debug("Container " + this.containerSubject);
+    }
+
+    private void service2Test() throws Exception {
+
+        logger.debug("service two test");
+
+        // Initialize
+        ServiceSecurityConfig.initialize(this.service2Path, null);
+        // Subject should be null as yet.
+        assertTrue(ServiceSecurityConfig.getSubject(this.service2Path)
+                   == null);
+
+        // Create and store subject
+        this.service2Subject = new Subject();
+        this.service2Subject.getPrincipals().add(new GlobusPrincipal(USER1));
+        ServiceSecurityConfig.setSubject(this.service2Subject,
+                                         this.service2Path);
+        // Create and store gridmap
+        this.service2GridMap = new GridMap();
+        this.service2GridMap.map(USER1, "dummy");
+        ServiceSecurityConfig.setGridMap(this.service2GridMap,
+                                         this.service2Path);
+
+        // Retrieve all the above
+        // Subject
+        Subject subject = ServiceSecurityConfig.getSubject(this.service2Path);
+        assertTrue(subject != null);
+        assertTrue(subject.equals(this.service2Subject));
+
+        // gridmap
+        GridMap gridMap = ServiceSecurityConfig.getGridMap(this.service2Path);
+        assertTrue(gridMap != null);
+        assertTrue(gridMap.equals(this.service2GridMap));
+
+        ServiceSecurityDescriptor desc = new ServiceSecurityDescriptor();
+        desc.setReplayAttackWindow(service2ReplayWin);
+        ServiceSecurityConfig.setSecurityDescriptor(desc, this.service2Path);
+    }
+
+    private void serviceHelperTest() throws Exception {
+
+        logger.debug("service helper test");
+
+        // Set subject and gridMap of service 2 to be null
+        ServiceSecurityConfig.setSubject(null, this.service2Path);
+        ServiceSecurityConfig.setGridMap(null, this.service2Path);
+
+        ContainerSecurityDescriptor retDesc =
+            ContainerSecurityConfig.getConfig().getSecurityDescriptor();
+        assertTrue(retDesc != null);
+        assertTrue(retDesc.getRejectLimitedProxyState() != null);
+        assertTrue(retDesc.getRejectLimitedProxyState().equals("true"));
+
+        // Get System subject
+        Subject systemSub = SecurityManager.getManager().getSystemSubject();
+        assertTrue(systemSub != null);
+        assertTrue(!systemSub.equals(this.containerSubject));
+        this.containerSubject =
+            SecurityManager.getManager().getSystemSubject();
+
+        // Should not affect any other part of the descriptor
+        retDesc =
+        ContainerSecurityConfig.getConfig().getSecurityDescriptor();
+        assertTrue(retDesc != null);
+        assertTrue(retDesc.getRejectLimitedProxyState() != null);
+        assertTrue(retDesc.getRejectLimitedProxyState().equals("true"));
+
+        // Get service1 subject
+        Subject serviceSub =
+            SecurityManager.getManager().getServiceSubject(this.service1Path);
+        assertTrue(serviceSub != null);
+        assertTrue(serviceSub.equals(this.service1Subject));
+
+        // Get service2 subject
+        Subject service2Sub =
+            SecurityManager.getManager().getServiceSubject(this.service2Path);
+        assertTrue(service2Sub.equals(this.containerSubject));
+
+        // Get service2/container subject
+        Subject sub =
+            SecurityManager.getManager().getSubject(service2Path, null);
+        assertTrue(sub != null);
+        assertTrue(sub.equals(this.containerSubject));
+
+        // Get reject limited for service 1, shld be false
+        assertTrue(Boolean.FALSE
+                   .equals(SecurityPropertiesHelper
+                           .getRejectLimitedProxyState(this.service1Path,
+                                                       null)));
+        // shld be true, because of container property
+        assertTrue(Boolean.TRUE.equals(
+            SecurityPropertiesHelper.getRejectLimitedProxyState(
+                this.service2Path, null)));
+
+        // Get replayAttackWin for service1, shld be container's
+        assertTrue(containerReplayWin
+                   .equals(SecurityPropertiesHelper
+                           .getReplayAttackWindow(this.service1Path, null)));
+        // Get replayAttackWin for service2
+        assertTrue(service2ReplayWin
+                   .equals(SecurityPropertiesHelper
+                           .getReplayAttackWindow(this.service2Path, null)));
+
+        // Get service1 gridmap
+        assertTrue(SecurityPropertiesHelper.getGridMap(this.service1Path, null)
+                   .equals(this.service1GridMap));
+        assertTrue(SecurityPropertiesHelper.getGridMap(this.service2Path, null)
+                   .equals(this.containerGridMap));
+
+        // Try adding resoure for above
+        TestResource res1 = new TestResource("true");
+        // Should be true, now
+        assertTrue(Boolean.TRUE.equals(
+            SecurityPropertiesHelper.getRejectLimitedProxyState(
+                this.service1Path, res1)));
+
+        // Second resource.
+        String filename =
+            "org/globus/wsrf/impl/security/descriptor/test-security-true.xml";
+        SecondTestResource res2 = new SecondTestResource(filename);
+        assertTrue(Boolean.TRUE.equals(
+            SecurityPropertiesHelper.getRejectLimitedProxyState(
+                this.service1Path, res2)));
+        filename =
+        "org/globus/wsrf/impl/security/descriptor/test-security-false.xml";
+        SecondTestResource res3 = new SecondTestResource(filename);
+        assertTrue(Boolean.FALSE.equals(
+            SecurityPropertiesHelper.getRejectLimitedProxyState(
+                this.service2Path, res3)));
+    }
+
+    private void compare(List expected, List current) {
+        assertEquals(expected.size(), current.size());
+
+        for (int i = 0; i < expected.size(); i++) {
+            assertEquals(expected.get(i), current.get(i));
+        }
+    }
+}
+
+class TestResource implements SecureResource {
+
+    ResourceSecurityDescriptor desc = null;
+
+    public TestResource(String reject) {
+        this.desc = new ResourceSecurityDescriptor();
+        desc.setRejectLimitedProxy(reject);
+    }
+
+    public ResourceSecurityDescriptor getSecurityDescriptor() {
+
+        return this.desc;
+    }
+}
+
+class SecondTestResource implements SecureResource {
+
+    static Log logger =
+        LogFactory.getLog(TestSecurityConfig.class.getName());
+
+    ResourceSecurityDescriptor desc = null;
+
+    public SecondTestResource(String filename) throws Exception {
+
+        ResourceSecurityConfig config = new ResourceSecurityConfig(filename);
+        config.init();
+        this.desc = config.getSecurityDescriptor();
+    }
+
+    public ResourceSecurityDescriptor getSecurityDescriptor() {
+
+        return this.desc;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/TestSecurityDescriptor.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/TestSecurityDescriptor.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/TestSecurityDescriptor.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,603 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.security.descriptor;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.xml.sax.InputSource;
+
+import org.globus.wsrf.utils.XmlUtils;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+
+import java.io.File;
+import java.io.ObjectOutputStream;
+import java.io.FileOutputStream;
+import java.io.FileInputStream;
+import java.io.ByteArrayInputStream;
+
+import javax.security.auth.Subject;
+import org.globus.gsi.GlobusCredential;
+import org.globus.gsi.jaas.GlobusPrincipal;
+import org.globus.gsi.jaas.PasswordCredential;
+import org.globus.security.gridmap.GridMap;
+import org.globus.gsi.gssapi.GlobusGSSCredentialImpl;
+import java.security.cert.X509Certificate;
+import org.globus.wsrf.impl.security.authentication.encryption.EncryptionCredentials;
+
+import org.globus.wsrf.test.GridTestCase;
+
+import java.util.Set;
+import java.util.List;
+import java.util.Vector;
+import java.util.Iterator;
+
+import org.globus.axis.gsi.GSIConstants;
+
+import org.globus.wsrf.impl.security.util.AuthUtil;
+import org.globus.wsrf.impl.security.util.FixedObjectInputStream;
+import org.globus.wsrf.impl.security.authentication.Constants;
+import org.globus.wsrf.impl.security.authorization.HostAuthorization;
+
+public class TestSecurityDescriptor extends GridTestCase {
+
+    static Log logger =
+        LogFactory.getLog(TestSecurityDescriptor.class.getName());
+
+    private static final String SEC_DESC_1 =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+        "<securityConfig xmlns=\"http://www.globus.org\">" +
+	"<context-lifetime value=\"1000\"/>" +
+	"<reject-limited-proxy value=\"true\"/>" +
+	"<gridmap value=\"fooGridMap\"/>" +
+	"<replay-attack-filter value=\"true\"/>" +
+	"<credential>" +
+	"<key-file value=\"keyFile\"/>" + 
+	"<cert-file value=\"certFile\"/>" + 
+	"</credential>" +
+	"<proxy-file value=\"proxyFile\"/>" +
+        "<authz value=\"someNS:org.globus.someAuthz,gridmap\"/>" +
+	" </securityConfig>"; 
+	
+    private static final String SEC_DESC_2 =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+        "<securityConfig xmlns=\"http://www.globus.org\">" +
+	"<context-lifetime value=\"1000\"/>" +
+	"<credential>" +
+	"<cert-file value=\"certFile\"/>" + 
+	"</credential>" +
+	"<proxy-file value=\"proxyFile\"/>" + 
+	"<authz value=\"self\"/>" + 
+	" </securityConfig>"; 
+
+    private static final String SERVICE_DESC_1 =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+        "<securityConfig xmlns=\"http://www.globus.org\">" +
+        "<method name=\"gss:initTokenExchange\" xmlns:gss=\"http://gss.com\">" +
+        "  <run-as>" + 
+	"   <service-identity/>" + 
+	"  </run-as>" +
+        "  <auth-method>" + 
+	"    <GSISecureConversation/>" + 
+	"  </auth-method>" + 
+	"</method>" +
+        "<method name=\"gss:continueTokenExchange\" "
+	+ "xmlns:gss=\"http://gss.com\">" +
+        "  <run-as>" + 
+	"   <system-identity/>" + 
+	"  </run-as>" +
+        "  <auth-method>" + 
+	"    <GSISecureConversation>" + 
+	"      <protection-level>" +
+        "         <integrity/>" + 
+	"      </protection-level>" + 
+	"    </GSISecureConversation>" +
+        "    <GSISecureMessage>" +
+	"       <protection-level>" +
+	"          <integrity/>" +
+	"      </protection-level> " +
+	"     </GSISecureMessage>" +
+	"  </auth-method>" + 
+	"</method>" +
+        "<method name=\"wsse:findData\" xmlns:wsse=\"http://wsse.com\">" +
+        "  <auth-method>" + 
+	"    <none/>" + 
+	"  </auth-method>" + 
+	"</method>" +
+        "<run-as>" + 
+	" <caller-identity/>" + 
+	"</run-as>" + 
+	"<auth-method>" +
+        "    <GSISecureConversation>" + 
+	"      <protection-level>" + 
+	"         <privacy/>" +
+        "      </protection-level>" + 
+	"    </GSISecureConversation>" + 
+	"</auth-method>" +
+	"<method name=\"wsse:dummyMeth\" xmlns:wsse=\"http://wsse.com\">" +
+	" <auth-method>" +
+	"   <GSISecureMessage>" +
+	"      <protection-level>" +
+	"        <integrity/>" +
+	"      </protection-level>" +
+	"    </GSISecureMessage>" +
+	"   <GSISecureConversation> " +
+	"       <protection-level>" +
+	"         <privacy/>" +
+	"       </protection-level> " +
+	"    </GSISecureConversation>" +
+	" </auth-method>" +
+	"</method> " +
+	"<method name=\"wsse:dummyMeth1\" xmlns:wsse=\"http://wsse.com\">" +
+	" <auth-method>" +
+	"   <GSISecureMessage/>" +
+	"   <GSISecureConversation> " +
+	"      <protection-level>" +
+	"          <privacy/>" +
+	"      </protection-level> " +
+	"   </GSISecureConversation>" +
+	" </auth-method>" +
+	"</method>" +
+	"<method name=\"dummyMeth2\">" +
+	" <auth-method>" +
+	"   <GSISecureMessage/>" +
+	"   <GSISecureConversation/> " +
+	" </auth-method>" +
+	"</method> <reject-limited-proxy value=\"false\"/> " +
+	"<context-lifetime value=\"100\"/>" +
+	"</securityConfig>";
+
+    private static final String SERVICE_DESC_2 =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+        "<securityConfig xmlns=\"http://www.globus.org\">" +
+        "<method name=\"gss:continueTokenExchange\" "	+ 
+        "xmlns:gss=\"http://gss.com\">" +
+        "  <run-as>" + 
+	"   <service-identity/>" + 
+	"  </run-as>" +
+        "  <auth-method>" + 
+	"    <GSISecureConversation>" + 
+	"      <protection-level>" +
+        "         <integrity/>" + 
+	"      </protection-level>" + 
+	"    </GSISecureConversation>" +
+        "    <GSISecureMessage>" +
+	"       <protection-level>" +
+	"          <integrity/>" +
+	"      </protection-level> " +
+	"     </GSISecureMessage>" +
+	"  </auth-method>" + 
+	"</method>" +
+        "<method name=\"gss:tempMethod\" "	+ 
+        "xmlns:gss=\"http://gss.com\">" +
+        "  <auth-method>" + 
+	"    <GSITransport>" + 
+	"      <protection-level>" +
+        "         <integrity/>" + 
+	"      </protection-level>" + 
+	"    </GSITransport>" + 
+	"  </auth-method>" + 
+	"</method>" +
+        "  <auth-method>" + 
+	"    <GSITransport>" + 
+	"      <protection-level>" +
+        "         <privacy/>" + 
+	"      </protection-level>" + 
+	"    </GSITransport>" + 
+	"  </auth-method>" +
+	"</securityConfig>";
+
+    private static final String CONTAINER_DESC_1 = 
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+        "<securityConfig xmlns=\"http://www.globus.org\">" +
+	"<replay-timer-interval value=\"1000\"/>" + 
+	"<context-timer-interval value=\"12000\"/>" + 
+	"</securityConfig>";
+
+    private static final String CLIENT_DESC_1 =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+        "<securityConfig xmlns=\"http://www.globus.org\">" +
+	"<authz value=\"host\"/>" +
+	"<GSISecureMessage><privacy/><peer-credentials value=\"dummyPeer\"/>" +
+	"</GSISecureMessage>" +
+       	"<credential>" +
+	"<cert-file value=\"certFile\"/>" + 
+	"<key-file value=\"keyFile\"/>" + 
+	"</credential>" +
+	"<proxy-file value=\"proxyFile\"/>" + 
+	"</securityConfig>";
+
+    private static final String CLIENT_DESC_2 =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+        "<securityConfig xmlns=\"http://www.globus.org\">" +
+	"<GSISecureMessage><privacy/><peer-credentials value=\"dummyPeer\"/>" +
+	"</GSISecureMessage>" +
+	"<GSISecureConversation><integrity/><delegation value=\"full\"/>" +
+	"<anonymous/></GSISecureConversation></securityConfig>";
+
+    public TestSecurityDescriptor(String name) {
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestSecurityDescriptor.class);
+    }
+
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    protected Element getDescriptor(String desc) throws Exception {
+        InputSource is =
+            new InputSource(new ByteArrayInputStream(desc.getBytes()));
+        Document doc = XmlUtils.newDocument(is);
+
+        return doc.getDocumentElement();
+    }
+
+    // test gsi transport
+    public void testGSITransport() throws Exception {
+
+        ServiceSecurityDescriptor desc = new ServiceSecurityDescriptor();
+        Element elem = getDescriptor(SERVICE_DESC_2);
+        desc.parse(elem);
+
+        // tempMethod GSITransport (integrity) and default privacy
+        QName name = new QName("http://gss.com", "tempMethod");
+        List methods = new Vector();
+        methods.add(GSITransportAuthMethod.INTEGRITY);
+        compare(methods, desc.getAuthMethods(name));
+        
+        methods.clear();
+        
+        methods.add(GSITransportAuthMethod.PRIVACY);
+        compare(methods, desc.getDefaultAuthMethods());
+    }
+
+    // Tests descriptor with parameters that can be in both Service
+    // and Container SecurityDescriptor
+    public void testSecurityDesc() throws Exception {
+
+        assertTrue(TEST_CONTAINER != null);
+
+	// All parameters are correctly set
+	ServiceSecurityDescriptor desc = new ServiceSecurityDescriptor();
+	Element elem = getDescriptor(SEC_DESC_1);
+	desc.parse(elem);
+        verifyDescriptor1(desc);
+   
+	ContainerSecurityDescriptor desc1 = new ContainerSecurityDescriptor();
+	elem = getDescriptor(SEC_DESC_1);
+	desc1.parse(elem);
+	
+	// Credential parameter is not set correctly
+	desc = new ServiceSecurityDescriptor();
+	elem = getDescriptor(SEC_DESC_2);
+	boolean exp = false;
+	try {
+	    desc.parse(elem);
+	    fail("Did not throw exception as expected");
+	} catch (Exception e) {
+	    if (e.getMessage().indexOf("Credential") != -1)
+		exp = true; 
+	    else 
+		e.printStackTrace();
+	}
+	assertTrue(exp);
+    }
+
+    private void verifyDescriptor1(ServiceSecurityDescriptor desc) 
+        throws Exception {
+
+	assertTrue(desc.getContextLifetime().equals(new Integer(1000)));
+	assertTrue(desc.getRejectLimitedProxyState().equals("true"));
+	assertTrue(desc.getGridMapFile().equals("fooGridMap"));
+	assertTrue(desc.getReplayAttackFilter().equals("true"));
+	assertTrue(desc.getKeyFilename().equals("keyFile"));
+	assertTrue(desc.getCertFilename().equals("certFile"));
+	assertTrue(desc.getProxyFilename().equals("proxyFile"));
+	assertTrue(desc.getAuthz()
+                   .equals("someNS:org.globus.someAuthz,gridmap"));
+    }
+
+    // Run-as stuff
+    public void testMethodIdentity() throws Exception {
+        ServiceSecurityDescriptor desc = new ServiceSecurityDescriptor();
+
+        Element elem = getDescriptor(SERVICE_DESC_1);
+        desc.parse(elem);
+        verifyDescriptor2(desc);
+
+        ServiceSecurityDescriptor desc1 = new ServiceSecurityDescriptor();
+        elem = getDescriptor(SERVICE_DESC_2);
+        desc1.parse(elem);
+        
+        QName name = new QName("http://gss.com", "continueTokenExchange");
+        assertEquals(RunAsConstants.RESOURCE, desc1.getDefaultRunAsType());
+        assertEquals(RunAsConstants.SERVICE, desc1.getRunAsType(name));
+    }
+
+    private void verifyDescriptor2(ServiceSecurityDescriptor desc) {
+
+        QName name = null;
+
+        assertEquals(RunAsConstants.CALLER, desc.getDefaultRunAsType());
+
+        name = new QName("foo", "baar");
+        assertEquals(RunAsConstants.CALLER, desc.getRunAsType(name));
+
+        name = new QName("http://gss.com", "initTokenExchange");
+        assertEquals(RunAsConstants.SERVICE, desc.getRunAsType(name));
+
+        name = new QName("http://gss.com", "continueTokenExchange");
+        assertEquals(RunAsConstants.SYSTEM, desc.getRunAsType(name));
+    }
+
+    // default auth
+    public void testDefaultAuthMethods() throws Exception {
+        Element elem = null;
+        QName name = null;
+        List methods = new Vector();
+        ServiceSecurityDescriptor desc = new ServiceSecurityDescriptor();
+
+        elem = getDescriptor(SERVICE_DESC_1);
+        desc.parse(elem);
+
+        methods.add(GSISecureConvAuthMethod.PRIVACY);
+        compare(methods, desc.getDefaultAuthMethods());
+
+        name = new QName("foo", "baar");
+        compare(methods, desc.getAuthMethods(name));
+
+        methods.clear();
+        methods.add(GSISecureConvAuthMethod.BOTH);
+        name = new QName("http://gss.com", "initTokenExchange");
+        compare(methods, desc.getAuthMethods(name));
+
+        methods.clear();
+        methods.add(GSISecureConvAuthMethod.INTEGRITY);
+        methods.add(GSISecureMsgAuthMethod.INTEGRITY);
+        name = new QName("http://gss.com", "continueTokenExchange");
+        compare(methods, desc.getAuthMethods(name));
+
+        methods.clear();
+        methods.add(NoneAuthMethod.getInstance());
+        name = new QName("http://wsse.com", "findData");
+        compare(methods, desc.getAuthMethods(name));
+
+	methods.clear();
+	methods.add(GSISecureMsgAuthMethod.INTEGRITY);
+	methods.add(GSISecureConvAuthMethod.PRIVACY);
+	name = new QName("http://wsse.com", "dummyMeth");
+        compare(methods, desc.getAuthMethods(name));
+
+	methods.clear();
+	methods.add(GSISecureMsgAuthMethod.BOTH);
+	methods.add(GSISecureConvAuthMethod.PRIVACY);
+	name = new QName("http://wsse.com", "dummyMeth1");
+        compare(methods, desc.getAuthMethods(name));
+
+	// checks operation name matching with arbitrary namespace
+	methods.clear();
+	methods.add(GSISecureMsgAuthMethod.BOTH);
+	methods.add(GSISecureConvAuthMethod.BOTH);
+	name = new QName("http://wsse.com", "dummyMeth2");
+        compare(methods, desc.getAuthMethods(name));
+	name = new QName("http://foo", "dummyMeth2");
+        compare(methods, desc.getAuthMethods(name));
+    }
+
+    public void testContainerDesc() throws Exception {
+	ContainerSecurityDescriptor desc = new ContainerSecurityDescriptor();
+	Element elem = getDescriptor(CONTAINER_DESC_1);
+	desc.parse(elem);
+        verifyContainerDesc(desc);
+    }
+    
+    private void verifyContainerDesc(ContainerSecurityDescriptor desc) {
+
+	assertTrue(desc.getRejectLimitedProxyState() == null);
+	assertTrue(desc.getContextLifetime() == null);
+	assertTrue(desc.getReplayTimerInterval().equals("1000"));
+	assertTrue(desc.getContextTimerInterval().equals("12000"));
+    }
+
+    public void testClientDesc() throws Exception {
+	ClientSecurityDescriptor desc1 = new ClientSecurityDescriptor();
+	Element elem = getDescriptor(CLIENT_DESC_1);
+	desc1.parse(elem);
+        verifyClientDesc1(desc1);
+
+	ClientSecurityDescriptor desc2 = new ClientSecurityDescriptor();
+	elem = getDescriptor(CLIENT_DESC_2);
+	desc2.parse(elem);
+        verifyClientDesc2(desc2);
+        
+    }
+
+    private void verifyClientDesc1(ClientSecurityDescriptor desc) 
+        throws Exception {
+
+	assertTrue(desc.getAuthz() instanceof HostAuthorization);
+	assertTrue(Constants.ENCRYPTION.equals(desc.getGSISecureMsg()));
+	assertTrue(desc.getGSISecureConv() == null);
+	assertTrue(desc.getAnonymous() == null);
+	assertTrue("dummyPeer".equals(desc.getPeerCredentials()));
+	assertTrue("proxyFile".equals(desc.getProxyFilename()));
+	assertTrue("certFile".equals(desc.getCertFilename()));
+	assertTrue("keyFile".equals(desc.getKeyFilename()));
+    }
+
+    private void verifyClientDesc2(ClientSecurityDescriptor desc1) 
+        throws Exception {
+	
+	assertTrue(desc1.getAuthz() == null);
+	assertTrue(Constants.ENCRYPTION.equals(desc1.getGSISecureMsg()));
+	assertTrue(Constants.SIGNATURE.equals(desc1.getGSISecureConv()));
+	assertTrue(Boolean.TRUE.equals(desc1.getAnonymous()));
+	assertTrue(GSIConstants.GSI_MODE_FULL_DELEG
+		   .equals(desc1.getDelegation()));
+	assertTrue("dummyPeer".equals(desc1.getPeerCredentials()));
+    }
+
+    private void compare(List expected, List current) {
+        assertEquals(expected.size(), current.size());
+
+        for (int i = 0; i < expected.size(); i++) {
+            assertEquals(expected.get(i), current.get(i));
+        }
+    }
+
+    private Subject getSubject() throws Exception {
+        GlobusCredential credential = GlobusCredential.getDefaultCredential();
+        Subject subject = new Subject();
+        subject.getPrincipals().add(new GlobusPrincipal("random one"));
+        subject.getPublicCredentials().add(credential.getCertificateChain());
+        subject.getPublicCredentials().add(credential.getIdentityCertificate());
+        subject.getPublicCredentials()
+            .add(new EncryptionCredentials(credential.getCertificateChain()));
+        subject.getPrivateCredentials()
+            .add(new GlobusGSSCredentialImpl(credential, 1));
+        subject.getPrivateCredentials().add(new PasswordCredential("newPass"));
+        return subject;
+    }
+    
+    private void verifySubject(Subject subject) throws Exception {
+        assertTrue(subject != null);
+        Set publicCreds = subject.getPublicCredentials();
+        assertTrue(!publicCreds.isEmpty());
+        assertTrue(publicCreds.size() == 3);
+        Iterator iter = publicCreds.iterator();
+        Object obj = iter.next();
+        assertTrue(obj instanceof X509Certificate[]);
+        obj = iter.next();
+        assertTrue(obj instanceof X509Certificate);
+        obj = iter.next();
+        assertTrue(obj instanceof EncryptionCredentials);
+        assertTrue(((EncryptionCredentials)obj).getCertificates() != null);
+        Set privateCreds = subject.getPrivateCredentials();
+        assertTrue(!privateCreds.isEmpty());
+        assertTrue(privateCreds.size() == 2);
+        iter = privateCreds.iterator();
+        obj = iter.next();
+        assertTrue(obj instanceof GlobusGSSCredentialImpl);
+        obj = iter.next();
+        assertTrue(obj instanceof PasswordCredential);
+    }
+
+    public void testPersistence() throws Exception {
+        ServiceSecurityDescriptor desc1 = new ServiceSecurityDescriptor();
+	Element elem = getDescriptor(SEC_DESC_1);
+	desc1.parse(elem);
+
+        ServiceSecurityDescriptor desc2 = new ServiceSecurityDescriptor();
+	elem = getDescriptor(SERVICE_DESC_1);
+	desc2.parse(elem);
+
+	ContainerSecurityDescriptor contDesc = 
+            new ContainerSecurityDescriptor();
+	elem = getDescriptor(CONTAINER_DESC_1);
+	contDesc.parse(elem);
+
+        GridMap gridMap = new GridMap();
+        gridMap.map("hello", "world");
+        gridMap.map("some", "map");
+
+        Subject subject = getSubject();
+
+	ClientSecurityDescriptor clientDesc1 = new ClientSecurityDescriptor();
+	elem = getDescriptor(CLIENT_DESC_1);
+	clientDesc1.parse(elem);
+
+	ClientSecurityDescriptor clientDesc2 = new ClientSecurityDescriptor();
+	elem = getDescriptor(CLIENT_DESC_2);
+	clientDesc2.parse(elem);
+
+        ServiceSecurityDescriptor serviceDesc = new ServiceSecurityDescriptor();
+        serviceDesc.setSubject(subject);
+
+        // save it
+        FileOutputStream fos = null;
+        ObjectOutputStream oos = null;
+        File tmpFile = new File("security-desc-test.tmp");
+        try {
+            fos = new FileOutputStream(tmpFile);
+            oos = new ObjectOutputStream(fos);
+            oos.writeObject(desc1);
+            oos.writeObject(desc2);
+            oos.writeObject(contDesc);
+            oos.writeObject(gridMap);
+            AuthUtil.writeSubject(subject, oos);
+            oos.writeObject(clientDesc1);
+            oos.writeObject(clientDesc2);
+            oos.writeObject(serviceDesc);
+        } finally {
+            try {
+                if (fos != null)
+                    fos.close();
+                if (oos != null)
+                    oos.close();
+            } catch (Exception e) { }
+        }
+        FileInputStream fis = null;
+        FixedObjectInputStream ois = null;
+        ServiceSecurityDescriptor readInDesc1 = null;
+        ServiceSecurityDescriptor readInDesc2 = null;
+        ContainerSecurityDescriptor readInCont = null;
+        GridMap readInGridMap = null;
+        Subject readInSubject = null;
+        ClientSecurityDescriptor readClient1 = null;
+        ClientSecurityDescriptor readClient2 = null;
+        ServiceSecurityDescriptor readInDesc3 = null;
+        try {
+            fis = new FileInputStream(tmpFile);
+            ois = new FixedObjectInputStream(fis);
+            readInDesc1 = (ServiceSecurityDescriptor)ois.readObject();
+            readInDesc2 = (ServiceSecurityDescriptor)ois.readObject();
+            readInCont = (ContainerSecurityDescriptor)ois.readObject();
+            readInGridMap = (GridMap)ois.readObject();
+            readInSubject = AuthUtil.readSubject(ois);
+            readClient1 = (ClientSecurityDescriptor)ois.readObject();
+            readClient2 = (ClientSecurityDescriptor)ois.readObject();
+            readInDesc3 = (ServiceSecurityDescriptor)ois.readObject();
+        } finally {
+            try {
+                if (fis != null)
+                    fis.close();
+                if (ois != null)
+                    ois.close();
+                tmpFile.delete();
+            } catch (Exception e) { }
+        }
+        verifyDescriptor1(readInDesc1);
+        verifyDescriptor2(readInDesc2);
+        verifyContainerDesc(readInCont);
+        verifyClientDesc1(readClient1);
+        verifySubject(readInSubject);
+        verifyClientDesc2(readClient2);
+        Subject retr = readInDesc3.getSubject();
+        verifySubject(retr);
+        tmpFile.delete();
+    }
+}
+

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/client-security-desc.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/client-security-desc.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/client-security-desc.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<securityConfig xmlns="http://www.globus.org">
+    <authz value="host"/>
+    <GSISecureMessage>
+        <privacy/>
+    </GSISecureMessage>
+    <GSISecureConversation>
+        <integrity/>
+	<delegation value="full"/>
+        <anonymous/>
+    </GSISecureConversation>
+</securityConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/test-security-false.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/test-security-false.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/test-security-false.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<securityConfig xmlns="http://www.globus.org">
+<context-lifetime value="1000"/>
+<authz value="self"/>
+<reject-limited-proxy value="false"/>
+</securityConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/test-security-true.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/test-security-true.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/descriptor/test-security-true.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<securityConfig xmlns="http://www.globus.org">
+<context-lifetime value="1000"/>
+<authz value="self"/>
+<reject-limited-proxy value="true"/>
+</securityConfig>
\ No newline at end of file

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/host-client-security-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/host-client-security-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/security/host-client-security-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<securityConfig xmlns="http://www.globus.org">
+    <authz value="host"/>
+    <GSISecureConversation>
+        <integrity/>
+	<delegation value="full"/>
+    </GSISecureConversation>
+</securityConfig>

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/test-service-config.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/test-service-config.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/test-service-config.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,3 @@
+<securityConfig xmlns="http://www.globus.org">
+  <authz value="none"/>
+</securityConfig>

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/timer/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/timer/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/timer/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,32 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.timer;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends TestSuite {
+
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("TimerTests");
+        suite.addTestSuite(TimerTest.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/timer/TimerTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/timer/TimerTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/timer/TimerTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,220 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.timer;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Calendar;
+
+import javax.naming.Context;
+
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.jndi.JNDIUtils;
+
+import commonj.timers.Timer;
+import commonj.timers.TimerListener;
+import commonj.timers.TimerManager;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class TimerTest extends TestCase
+{
+    private static Context initialContext = null;
+    private static final String TIMER_JNDI_CONFIG =
+            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+            "<jndiConfig xmlns=\"http://wsrf.globus.org/jndi/config\">\r\n" +
+            "    <global>\r\n" +
+            "        <resource name=\"timer/ContainerTimer\" \r\n" +
+            "                  type=\"org.globus.wsrf.impl.timer.TimerManagerImpl\"\r\n" +
+            "                  >\r\n" +
+            "            <resourceParams>\r\n" +
+            "                <parameter>\r\n" +
+            "                    <name>\r\n" +
+            "                        factory\r\n" +
+            "                    </name>\r\n" +
+            "                    <value>\r\n" +
+            "                        org.apache.naming.factory.BeanFactory\r\n" +
+            "                    </value>\r\n" +
+            "                </parameter>\r\n" +
+            "            </resourceParams>\r\n" +
+            "        </resource>\r\n" +
+            "    </global>\r\n" +
+            "</jndiConfig>\r\n";
+
+    public static Test suite()
+    {
+        return new TestSuite(TimerTest.class);
+    }
+
+    public void testScheduleDelay() throws Exception
+    {
+        TimerManager timerManager = getTimerManager();
+        Timer timer = timerManager.schedule(new TestTimerListener(), 100);
+        assertEquals(
+                false,
+                ((TestTimerListener) timer.getTimerListener()).getIRan());
+        Thread.sleep(120);
+        assertEquals(
+                true,
+                ((TestTimerListener) timer.getTimerListener()).getIRan());
+        timer.cancel();
+    }
+
+    public void testScheduleAbsolute() throws Exception
+    {
+        TimerManager timerManager = getTimerManager();
+        Calendar time = Calendar.getInstance();
+        time.add(Calendar.MILLISECOND, 150);
+        Timer timer = timerManager.schedule(new TestTimerListener(),
+                                            time.getTime());
+        assertEquals(
+                false,
+                ((TestTimerListener) timer.getTimerListener()).getIRan());
+        Thread.sleep(170);
+        assertEquals(
+                true,
+                ((TestTimerListener) timer.getTimerListener()).getIRan());
+        timer.cancel();
+    }
+
+    public void testScheduleDelayPeriodic() throws Exception
+    {
+        TimerManager timerManager = getTimerManager();
+        Timer timer = timerManager.schedule(
+                new PeriodicTestTimerListener(), 100, 100);
+        assertEquals(
+                0,
+                ((PeriodicTestTimerListener)
+                timer.getTimerListener()).getCount());
+        Thread.sleep(120);
+        assertEquals(
+                1,
+                ((PeriodicTestTimerListener)
+                timer.getTimerListener()).getCount());
+        Thread.sleep(120);
+        assertEquals(
+                2,
+                ((PeriodicTestTimerListener)
+                timer.getTimerListener()).getCount());
+        timer.cancel();
+    }
+
+    public void testScheduleAbsolutePeriodic() throws Exception
+    {
+        TimerManager timerManager = getTimerManager();
+        Calendar time = Calendar.getInstance();
+        time.add(Calendar.MILLISECOND, 100);
+        Timer timer = timerManager.schedule(
+                new PeriodicTestTimerListener(), time.getTime(), 100);
+        assertEquals(
+                0,
+                ((PeriodicTestTimerListener)
+                timer.getTimerListener()).getCount());
+        Thread.sleep(120);
+        assertEquals(
+                1,
+                ((PeriodicTestTimerListener)
+                timer.getTimerListener()).getCount());
+        Thread.sleep(120);
+        assertEquals(
+                2,
+                ((PeriodicTestTimerListener)
+                timer.getTimerListener()).getCount());
+        timer.cancel();
+    }
+
+    public void testSuspendResume() throws Exception
+    {
+        TimerManager timerManager = getTimerManager();
+        Timer timer = timerManager.schedule(
+                new PeriodicTestTimerListener(), 200, 200);
+        Thread.sleep(220);
+        timerManager.suspend();
+        Thread.sleep(420);
+        timerManager.resume();
+        assertEquals(
+                2,
+                ((PeriodicTestTimerListener)
+                timer.getTimerListener()).getCount());
+    }
+
+    public void testCancel() throws Exception
+    {
+        TimerManager timerManager = getTimerManager();
+        Timer timer = timerManager.schedule(new TestTimerListener(), 100);
+        timer.cancel();
+        Thread.sleep(120);
+        assertEquals(
+                false,
+                ((TestTimerListener) timer.getTimerListener()).getIRan());
+    }
+
+    public void testStop() throws Exception
+    {
+        TimerManager timerManager = getTimerManager();
+        Timer timer = timerManager.schedule(new TestTimerListener(), 100);
+        timerManager.stop();
+        Thread.sleep(120);
+        assertEquals(
+                false,
+                ((TestTimerListener) timer.getTimerListener()).getIRan());
+    }
+
+    private static TimerManager getTimerManager()
+            throws Exception
+    {
+        if(initialContext == null)
+        {
+            InputStream input = new ByteArrayInputStream(
+                    TIMER_JNDI_CONFIG.getBytes());
+            initialContext = JNDIUtils.initJNDI();
+            JNDIUtils.parseJNDIConfig(input);
+        }
+        return (TimerManager) initialContext.lookup(
+                Constants.DEFAULT_TIMER);
+    }
+
+    private class TestTimerListener implements TimerListener
+    {
+        boolean iRan = false;
+
+        public boolean getIRan()
+        {
+            return this.iRan;
+        }
+
+        public void timerExpired(Timer timer)
+        {
+           this.iRan = true;
+        }
+    }
+
+    private class PeriodicTestTimerListener implements TimerListener
+    {
+        int count = 0;
+
+        public int getCount()
+        {
+            return count;
+        }
+
+        public void timerExpired(Timer timer)
+        {
+            this.count++;
+        }
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/work/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/work/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/work/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,32 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.work;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends TestSuite {
+
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("WorkTests");
+        suite.addTestSuite(WorkTest.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/work/WorkTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/work/WorkTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/impl/work/WorkTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,295 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.impl.work;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.List;
+import java.util.ArrayList;
+
+import javax.naming.Context;
+
+import org.globus.wsrf.Constants;
+import org.globus.wsrf.jndi.JNDIUtils;
+
+import commonj.work.Work;
+import commonj.work.WorkEvent;
+import commonj.work.WorkItem;
+import commonj.work.WorkManager;
+import commonj.work.WorkListener;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class
+    WorkTest extends TestCase
+{
+    private static Context initialContext = null;
+    private static final String TIMER_JNDI_CONFIG =
+            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+            "<jndiConfig xmlns=\"http://wsrf.globus.org/jndi/config\">\r\n" +
+            "    <global>\r\n" +
+            "        <resource name=\"wm/ContainerWorkManager\" \r\n" +
+            "                  type=\"org.globus.wsrf.impl.work.WorkManagerImpl\"\r\n" +
+            "                  >\r\n" +
+            "            <resourceParams>\r\n" +
+            "                <parameter>\r\n" +
+            "                    <name>\r\n" +
+            "                        factory\r\n" +
+            "                    </name>\r\n" +
+            "                    <value>\r\n" +
+            "                        org.apache.naming.factory.BeanFactory\r\n" +
+            "                    </value>\r\n" +
+            "                </parameter>\r\n" +
+            "            </resourceParams>\r\n" +
+            "        </resource>\r\n" +
+            "    </global>\r\n" +
+            "</jndiConfig>\r\n";
+
+    public static Test suite()
+    {
+        return new TestSuite(WorkTest.class);
+    }
+
+    public void testScheduleWork() throws Exception
+    {
+        WorkManager workManager = getWorkManager();
+        TestWork work = new TestWork(100);
+        WorkItem workItem = workManager.schedule(work);
+        waitForStatus(workItem, WorkEvent.WORK_STARTED, 200);
+        assertEquals(WorkEvent.WORK_STARTED, workItem.getStatus());
+        waitForStatus(workItem, WorkEvent.WORK_COMPLETED, 200);
+        assertEquals(WorkEvent.WORK_COMPLETED, workItem.getStatus());
+        assertEquals(true, work.getIRan());
+    }
+
+
+    public void testScheduleDaemonWork() throws Exception
+    {
+        WorkManager workManager = getWorkManager();
+        TestWork work = new TestWork(100, true);
+        WorkItem workItem = workManager.schedule(work);
+        waitForStatus(workItem, WorkEvent.WORK_STARTED, 200);
+        assertEquals(WorkEvent.WORK_STARTED, workItem.getStatus());
+        waitForStatus(workItem, WorkEvent.WORK_COMPLETED, 200);
+        assertEquals(WorkEvent.WORK_COMPLETED, workItem.getStatus());
+        assertEquals(true, work.getIRan());
+    }
+
+    public void testWorkListener() throws Exception
+    {
+        WorkManager workManager = getWorkManager();
+        TestWork work = new TestWork(100);
+        TestWorkListener listener = new TestWorkListener();
+        workManager.schedule(work, listener);
+        waitForStatus(listener, WorkEvent.WORK_STARTED, 200);
+        assertEquals(WorkEvent.WORK_STARTED, listener.getStatus());
+        waitForStatus(listener, WorkEvent.WORK_COMPLETED, 200);
+        assertEquals(WorkEvent.WORK_COMPLETED, listener.getStatus());
+        assertEquals(true, work.getIRan());
+    }
+
+    public void testWaitForAllImmediate() throws Exception
+    {
+        WorkManager workManager = getWorkManager();
+        TestWork work1 = new TestWork(100);
+        TestWork work2 = new TestWork(300);
+        List workList = new ArrayList();
+        WorkItem item1 = workManager.schedule(work1);
+        WorkItem item2 = workManager.schedule(work2);
+        workList.add(item1);
+        waitForStatus(item1, WorkEvent.WORK_COMPLETED, 200);
+        assertEquals(true, workManager.waitForAll(workList,
+                                                  WorkManager.IMMEDIATE));
+        workList.add(item2);
+        assertEquals(false, workManager.waitForAll(workList,
+                                                   WorkManager.IMMEDIATE));
+    }
+
+    public void testWaitForAllIndefinite() throws Exception
+    {
+        WorkManager workManager = getWorkManager();
+        TestWork work1 = new TestWork(100);
+        TestWork work2 = new TestWork(300);
+        List workList = new ArrayList();
+        WorkItem item1 = workManager.schedule(work1);
+        WorkItem item2 = workManager.schedule(work2);
+        workList.add(item1);
+        workList.add(item2);
+        assertEquals(true, workManager.waitForAll(workList,
+                                                  WorkManager.INDEFINITE));
+    }
+
+    public void testWaitForAll() throws Exception
+    {
+        WorkManager workManager = getWorkManager();
+        TestWork work1 = new TestWork(100);
+        TestWork work2 = new TestWork(30000);
+        List workList = new ArrayList();
+        WorkItem item1 = workManager.schedule(work1);
+        WorkItem item2 = workManager.schedule(work2);
+        workList.add(item1);
+        assertEquals(true, workManager.waitForAll(workList, 300));
+        workList.add(item2);
+        assertEquals(false, workManager.waitForAll(workList, 110));
+    }
+
+    public void testWaitForAnyImmediate() throws Exception
+    {
+        WorkManager workManager = getWorkManager();
+        TestWork work1 = new TestWork(100);
+        TestWork work2 = new TestWork(300);
+        List workList = new ArrayList();
+        WorkItem item1 = workManager.schedule(work1);
+        WorkItem item2 = workManager.schedule(work2);
+        workList.add(item1);
+        workList.add(item2);
+        waitForStatus(item1, WorkEvent.WORK_COMPLETED, 200);
+        assertEquals(1, workManager.waitForAny(
+                workList,
+                WorkManager.IMMEDIATE).size());
+        waitForStatus(item2, WorkEvent.WORK_COMPLETED, 500);
+        assertEquals(2, workManager.waitForAny(
+                workList,
+                WorkManager.IMMEDIATE).size());
+    }
+
+    public void testWaitForAny() throws Exception
+    {
+        WorkManager workManager = getWorkManager();
+        TestWork work1 = new TestWork(100);
+        TestWork work2 = new TestWork(500);
+        List workList = new ArrayList();
+        WorkItem item1 = workManager.schedule(work1);
+        WorkItem item2 = workManager.schedule(work2);
+        workList.add(item1);
+        workList.add(item2);
+        assertEquals(1, workManager.waitForAny(
+                workList,
+                300).size());
+        assertEquals(2, workManager.waitForAny(
+                workList,
+                1000).size());
+    }
+
+    private static WorkManager getWorkManager()
+            throws Exception
+    {
+        if(initialContext == null)
+        {
+            InputStream input = new ByteArrayInputStream(
+                    TIMER_JNDI_CONFIG.getBytes());
+            initialContext = JNDIUtils.initJNDI();
+            JNDIUtils.parseJNDIConfig(input);
+        }
+
+        return (WorkManager) initialContext.lookup(
+                Constants.DEFAULT_WORK_MANAGER);
+    }
+
+    private void waitForStatus(WorkItem workItem, int status, int maxWait)
+        throws InterruptedException
+    {
+        int waited = 0;
+        while(waited < maxWait &&
+              workItem.getStatus() != status)
+        {
+            Thread.sleep(20);
+            waited += 20;
+        }
+    }
+
+    private class TestWork implements Work
+    {
+        boolean daemon = false;
+        boolean iRan = false;
+        boolean release = false;
+        long sleepTime = 0;
+
+        public TestWork(long sleepTime, boolean daemon)
+        {
+            this.daemon = daemon;
+            this.sleepTime = sleepTime;
+        }
+
+        public TestWork(long sleepTime)
+        {
+            this(sleepTime, false);
+        }
+
+        public boolean getIRan()
+        {
+            return this.iRan;
+        }
+
+        public void release()
+        {
+            this.release = true;
+        }
+
+        public boolean isDaemon()
+        {
+            return this.daemon;
+        }
+
+        public void run()
+        {
+            long timeSlept = 0;
+            while(timeSlept < this.sleepTime && !this.release)
+            {
+                try
+                {
+                    Thread.sleep(10);
+                    timeSlept += 10;
+                }
+                catch(InterruptedException e)
+                {
+                }
+            }
+            this.iRan = true;
+        }
+    }
+
+    private class TestWorkListener implements WorkListener, WorkItem
+    {
+        int status = -1;
+
+        public void workAccepted(WorkEvent event)
+        {
+            this.status = event.getType();
+        }
+
+        public void workRejected(WorkEvent event)
+        {
+            this.status = event.getType();
+        }
+
+        public void workStarted(WorkEvent event)
+        {
+            this.status = event.getType();
+        }
+
+        public void workCompleted(WorkEvent event)
+        {
+            this.status = event.getType();
+        }
+
+        public int getStatus()
+        {
+            return status;
+        }
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/JNDITest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/JNDITest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/JNDITest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,184 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.jndi;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import javax.naming.Context;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.globus.wsrf.jndi.JNDIUtils;
+
+public class JNDITest extends TestCase
+{
+    private static Context initialContext = null;
+
+    private static final String TEST_CONFIG =
+        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" +
+        "<jndiConfig xmlns=\"http://wsrf.globus.org/jndi/config\">\r\n" +
+        "    <global>\r\n" +
+        "        <environment name=\"test1\" \r\n" +
+        "                     type=\"java.lang.String\"\r\n" +
+        "                     value=\"testString\"/>\r\n" +
+        "        <environment name=\"test3\" \r\n" +
+        "                     type=\"java.lang.Byte\"\r\n" +
+        "                     value=\"111\"/>\r\n" +
+        "        <environment name=\"test4\" \r\n" +
+        "                     type=\"java.lang.Character\"\r\n" +
+        "                     value=\"q\"/>\r\n" +
+        "        <environment name=\"test5\" \r\n" +
+        "                     type=\"java.lang.Double\"\r\n" +
+        "                     value=\"1.12345\"/>\r\n" +
+        "        <environment name=\"test6\" \r\n" +
+        "                     type=\"java.lang.Float\"\r\n" +
+        "                     value=\"1.12345\"/>\r\n" +
+        "        <environment name=\"test7\" \r\n" +
+        "                     type=\"java.lang.Integer\"\r\n" +
+        "                     value=\"12345\"/>\r\n" +
+        "        <environment name=\"test8\" \r\n" +
+        "                     type=\"java.lang.Long\"\r\n" +
+        "                     value=\"12345\"/>\r\n" +
+        "        <environment name=\"test9\" \r\n" +
+        "                     type=\"java.lang.Short\"\r\n" +
+        "                     value=\"12345\"/>\r\n" +
+        "        <resource name=\"testResource1\" \r\n" +
+        "                     type=\"java.lang.String\"\r\n" +
+        "                     description=\"Produces test strings\">\r\n" +
+        "            <resourceParams>\r\n" +
+        "                <parameter>\r\n" +
+        "                    <name>\r\n" +
+        "                        factory\r\n" +
+        "                    </name>\r\n" +
+        "                    <value>\r\n" +
+        "                        org.globus.wsrf.jndi.TestFactory\r\n" +
+        "                    </value>\r\n" +
+        "                </parameter>\r\n" +
+        "                <parameter>\r\n" +
+        "                    <name>\r\n" +
+        "                        baseString\r\n" +
+        "                    </name>\r\n" +
+        "                    <value>\r\n" +
+        "                        Global Test Nr: \r\n" +
+        "                    </value>\r\n" +
+        "                </parameter>\r\n" +
+        "            </resourceParams>\r\n" +
+        "        </resource>\r\n" +
+        "    </global>\r\n" +
+        "    <service name=\"TestService\">\r\n" +
+        "        <environment name=\"test2\" \r\n" +
+        "                     type=\"java.lang.Boolean\"\r\n" +
+        "                     value=\"true\"/>\r\n" +
+        "        <resource name=\"testResource2\" \r\n" +
+        "                     type=\"java.lang.String\"\r\n" +
+        "                     description=\"Produces test strings\">\r\n" +
+        "            <resourceParams>\r\n" +
+        "                <parameter>\r\n" +
+        "                    <name>\r\n" +
+        "                        factory\r\n" +
+        "                    </name>\r\n" +
+        "                    <value>\r\n" +
+        "                        org.globus.wsrf.jndi.TestFactory\r\n" +
+        "                    </value>\r\n" +
+        "                </parameter>\r\n" +
+        "                <parameter>\r\n" +
+        "                    <name>\r\n" +
+        "                        baseString\r\n" +
+        "                    </name>\r\n" +
+        "                    <value>\r\n" +
+        "                        Service Test Nr: \r\n" +
+        "                    </value>\r\n" +
+        "                </parameter>\r\n" +
+        "            </resourceParams>\r\n" +
+        "        </resource>\r\n" +
+        "        <resourceLink name=\"testResource1\" \r\n" +
+        "                     target=\"java:comp/env/testResource1\"/>\r\n" +
+        "    </service>\r\n" +
+        "</jndiConfig>\r\n";
+
+    public static Test suite()
+    {
+        return new TestSuite(JNDITest.class);
+    }
+
+    public void setUp() throws Exception 
+    {
+        if (initialContext == null)
+        {
+            InputStream input = 
+                new ByteArrayInputStream(TEST_CONFIG.getBytes());
+            initialContext = JNDIUtils.initJNDI();
+            JNDIUtils.parseJNDIConfig(input);
+        }
+    }
+
+    public void testJNDIConfigEnvironment() throws Exception
+    {
+        assertEquals(
+            (String) initialContext.lookup("java:comp/env/test1"),
+            "testString");
+        assertEquals(
+            (Boolean) initialContext.lookup("java:comp/env/services/TestService/test2"),
+            Boolean.TRUE);
+        assertEquals(
+            (Byte) initialContext.lookup("java:comp/env/test3"),
+            new Byte((byte) 111));
+        assertEquals(
+            (Character) initialContext.lookup("java:comp/env/test4"),
+            new Character('q'));
+        assertEquals(
+            (Double) initialContext.lookup("java:comp/env/test5"),
+            new Double(1.12345));
+        assertEquals(
+            (Float) initialContext.lookup("java:comp/env/test6"),
+            new Float(1.12345));
+        assertEquals(
+            (Integer) initialContext.lookup("java:comp/env/test7"),
+            new Integer(12345));
+        assertEquals(
+            (Long) initialContext.lookup("java:comp/env/test8"),
+            new Long(12345));
+        assertEquals(
+            (Short) initialContext.lookup("java:comp/env/test9"),
+            new Short((short) 12345));
+    }
+
+    public void testJNDIConfigResource() throws Exception
+    {
+        assertEquals(
+            "Global Test Nr: 0",
+            (String) initialContext.lookup("java:comp/env/testResource1"));
+
+        assertEquals(
+            "Service Test Nr: 1",
+            (String) initialContext.lookup("java:comp/env/services/TestService/testResource2"));
+
+    }
+
+    public void testJNDIConfigResourceLink() throws Exception
+    {
+        // Looks like once the object is produced it stays
+        // Ie another access to the same name returns the same object
+        assertEquals(
+            "Global Test Nr: 0",
+            (String) initialContext.lookup("java:comp/env/services/TestService/testResource1"));
+
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,32 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.jndi;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends TestSuite {
+
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("JNDITests");
+        suite.addTestSuite(JNDITest.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/TestFactory.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/TestFactory.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/jndi/TestFactory.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,58 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.jndi;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.spi.ObjectFactory;
+
+public class TestFactory implements ObjectFactory
+{
+    private String baseString = null;
+    private static int counter = 0;
+    
+    /* (non-Javadoc)
+     * @see javax.naming.spi.ObjectFactory#getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)
+     */
+    public Object getObjectInstance(Object obj, Name name, Context nameCtx,
+        Hashtable environment) throws Exception
+    {
+        Reference reference = (Reference) obj;
+        RefAddr baseStringAddr = reference.get("baseString");
+        this.baseString = baseStringAddr.getContent().toString();
+        return this.baseString + " " + String.valueOf(counter++);
+    }
+
+    /**
+     * @return Returns the baseString.
+     */
+    public String getBaseString()
+    {
+        return baseString;
+    }
+
+    /**
+     * @param baseString The baseString to set.
+     */
+    public void setBaseString(String baseString)
+    {
+        this.baseString = baseString;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/FaultHelperTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/FaultHelperTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/FaultHelperTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,115 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils;
+
+import junit.framework.TestCase;
+
+import org.globus.wsrf.encoding.ObjectSerializer;
+
+import javax.xml.namespace.QName;
+
+import org.oasis.wsrf.faults.BaseFaultType;
+
+public class FaultHelperTest extends TestCase {
+
+    private static final QName FAULT_QNAME =
+        new QName("http://foo", "bar");
+    
+    public void testDescription() throws Exception {
+        BaseFaultType fault = new BaseFaultType();
+        FaultHelper faultHelper = new FaultHelper(fault);
+
+        faultHelper.setDescription("foo");
+        assertTrue(faultHelper.getDescription() != null);
+        assertEquals(1, faultHelper.getDescription().length);
+        assertEquals("foo", faultHelper.getDescription()[0]);
+        assertEquals("foo", faultHelper.getDescriptionAsString());
+        
+        faultHelper.setDescription(new String[] {"bar", "foo"});
+        assertTrue(faultHelper.getDescription() != null);
+        assertEquals(2, faultHelper.getDescription().length);
+        assertEquals("bar", faultHelper.getDescription()[0]);
+        assertEquals("foo", faultHelper.getDescription()[1]);
+        assertEquals("bar / foo", faultHelper.getDescriptionAsString());
+        
+        faultHelper.setDescription((String)null);
+        assertTrue(faultHelper.getDescription() == null);
+
+        faultHelper.setDescription((String[])null);
+        assertTrue(faultHelper.getDescription() == null);
+
+        faultHelper.addDescription("aaa");
+        faultHelper.addDescription("bbb");
+        assertTrue(faultHelper.getDescription() != null);
+        assertEquals(2, faultHelper.getDescription().length);
+        assertEquals("aaa", faultHelper.getDescription()[0]);
+        assertEquals("bbb", faultHelper.getDescription()[1]);
+    }
+    
+    public void testChainingBaseFault() throws Exception {
+        BaseFaultType fault = new BaseFaultType();
+        
+        assertTrue(fault.getFaultCause() == null);
+        
+        FaultHelper faultHelper = new FaultHelper(fault);
+        
+        assertTrue(fault.getFaultCause() != null);
+        assertEquals(1, fault.getFaultCause().length);
+        assertEquals(FaultHelper.STACK_TRACE, 
+                     fault.getFaultCause()[0].getErrorCode().getDialect());
+
+        BaseFaultType fault1 = new BaseFaultType();
+
+        assertTrue(fault1.getFaultCause() == null);
+
+        faultHelper.addFaultCause(fault1);
+
+        assertTrue(fault1.getFaultCause() != null);
+        assertEquals(1, fault1.getFaultCause().length);
+        assertEquals(FaultHelper.STACK_TRACE, 
+                     fault1.getFaultCause()[0].getErrorCode().getDialect());
+
+        assertEquals(2, fault.getFaultCause().length);
+
+        System.out.println(ObjectSerializer.toString(fault, FAULT_QNAME));
+    }
+
+    public void testChainingException() throws Exception {
+        BaseFaultType fault = new BaseFaultType();
+        
+        assertTrue(fault.getFaultCause() == null);
+        
+        FaultHelper faultHelper = new FaultHelper(fault);
+        
+        assertTrue(fault.getFaultCause() != null);
+        assertEquals(1, fault.getFaultCause().length);
+        assertEquals(FaultHelper.STACK_TRACE, 
+                     fault.getFaultCause()[0].getErrorCode().getDialect());
+        
+        Exception e = new Exception();
+        
+        faultHelper.addFaultCause(e);
+        
+        assertEquals(2, fault.getFaultCause().length);
+        assertEquals(FaultHelper.STACK_TRACE, 
+                     fault.getFaultCause()[0].getErrorCode().getDialect());
+        assertEquals(FaultHelper.EXCEPTION,
+                     fault.getFaultCause()[1].getErrorCode().getDialect());
+        
+        System.out.println(ObjectSerializer.toString(fault, FAULT_QNAME));
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,33 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends TestSuite {
+
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("UtilsTests");
+        suite.addTestSuite(FaultHelperTest.class);
+        suite.addTestSuite(XmlPersistenceHelperTest.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/XmlPersistenceHelperTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/XmlPersistenceHelperTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/XmlPersistenceHelperTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,140 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils;
+
+import java.util.List;
+import java.util.Iterator;
+import java.util.HashMap;
+
+import org.globus.wsrf.ResourceKey;
+import org.globus.wsrf.impl.SimpleResourceKey;
+import org.globus.wsrf.impl.ReflectionResource;
+
+import org.globus.wsrf.tests.basic.TestRP;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+public class XmlPersistenceHelperTest extends TestCase {
+
+    private static final QName KEY = 
+        new QName("http://globus.org", "TestKey");
+    
+    private static final QName ELEM =
+        new QName("http://globus.org", "TestElement");
+    
+    private static final ResourceKey KEY_1 = 
+        new SimpleResourceKey(KEY, "1");
+
+    private static final ResourceKey KEY_2 = 
+        new SimpleResourceKey(KEY, "2");
+
+    public void testStore() throws Exception {
+        
+        TestRP rp = new TestRP();
+        rp.setValue(5);
+        
+        XmlPersistenceHelper helper =
+            new XmlPersistenceHelper(TestRP.class);
+        
+        helper.store(KEY_1, rp, ELEM);
+        
+        TestRP rp2 = (TestRP)helper.load(KEY_1);
+        
+        assertEquals(5, rp2.getValue());
+    }
+
+    public void testReflectionResource() throws Exception {
+        TestRP rp = new TestRP();
+        rp.setValue(5);
+        
+        XmlPersistenceHelper helper =
+            new XmlPersistenceHelper(TestRP.class);
+
+        helper.store(KEY_2, rp, ELEM);
+
+        ReflectionResource resource = new ReflectionResource();
+
+        helper.load(KEY_2, resource);
+        
+        assertTrue(resource.getResourceBean() != null);
+        assertTrue(resource.getResourceBean() instanceof TestRP);
+        assertEquals(5, ((TestRP)resource.getResourceBean()).getValue());
+        
+        assertTrue(resource.getResourcePropertySet() != null);
+        assertEquals(ELEM, resource.getResourcePropertySet().getName());
+    }
+    
+    public void testList() throws Exception {
+
+        XmlPersistenceHelper helper =
+            new XmlPersistenceHelper(TestRP.class);
+
+        ResourceKey [] keys = new ResourceKey[]{KEY_1, KEY_2};
+
+        listTest(helper, keys);
+    }
+
+    public void testDelete() throws Exception {
+
+        XmlPersistenceHelper helper =
+            new XmlPersistenceHelper(TestRP.class);
+
+        listTest(helper, new ResourceKey[]{KEY_1, KEY_2});
+        
+        helper.remove(KEY_1);
+        
+        listTest(helper, new ResourceKey[]{KEY_2});
+    }
+
+    public void testRemoveAll() throws Exception {
+
+        XmlPersistenceHelper helper =
+            new XmlPersistenceHelper(TestRP.class);
+
+        listTest(helper, new ResourceKey[]{KEY_1, KEY_2});
+        
+        helper.removeAll();
+        
+        List list = helper.list();
+        assertTrue(list != null);
+        assertTrue(list.isEmpty());
+    }
+
+    private  void listTest(XmlPersistenceHelper helper, 
+                           ResourceKey[] keys) throws Exception {
+        TestRP rp = new TestRP(10);
+        
+        for (int i=0;i<keys.length;i++) {
+            helper.store(keys[i], rp, ELEM);
+        }
+        
+        List list = helper.list();
+        assertTrue(list != null);
+        assertEquals(keys.length, list.size());
+        HashMap listKeys = new HashMap();
+        Iterator iter = list.iterator();
+        while(iter.hasNext()) {
+            listKeys.put(iter.next(), "");
+        }
+        assertEquals(keys.length, listKeys.size());
+        for (int i=0;i<keys.length;i++) {
+            assertTrue( listKeys.get(keys[i].getValue()) != null );
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/cache/LinkedNodeListTest.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/cache/LinkedNodeListTest.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/cache/LinkedNodeListTest.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,286 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils.cache;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import junit.framework.TestCase;
+
+public class LinkedNodeListTest extends TestCase {
+
+    public void testAdd() {
+        LinkedNodeList list = new LinkedNodeList();
+        assertTrue( list.getFirst() == null );
+        assertEquals(0, list.size());
+        assertTrue( list.isEmpty() );
+
+        LinkedNodeList.Node n1 = list.createNode();
+        list.add(n1);
+        assertTrue( list.getFirst() == n1 );
+        assertTrue( list.getFirst().getNext() == null );
+        assertTrue( list.getFirst().getPrevious() == null );
+        assertTrue( list.getLast() == n1 );
+        assertTrue( list.getLast().getNext() == null );
+        assertTrue( list.getLast().getPrevious() == null );
+        assertFalse( list.isEmpty() );
+
+        assertEquals(1, list.size());
+
+        LinkedNodeList.Node n2 = list.createNode();
+        list.add(n2);
+        assertTrue( list.getFirst() == n1 );
+        assertTrue( list.getFirst().getNext() == n2 );
+        assertTrue( list.getFirst().getNext().getNext() == null );
+        assertTrue( list.getFirst().getNext().getPrevious() == n1 );
+        assertTrue( list.getLast() == n2 );
+        assertTrue( list.getLast().getNext() == null );
+        assertTrue( list.getLast().getPrevious() == n1 );
+        assertEquals(2, list.size());
+
+        LinkedNodeList.Node n3 = list.createNode();
+        list.add(n3);
+        assertTrue( list.getFirst() == n1 );
+        assertTrue( list.getFirst().getNext() == n2 );
+        assertTrue( list.getFirst().getNext().getNext() == n3 );
+        assertTrue( list.getFirst().getNext().getNext().getNext() == null );
+        assertTrue( list.getFirst().getNext().getNext().getPrevious() == n2 );
+        assertTrue( list.getLast() == n3 );
+        assertTrue( list.getLast().getNext() == null );
+        assertTrue( list.getLast().getPrevious() == n2 );
+        assertEquals(3, list.size());
+    }
+
+    public void testRemove() {
+        LinkedNodeList list = new LinkedNodeList();
+        assertTrue( list.getFirst() == null );
+
+        LinkedNodeList.Node n1 = list.createNode();
+        list.add(n1);
+        LinkedNodeList.Node n2 = list.createNode();
+        list.add(n2);
+        LinkedNodeList.Node n3 = list.createNode();
+        list.add(n3);
+        LinkedNodeList.Node n4 = list.createNode();
+        list.add(n4);
+        System.out.println("1: " + list);
+
+        // delete middle
+        list.remove(n2);
+        System.out.println("2: " + list);
+
+        assertTrue( list.getFirst() == n1 );
+        assertTrue( list.getFirst().getNext() == n3 );
+        assertTrue( list.getFirst().getNext().getNext() == n4 );
+        assertTrue( list.getFirst().getNext().getPrevious() == n1 );
+        assertTrue( list.getFirst().getNext().getNext().getNext() == null );
+
+        assertTrue( list.getLast() == n4 );
+        assertTrue( list.getLast().getNext() == null );
+        assertTrue( list.getLast().getPrevious() == n3 );
+
+        assertEquals(3, list.size());
+
+        // delete tail
+        list.remove(n4);
+        System.out.println("3: " + list);
+
+        assertTrue( list.getFirst() == n1 );
+        assertTrue( list.getFirst().getNext() == n3 );
+        assertTrue( list.getFirst().getNext().getNext() == null );
+
+        assertTrue( list.getLast() == n3 );
+        assertTrue( list.getLast().getNext() == null );
+        assertTrue( list.getLast().getPrevious() == n1 );
+
+        assertEquals(2, list.size());
+
+        // delete head
+        list.remove(n1);
+        System.out.println("4: " + list);
+
+        assertTrue( list.getFirst() == n3 );
+        assertTrue( list.getFirst().getPrevious() == null );
+        assertTrue( list.getFirst().getNext() == null );
+
+        assertTrue( list.getLast() == n3 );
+        assertTrue( list.getLast().getNext() == null );
+        assertTrue( list.getLast().getPrevious() == null );
+        
+        assertEquals(1, list.size());
+
+        // delete last
+        list.remove(n3);
+        System.out.println("5: " + list);
+
+        assertTrue( list.getFirst() == null );
+        assertTrue( list.getLast() == null );
+
+        assertEquals(0, list.size());
+    }
+
+    public void testRemoveFirst() {
+        LinkedNodeList list = new LinkedNodeList();
+        assertTrue( list.getFirst() == null );
+        assertTrue( list.getLast() == null );
+
+        LinkedNodeList.Node n1 = list.createNode();
+        list.add(n1);
+        LinkedNodeList.Node n2 = list.createNode();
+        list.add(n2);
+        LinkedNodeList.Node n3 = list.createNode();
+        list.add(n3);
+        LinkedNodeList.Node n4 = list.createNode();
+        list.add(n4);
+
+        assertTrue ( list.removeFirst() == n1 );
+
+        assertTrue( list.getFirst() == n2 );
+        assertTrue( list.getFirst().getPrevious() == null );
+        assertTrue( list.getFirst().getNext() == n3);
+        assertEquals(3, list.size());
+        assertEquals(3, list.computeSize());
+
+        assertTrue ( list.removeFirst() == n2 );
+
+        assertTrue( list.getFirst() == n3 );
+        assertTrue( list.getFirst().getPrevious() == null );
+        assertTrue( list.getFirst().getNext() == n4);
+        assertEquals(2, list.size());
+        assertEquals(2, list.computeSize());
+
+        assertTrue ( list.removeFirst() == n3 );
+
+        assertTrue( list.getFirst() == n4 );
+        assertTrue( list.getFirst().getPrevious() == null );
+        assertTrue( list.getFirst().getNext() == null);
+        assertEquals(1, list.size());
+        assertEquals(1, list.computeSize());
+
+        assertTrue ( list.removeFirst() == n4 );
+
+        assertTrue( list.getFirst() == null );
+        assertEquals(0, list.size());
+        assertEquals(0, list.computeSize());
+
+        assertTrue ( list.removeFirst() == null );
+        assertEquals(0, list.size());
+        assertEquals(0, list.computeSize());
+
+    }
+
+    public void testMoveToEnd() {
+        LinkedNodeList list = new LinkedNodeList();
+
+        LinkedNodeList.Node n1 = list.createNode();
+        list.add(n1);
+        LinkedNodeList.Node n2 = list.createNode();
+        list.add(n2);
+        LinkedNodeList.Node n3 = list.createNode();
+        list.add(n3);
+        LinkedNodeList.Node n4 = list.createNode();
+        list.add(n4);
+
+        System.out.println("a: " + list);
+
+        list.moveToEnd(n2);
+
+        assertTrue( list.getLast() == n2 );
+
+        System.out.println("b: " + list);
+        
+        list.moveToEnd(n2);
+
+        assertTrue( list.getLast() == n2 );
+        
+        System.out.println("c: " + list);
+
+        list.moveToEnd(n1);
+
+        assertTrue( list.getLast() == n1 );
+        
+        System.out.println("d: " + list);
+    }
+
+    public void testForwardIterator() {
+        LinkedNodeList list = new LinkedNodeList();
+        
+        LinkedNodeList.Node n1 = list.createNode();
+        list.add(n1);
+        LinkedNodeList.Node n2 = list.createNode();
+        list.add(n2);
+        LinkedNodeList.Node n3 = list.createNode();
+        list.add(n3);
+        LinkedNodeList.Node n4 = list.createNode();
+        list.add(n4);
+
+        Iterator iter = list.iterator();
+        assertTrue( iter.hasNext() );
+        assertTrue( iter.next() == n1 );
+
+        assertTrue( iter.hasNext() );
+        assertTrue( iter.next() == n2 );
+
+        assertTrue( iter.hasNext() );
+        assertTrue( iter.next() == n3 );
+
+        assertTrue( iter.hasNext() );
+        assertTrue( iter.next() == n4 );
+
+        assertFalse( iter.hasNext() );
+
+        try {
+            iter.next();
+            fail("Did not throw expected exception");
+        } catch (NoSuchElementException e) {
+        }
+    }
+
+    public void testReverseIterator() {
+        LinkedNodeList list = new LinkedNodeList();
+        
+        LinkedNodeList.Node n1 = list.createNode();
+        list.add(n1);
+        LinkedNodeList.Node n2 = list.createNode();
+        list.add(n2);
+        LinkedNodeList.Node n3 = list.createNode();
+        list.add(n3);
+        LinkedNodeList.Node n4 = list.createNode();
+        list.add(n4);
+
+        Iterator iter = list.reverseIterator();
+        assertTrue( iter.hasNext() );
+        assertTrue( iter.next() == n4 );
+
+        assertTrue( iter.hasNext() );
+        assertTrue( iter.next() == n3 );
+
+        assertTrue( iter.hasNext() );
+        assertTrue( iter.next() == n2 );
+
+        assertTrue( iter.hasNext() );
+        assertTrue( iter.next() == n1 );
+
+        assertFalse( iter.hasNext() );
+
+        try {
+            iter.next();
+            fail("Did not throw expected exception");
+        } catch (NoSuchElementException e) {
+        }
+    }
+
+}

Added: incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/cache/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/cache/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/core/test/unit/src/org/globus/wsrf/utils/cache/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,32 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.utils.cache;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class PackageTests extends TestSuite {
+
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("UtilsCacheTests");
+        suite.addTestSuite(LinkedNodeListTest.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/svn-commit.tmp
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/svn-commit.tmp?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/svn-commit.tmp	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,4 @@
+Initial check in of globus contribution
+--This line, and those below, will be ignored--
+
+A    globus

Added: incubator/apollo/globus/tools/source/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,129 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_tools" basedir=".">
+    <description>
+        Code that provides tooling for Java WS Core
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+
+    <property name="name" value="Globus Toolkit Java WS Tools"/>
+    <property name="version" value="3.9.4"/>
+    <property name="globus.copyright" value="Copyright &#169; 1999-2003 University of Chicago and The University of Southern California.  All rights reserved."/>
+    <property name="env.GLOBUS_LOCATION" value="../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="base.name" value="wsrf_tools"/>
+    <property name="package.name" value="globus_${base.name}"/>
+    <property name="gar.name" value="${package.name}.gar"/>
+    <property name="jar.name" value="${base.name}.jar"/>
+    <property name="stubs.jar.name" value="${base.name}_stubs.jar"/>
+    <property name="garjars.id" value="garjars"/>
+    <property name="garshare.id" value="garshare"/>
+    <property name="src.dir" value="src"/>
+    <property name="build.dir" location="build"/>
+    <property name="build.dest" location="build/classes"/>
+    <property name="build.lib.dir" location="build/lib"/>
+    <property name="build.javadocs" value="${build.dir}/javadocs"/>
+    <property name="build.packages" location=
+        "${deploy.dir}/share/globus_wsrf_common/build-packages.xml"/>
+    <property name="build.stubs" location="share/build-stubs.xml"/>
+    <property name="java.debug" value="on"/>
+    <property name="java.deprecation" value="true"/>
+
+    <fileset dir="share" id="garshare"/>
+    <fileset dir="${build.lib.dir}" id="garjars"/> 
+
+    <!-- etc directory for gar -->
+    <property name="garetc.id" value="garEtc"/>
+    <fileset dir="etc" id="garEtc"/>    
+
+    <target name="init">
+        <mkdir dir="${build.dir}"/>
+        <mkdir dir="${build.dest}"/>
+        <mkdir dir="${build.lib.dir}"/>
+    </target>
+
+    <target name="compile" depends="init">
+        <javac srcdir="${src.dir}" destdir="${build.dest}" 
+               debug="${java.debug}" deprecation="${java.deprecation}">
+            <include name="**/*.java"/>
+            <classpath>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+        </javac>
+    </target>
+
+    <target name="jar" depends="compile">
+        <jar destfile="${build.lib.dir}/${jar.name}" basedir="${build.dest}"/>
+    </target>
+
+    <target name="dist" depends="jar">
+        <ant antfile="${build.packages}" target="makeGar">
+        	<reference refid="${garshare.id}"/>
+        	<reference refid="${garjars.id}"/>	 
+                <reference refid="${garetc.id}"/>       
+        </ant>
+    </target>
+
+    <target name="clean">
+        <delete dir="tmp"/>
+        <delete dir="${build.dir}"/>
+        <delete file="${gar.name}"/>
+    </target>
+
+    <target name="deploy" depends="dist">
+        <ant antfile="${build.packages}" target="deployGar"/>
+    </target>  
+
+    <target name="undeploy">
+        <ant antfile="${build.packages}" target="undeployGar">
+            <property name="gar.id" value="${package.name}"/>
+        </ant>
+    </target>
+
+    <target name="test">
+        <ant antfile="${build.stubs}" target="gtwsdl2stubs" dir="test">
+            <property name="wsdl.source" value="test.wsdl"/>
+            <property name="wsdl.target" value="test-processed.wsdl"/>
+            <property name="wsdl.porttype" value="test"/>
+            <property name="porttype.wsdl" value="test-processed.wsdl"/>
+            <property name="binding.root" value="test"/>
+            <property name="wsdl.file" value="test_bindings.wsdl"/>
+        </ant>
+    </target>
+
+    <target name="all" depends="dist"/>
+
+   <target name="javadocs" depends="compile">
+    <mkdir dir="${build.javadocs}"/>
+    <javadoc destdir="${build.javadocs}"
+             author="true"
+             version="true"
+             use="true"
+             windowtitle="${name} ${version} API"
+             doctitle="${name} ${version}"
+             bottom="${globus.copyright}">
+      <classpath>
+        <fileset dir="${deploy.dir}/lib">
+          <include name="*.jar"/>
+        </fileset>
+      </classpath>
+      <link href="http://java.sun.com/j2se/1.3/docs/api/" />
+      <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
+      <link href="http://ws.apache.org/axis/java/apiDocs/"/>
+      <packageset dir="${src.dir}" defaultexcludes="yes"/>
+    </javadoc>
+  </target>
+
+</project>

Added: incubator/apollo/globus/tools/source/etc/post-deploy.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/etc/post-deploy.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/etc/post-deploy.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+
+<!-- ===================================================================
+
+Notes:
+   This is a build file for use with the Jakarta Ant build tool.
+
+Prerequisites:
+
+   jakarta-ant from http://jakarta.apache.org
+
+
+Build Instructions:
+
+   This file is automatically called at the end of the deployment
+   of the corresponding component's gar (see build-packages.xml).
+
+Copyright:
+Copyright (c) 1999 University of Chicago and The University of
+Southern California. All Rights Reserved.
+
+==================================================================== -->
+<project default="all" basedir=".">
+
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="."/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="abs.deploy.dir" location="${deploy.dir}"/>
+    <property name="build.launcher" 
+        location="${abs.deploy.dir}/share/globus_wsrf_common/build-launcher.xml"/>
+
+    <target name="setup">
+
+        <ant antfile="${build.launcher}" 
+             target="generateLauncher">
+            <property name="launcher-name" value="globus-edit-wsdd"/>
+            <property name="class.name" 
+                value="org.globus.wsrf.tools.wsdd.WSDDEditor"/>
+        </ant>
+
+    </target>
+
+</project>

Added: incubator/apollo/globus/tools/source/pkgdata/filelist
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/pkgdata/filelist?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/pkgdata/filelist	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,4 @@
+bin/globus-edit-wsdd
+etc/globus_packages/globus_wsrf_tools/undeploy.xml
+lib/wsrf_tools.jar
+share/globus_wsrf_tools/build-stubs.xml

Added: incubator/apollo/globus/tools/source/pkgdata/pkg_data_src.gpt
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/pkgdata/pkg_data_src.gpt?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/pkgdata/pkg_data_src.gpt	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE gpt_package_metadata SYSTEM "package.dtd">
+
+<gpt_package_metadata Format_Version="0.01" Name="globus_java_ws_core_tools">
+
+    <Aging_Version Age="0" Major="0" Minor="1"/>
+    <Description>
+        Tools used for building and deploying Java WS packages
+    </Description>
+    <Functional_Group>Core</Functional_Group>
+    <Version_Stability Release="alpha" />
+
+    <src_pkg >
+
+        <Source_Dependencies Type="compile" >
+            <Dependency Name="globus_java_ws_core_common" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+        </Source_Dependencies>
+
+        <Build_Environment >
+            <cflags ></cflags>
+            <external_includes ></external_includes>
+            <pkg_libs ></pkg_libs>
+            <external_libs ></external_libs>
+        </Build_Environment>
+
+        <With_Flavors build="no" />
+
+        <Version_Label>0.1</Version_Label>
+
+        <Build_Instructions>
+            <Build_Step>ant deploy -Ddeploy.dir=INSTALLDIR_GPTMACRO</Build_Step>
+        </Build_Instructions>
+
+    </src_pkg >
+
+</gpt_package_metadata>

Added: incubator/apollo/globus/tools/source/share/build-stubs.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/share/build-stubs.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/share/build-stubs.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,156 @@
+<?xml version="1.0"?>
+
+<project name="globus_wsrf_tools_stub_utils" basedir="." default="gtwsdl2stubs">
+    <description>
+        Utility targets for generating Java stubs from WSDL
+    </description>
+
+    <!--
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it)
+    -->
+
+    <property environment="env"/>
+
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+
+    <property name="env.GLOBUS_LOCATION" value="."/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="abs.deploy.dir" location="${deploy.dir}"/>
+
+    <property name="wsdl.tool" value="org.globus.wsrf.tools.wsdl.WSDL2Java"/>
+    <property name="target.flatten.dir" location="."/>
+    <property name="source.flatten.dir" location="."/>
+    <property name="target.stubs.dir" location="."/>
+    <property name="source.stubs.dir" location="."/>
+    <property name="target.binding.dir" location="."/>
+    <property name="source.binding.dir" location="."/>
+    <property name="binding.protocol" value="http"/>
+    <property name="stubs.timeout" value="60"/>
+    <property name="ns.excludes" value="-x http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd -x http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.wsdl -x http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd -x http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.wsdl -x http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd -x http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl -x http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.xsd -x http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ServiceGroup-1.2-draft-01.wsdl -x http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd -x http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.wsdl -x http://schemas.xmlsoap.org/ws/2004/04/trust -x http://schemas.xmlsoap.org/ws/2002/12/policy -x http://schemas.xmlsoap.org/ws/2002/07/utility -x http://schemas.xmlsoap.org/ws/2004/04/sc -x http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd -x http://www.w3.org/2000/09/xmldsig# -x http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"/>
+
+    <path id="classpath">
+        <pathelement location="."/>
+        <pathelement location="${java.home}/../lib/tools.jar"/>
+        <fileset dir="${abs.deploy.dir}/lib">
+            <include name="*.jar"/>
+        </fileset>
+        <pathelement path="${java.class.path}"/>
+    </path>
+
+    <!-- ================================================================== -->
+    <!-- Resolve operation dependencies                                     -->
+    <!-- ================================================================== -->
+
+    <target name="WSDLUptodate">
+        <uptodate property="wsdl.uptodate"
+            targetfile="${target.flatten.dir}/${wsdl.target}"
+            srcfile="${source.flatten.dir}/${wsdl.source}"/>
+    </target>
+
+    <target name="flatten" depends="WSDLUptodate" unless="wsdl.uptodate">
+        <echo message="Processing WSDL in ${wsdl.source}"/>
+        <java classname="org.globus.wsrf.tools.wsdl.WSDLPreprocessor"
+            dir="${source.flatten.dir}" fork="yes"
+            classpathref="classpath" failonerror="true" >
+            <arg value="-i"/>
+            <arg file="${source.flatten.dir}/${wsdl.source}"/>
+            <arg value="-o"/>
+            <arg file="${target.flatten.dir}/${wsdl.target}"/>
+            <arg value="-p"/>
+            <arg value="${wsdl.porttype}"/>
+        </java>
+        <fixcrlf srcdir="${target.flatten.dir}"
+            eol="lf"
+            includes="${wsdl.target}"/>
+    </target>
+
+    <!-- ================================================================== -->
+    <!-- Generate bindings for porttype                                     -->
+    <!-- ================================================================== -->
+
+    <target name="bindingUptodate">
+        <uptodate property="binding.uptodate"
+            targetfile="${target.binding.dir}/${binding.root}_service.wsdl"
+            srcfile="${source.binding.dir}/${porttype.wsdl}"/>
+    </target>
+
+    <target name="generateBinding" depends="bindingUptodate"
+        unless="binding.uptodate">
+        <echo message="Generating bindings for ${porttype.wsdl}"/>
+        <java classname="org.globus.wsrf.tools.wsdl.GenerateBinding"
+            dir="${source.binding.dir}" fork="yes"
+            classpathref="classpath" failonerror="true" >
+            <arg value="-i"/>
+            <arg file="${source.binding.dir}/${porttype.wsdl}"/>
+            <arg value="-o"/>
+            <arg file="${target.binding.dir}/${binding.root}"/>
+            <arg value="-p"/>
+            <arg value="${binding.protocol}"/>
+        </java>
+    </target>
+
+    <!-- ================================================================== -->
+    <!-- Generate stubs from WSDL                                           -->
+    <!-- ================================================================== -->
+
+    <target name="mergePackageMapping">
+      <echo message="Merging ${mapping.src}"/>
+
+      <basename property="mapping.base" file="${mapping.src}"/>
+      <dirname property="mapping.dir" file="${mapping.src}"/>
+
+      <concat destfile="${mapping.dst}">
+        <filelist dir="${abs.deploy.dir}/share/globus_wsrf_core"
+                  files="NStoPkg.properties"/>
+        <filelist dir="${mapping.dir}"
+                  files="${mapping.base}"/>
+      </concat>
+    </target>
+
+    <target name="generateStubs">
+
+        <!-- handle ${ns.file} property -->
+        <condition property="arg1" value="-f ${mapping.file}">
+           <isset property="mapping.file"/>
+        </condition>
+        <condition property="arg1" value="-f ${abs.deploy.dir}/share/globus_wsrf_core/NStoPkg.properties">
+          <not><isset property="mapping.file"/></not>
+        </condition>
+
+        <!-- handle ${server.side} property -->
+        <condition property="arg2" value="-s">
+           <istrue value="${server.side}"/>
+        </condition>
+        <condition property="arg2" value="">
+          <isfalse value="${server.side}"/>
+        </condition>
+
+        <echo message=" Generating stubs from ${wsdl.file}" />
+        <java classname="${wsdl.tool}" dir="${source.stubs.dir}" fork="yes"
+            classpathref="classpath" failonerror="true" >
+            <sysproperty key="java.protocol.handler.pkgs"
+                value="org.globus.net.protocol" />
+            <arg value="-o"/>
+            <arg value="${target.stubs.dir}"/>
+            <arg value="-W"/>
+            <arg line="${ns.excludes}"/>
+            <arg value="-x"/>
+            <arg value="http://schemas.xmlsoap.org/ws/2004/03/addressing"/>
+            <arg value="--noTypeCollisionProtection"/>
+            <arg line="${arg1} ${arg2}"/>
+            <arg value="-O"/>
+            <arg value="${stubs.timeout}"/>
+            <arg file="${source.stubs.dir}/${wsdl.file}"/>
+        </java>
+        <delete
+            file="${target.stubs.dir}/org/oasis/wsn/TopicExpressionType.java"
+            quiet="yes"/>
+    </target>
+
+    <target name="gtwsdl2stubs"
+        depends="flatten,generateBinding,generateStubs">
+    </target>
+
+</project>

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/CommandLineTool.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/CommandLineTool.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/CommandLineTool.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,32 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools;
+
+public class CommandLineTool {
+    private static boolean setNoExit = false;
+
+    public static void setNoExit() {
+        setNoExit = true;
+    }
+
+    public static void sysExit(int exitCode) {
+        if (CommandLineTool.setNoExit) {
+            throw new RuntimeException("java exit: " + exitCode);
+        } else {
+            System.exit(exitCode);
+        }
+    }
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ConfigContext.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ConfigContext.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ConfigContext.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,206 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.jndi;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+
+public class ConfigContext
+{
+    protected Map subContexts = new HashMap();
+    protected Map environmentEntries = new HashMap();
+    protected Map resourceEntries = new HashMap();
+    protected Map resourceLinks = new HashMap();
+    protected String name = null;
+    protected boolean global;
+    
+    public ConfigContext()
+    {
+        this(false);
+    }
+    
+    public ConfigContext(boolean global)
+    {
+        this.global = global;
+    }
+    
+    /**
+     * @return Returns the global.
+     */
+    public boolean isGlobal()
+    {
+        return this.global;
+    }
+
+    /**
+     * @param global The global to set.
+     */
+    public void setGlobal(boolean global)
+    {
+        this.global = global;
+    }
+
+    public String getName()
+    {
+        return this.name;
+    }
+    
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+    
+    public void addEnvironment(Environment environment)
+    {
+        this.environmentEntries.put(environment.getName(), environment);
+    }
+    
+    public Environment getEnvironment(String name)
+    {
+        return (Environment) this.environmentEntries.get(name);
+    }
+    
+    public Set getEnvironmentNames()
+    {
+        return this.environmentEntries.keySet();
+    }
+    
+    public void addResource(Resource resource)
+    {
+        this.resourceEntries.put(resource.getName(), resource);
+    }
+    
+    public Resource getResource(String name)
+    {
+        return (Resource) this.resourceEntries.get(name);
+    }
+    
+    public Set getResourceNames()
+    {
+        return this.resourceEntries.keySet();
+    }
+
+    public void addSubContext(ConfigContext context)
+    {
+        this.subContexts.put(context.getName(), context);
+    }
+    
+    public ConfigContext getSubContext(String name)
+    {
+        return (ConfigContext) this.subContexts.get(name);
+    }
+    
+    public Set getSubContextNames()
+    {
+        return this.subContexts.keySet();
+    }
+    
+    public void removeSubContext(String name)
+    {
+        this.subContexts.remove(name);
+    }
+    
+    public void addResourceLink(ResourceLink link)
+    {
+        this.resourceLinks.put(link.getName(), link);
+    }
+    
+    public ResourceLink getResourceLink(String name)
+    {
+        return (ResourceLink) this.resourceLinks.get(name);
+    }
+    
+    public Set getResourceLinkNames()
+    {
+        return this.resourceLinks.keySet();
+    }
+    
+    public String toString()
+    {
+        StringBuffer out = new StringBuffer();
+        Set names;
+        Iterator nameIterator;
+        
+        if(global == true)
+        {
+            out.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
+            out.append("<jndiConfig xmlns=\"http://wsrf.globus.org/jndi/config\">\r\n");
+            out.append("    <global>\r\n");
+        }
+        else
+        {
+            out.append("    <service name=\"");
+            out.append(this.name);
+            out.append("\">\r\n");
+        }
+        
+        names = this.getEnvironmentNames();
+        nameIterator = names.iterator();
+        
+        while(nameIterator.hasNext())
+        {
+            out.append(
+                ((Environment) this.environmentEntries.get(
+                    nameIterator.next())).toString());
+        }
+
+        names = this.getResourceNames();
+        nameIterator = names.iterator();
+        
+        while(nameIterator.hasNext())
+        {
+            out.append(
+                ((Resource) this.resourceEntries.get(
+                    nameIterator.next())).toString());            
+        }
+
+        names = this.getResourceLinkNames();
+        nameIterator = names.iterator();
+        
+        while(nameIterator.hasNext())
+        {
+            out.append(
+                ((ResourceLink) this.resourceLinks.get(
+                    nameIterator.next())).toString());            
+        }
+
+        if(global == true)
+        {
+            out.append("    </global>\r\n");
+            //process sub contexts
+            names = this.getSubContextNames();
+            nameIterator = names.iterator();
+            
+            while(nameIterator.hasNext())
+            {
+                out.append(
+                    ((ConfigContext) this.subContexts.get(
+                        nameIterator.next())).toString());
+            }
+            
+            out.append("</jndiConfig>\r\n");
+        }
+        else
+        {
+            out.append("    </service>\r\n");
+        }
+
+        return out.toString();
+    }
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ContextRuleSet.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ContextRuleSet.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ContextRuleSet.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,55 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.jndi;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.RuleSetBase;
+
+public class ContextRuleSet extends RuleSetBase
+{
+    protected String prefix = null;
+    
+    public ContextRuleSet()
+    {
+        this("");
+    }
+    
+    public ContextRuleSet(String prefix)
+    {
+        super();
+        this.prefix = prefix;
+        this.namespaceURI = "http://wsrf.globus.org/jndi/config";
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.commons.digester.RuleSet#addRuleInstances(org.apache.commons.digester.Digester)
+     */
+    public void addRuleInstances(Digester digester)
+    {
+        digester.addObjectCreate(prefix + "environment", Environment.class);
+        digester.addSetProperties(prefix + "environment");
+        digester.addSetNext(prefix + "environment", "addEnvironment");
+        digester.addObjectCreate(prefix + "resource", Resource.class);
+        digester.addSetProperties(prefix + "resource");
+        digester.addSetNext(prefix + "resource", "addResource");
+        digester.addRuleSet(new ParameterRuleSet(prefix + "resource/"));
+        digester.addObjectCreate(prefix + "resourceLink", ResourceLink.class);
+        digester.addSetProperties(prefix + "resourceLink");
+        digester.addRuleSet(new ParameterRuleSet(prefix + "resourceLink/"));
+        digester.addSetNext(prefix + "resourceLink", "addResourceLink");        
+    }
+
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/Environment.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/Environment.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/Environment.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,104 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.jndi;
+
+
+public class Environment
+{
+    private String description = null;
+    private String name = null;
+    private String type = null;
+    private String value = null;
+    
+    /**
+     * @return Returns the description.
+     */
+    public String getDescription()
+    {
+        return description;
+    }
+
+    /**
+     * @param description The description to set.
+     */
+    public void setDescription(String description)
+    {
+        this.description = description;
+    }
+
+    /**
+     * @return Returns the name.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * @param name The name to set.
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    /**
+     * @return Returns the type.
+     */
+    public String getType()
+    {
+        return type;
+    }
+
+    /**
+     * @param type The type to set.
+     */
+    public void setType(String type)
+    {
+        this.type = type;
+    }
+
+    /**
+     * @return Returns the value.
+     */
+    public String getValue()
+    {
+        return value;
+    }
+
+    /**
+     * @param value The value to set.
+     */
+    public void setValue(String value)
+    {
+        this.value = value;
+    }
+    
+    public String toString()
+    {
+        StringBuffer out = new StringBuffer();
+        out.append("        <environment name=\"");
+        out.append(this.name);
+        out.append("\" \r\n"); 
+        out.append("                     type=\"");
+        out.append(this.type);
+        out.append("\"\r\n");
+        out.append("                     value=\"");
+        out.append(this.value);
+        out.append("\"/>\r\n");
+        return out.toString();
+    }
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/JNDIConfigRuleSet.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/JNDIConfigRuleSet.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/JNDIConfigRuleSet.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,48 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.jndi;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.RuleSetBase;
+
+public class JNDIConfigRuleSet extends RuleSetBase
+{
+    protected String prefix = null;
+    
+    public JNDIConfigRuleSet()
+    {
+        this("");
+    }
+    
+    public JNDIConfigRuleSet(String prefix)
+    {
+        super();
+        this.prefix = prefix;
+        this.namespaceURI = "http://wsrf.globus.org/jndi/config";
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.commons.digester.RuleSet#addRuleInstances(org.apache.commons.digester.Digester)
+     */
+    public void addRuleInstances(Digester digester)
+    {
+        digester.addRuleSet(new ContextRuleSet(prefix + "global/"));
+        digester.addObjectCreate(prefix + "service", ConfigContext.class);
+        digester.addSetProperties(prefix + "service");
+        digester.addSetNext(prefix + "service", "addSubContext");
+        digester.addRuleSet(new ContextRuleSet(prefix + "service/"));
+    }
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/JNDIConfigTool.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/JNDIConfigTool.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/JNDIConfigTool.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,402 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.jndi;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.digester.Digester;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.tools.CommandLineTool;
+
+// TODO: needs to be i18n
+public class JNDIConfigTool extends CommandLineTool
+{
+    private static Log logger =
+        LogFactory.getLog(JNDIConfigTool.class.getName());
+
+    public static void main(String[] args)
+    {
+        boolean quiet = false;
+        boolean overwrite = false;
+        File configFile = null;
+        FileInputStream configInput = null;
+        Digester digester = null;
+        ConfigContext inContext = null;
+        CommandLine commandLine = null;
+        Options options = new Options();
+        Option option = null;
+        HelpFormatter formatter = new HelpFormatter();
+
+        option = new Option("a", "add", true,
+            "Add the contents of the specified file");
+        option.setArgName("FILE");
+        options.addOption(option);
+        option= new Option("r", "remove", true,
+            "Remove the entry for the given service name");
+        option.setArgName("SERVICENAME");
+        options.addOption(option);
+        option= new Option("f", "file", true,
+            "Specifies the JNDI configuration file");
+        option.setArgName("FILE");
+        option.setRequired(true);
+        options.addOption(option);
+        options.addOption("h", "help", false, "Prints this help message");
+        options.addOption("q", "quiet", false, "Don't print warnings");
+        options.addOption("o", "overwrite", false, "Overwrite sections");
+        CommandLineParser parser = new GnuParser();
+
+        try
+        {
+            commandLine = parser.parse(options, args);
+        }
+        catch(Exception e)
+        {
+            logger.error("", e);
+            // internationalize
+            formatter.printHelp(JNDIConfigTool.class.getName(), options, true);
+            sysExit(1);
+        }
+
+        args = commandLine.getArgs();
+
+        if(args.length != 0)
+        {
+            // internationalize
+            formatter.printHelp(JNDIConfigTool.class.getName(), options, false);
+            sysExit(1);
+        }
+
+        if(commandLine.hasOption('h'))
+        {
+            formatter.printHelp(JNDIConfigTool.class.getName(), options, true);
+            sysExit(0);
+        }
+
+        if(commandLine.hasOption('q'))
+        {
+            quiet = true;
+        }
+
+        if(commandLine.hasOption('o'))
+        {
+            overwrite = true;
+        }
+
+        try
+        {
+            configFile = new File(commandLine.getOptionValue('f')).getCanonicalFile();
+        }
+        catch(Exception e)
+        {
+            String msg = "ERROR: Failed to get canonical file name for configuration file";
+            logger.error(msg, e);
+            System.err.println(msg);
+            sysExit(1);
+        }
+
+        try
+        {
+            configInput = new FileInputStream(configFile);
+        }
+        catch(FileNotFoundException e)
+        {
+            if(commandLine.hasOption('a'))
+            {
+                configInput = null;
+            }
+            else
+            {
+                String msg = "ERROR: Failed to open configuration file.";
+                logger.error(msg, e);
+                System.err.println(msg);
+                sysExit(1);
+            }
+        }
+
+        if(configInput != null)
+        {
+            digester = new Digester();
+
+            // Don't do any validation for now
+            // TODO: Need to write a real schema for this stuff
+            digester.setNamespaceAware(true);
+            digester.setValidating(false);
+            digester.addRuleSet(new JNDIConfigRuleSet("jndiConfig/"));
+            inContext = new ConfigContext(true);
+            digester.push(inContext);
+
+            try
+            {
+                digester.parse(configInput);
+                digester.clear();
+            }
+            catch(Exception e)
+            {
+                String msg = "ERROR: Failed to parse configuration file.";
+                logger.error(msg, e);
+                System.err.println(msg);
+                sysExit(1);
+            }
+        }
+
+        if(commandLine.hasOption('a'))
+        {
+            File addFile = null;
+
+            try
+            {
+                addFile = new File(commandLine.getOptionValue('a')).getCanonicalFile();
+            }
+            catch(Exception e)
+            {
+                String msg = "ERROR: Failed to get canonical file name for additions file";
+                logger.error(msg, e);
+                System.err.println(msg);
+                sysExit(1);
+            }
+
+            if(configInput == null)
+            {
+                try
+                {
+                    copy(addFile, configFile);
+                }
+                catch(Exception e)
+                {
+                    String msg = "ERROR: Failed to copy additions file to configuration file.";
+                    logger.error(msg, e);
+                    System.err.println(msg);
+                    sysExit(1);
+                }
+                sysExit(0);
+            }
+            else
+            {
+                InputStream addInput = null;
+                ConfigContext addContext = null;
+
+                try
+                {
+                    addInput = new FileInputStream(addFile);
+                }
+                catch(FileNotFoundException e)
+                {
+                    String msg = "ERROR: Failed to open additions file.";
+                    logger.error(msg, e);
+                    System.err.println(msg);
+                    sysExit(1);
+                }
+
+                addContext = new ConfigContext(true);
+                digester.push(addContext);
+
+                try
+                {
+                    digester.parse(addInput);
+                    digester.clear();
+                }
+                catch(Exception e)
+                {
+                    String msg = "ERROR: Failed to parse additions file.";
+                    logger.error(msg, e);
+                    System.err.println(msg);
+                    sysExit(1);
+                }
+
+                try
+                {
+                    merge(inContext, addContext, null, null, overwrite);
+                }
+                catch(Exception e)
+                {
+                    String msg = "ERROR: Failed to merge additions file.";
+                    logger.error(msg, e);
+                    System.err.println(msg);
+                    sysExit(1);
+                }
+            }
+        }
+
+        if(commandLine.hasOption('r'))
+        {
+            String serviceName;
+            serviceName = commandLine.getOptionValue('r');
+            inContext.removeSubContext(serviceName);
+        }
+
+        try
+        {
+            OutputStream configOutput = new FileOutputStream(configFile);
+            PrintWriter configWriter = new PrintWriter(configOutput);
+            configWriter.write(inContext.toString());
+            configWriter.close();
+        }
+        catch (Exception e)
+        {
+            String msg = "ERROR: Failed to write processed configuration file.";
+            logger.error(msg, e);
+            System.err.println(msg);
+            sysExit(1);
+        }
+
+        sysExit(0);
+    }
+
+    private static void copy(File inFile, File outFile)
+        throws IOException, FileNotFoundException
+    {
+        BufferedInputStream inStream =
+            new BufferedInputStream(new FileInputStream(inFile));
+        BufferedOutputStream outStream =
+            new BufferedOutputStream(new FileOutputStream(outFile));
+        int b;
+        while((b = inStream.read()) != -1)
+        {
+            outStream.write(b);
+        }
+        inStream.close();
+        outStream.close();
+    }
+
+    private static void merge(ConfigContext targetContext,
+        ConfigContext inContext, String section,
+        String serviceName, boolean overwrite)
+        throws Exception
+    {
+        Set names = null;
+        Iterator nameIterator = null;
+        String name;
+        ConfigContext serviceContext = null;
+        ConfigContext targetServiceContext = null;
+
+        if(section == null || section.equals("service"))
+        {
+            if(serviceName != null)
+            {
+                if(inContext.getSubContext(serviceName) == null)
+                {
+                    throw new Exception(
+                        "Couldn't find service node with name: " +
+                        serviceName);
+                }
+                names = new HashSet();
+                names.add(serviceName);
+            }
+            else
+            {
+                names = inContext.getSubContextNames();
+            }
+
+            nameIterator = names.iterator();
+
+            while(nameIterator.hasNext())
+            {
+                name = (String) nameIterator.next();
+                serviceContext = inContext.getSubContext(name);
+
+                if(overwrite == true ||
+                    (targetServiceContext =
+                        targetContext.getSubContext(name)) == null)
+                {
+                    targetContext.addSubContext(serviceContext);
+                }
+                else
+                {
+                    mergeContexts(serviceContext,
+                        targetServiceContext);
+                }
+            }
+        }
+
+        if(section == null || section.equals("global"))
+        {
+            if(overwrite == true)
+            {
+                names = targetContext.getSubContextNames();
+                nameIterator = names.iterator();
+                while(nameIterator.hasNext())
+                {
+                    name = (String) nameIterator.next();
+                    if(inContext.getSubContext(name) == null)
+                    {
+                        inContext.addSubContext(
+                            targetContext.getSubContext(name));
+                    }
+                }
+            }
+            else
+            {
+                mergeContexts(inContext, targetContext);
+            }
+        }
+    }
+
+    private static void mergeContexts(ConfigContext inContext, ConfigContext targetContext)
+    {
+        Set names = null;
+        Iterator nameIterator = null;
+
+        names = inContext.getEnvironmentNames();
+        nameIterator = names.iterator();
+
+        while(nameIterator.hasNext())
+        {
+            targetContext.addEnvironment(
+                inContext.getEnvironment(
+                    (String) nameIterator.next()));
+        }
+
+        names = inContext.getResourceNames();
+        nameIterator = names.iterator();
+
+        while(nameIterator.hasNext())
+        {
+            targetContext.addResource(
+                inContext.getResource(
+                    (String) nameIterator.next()));
+        }
+
+        names = inContext.getResourceLinkNames();
+        nameIterator = names.iterator();
+
+        while(nameIterator.hasNext())
+        {
+            targetContext.addResourceLink(
+                inContext.getResourceLink(
+                    (String) nameIterator.next()));
+        }
+    }
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ParameterRuleSet.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ParameterRuleSet.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ParameterRuleSet.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,51 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.jndi;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.RuleSetBase;
+
+public class ParameterRuleSet extends RuleSetBase
+{
+    protected String prefix = null;
+    
+    public ParameterRuleSet()
+    {
+        this("");
+    }
+    
+    public ParameterRuleSet(String prefix)
+    {
+        super();
+        this.prefix = prefix;
+        this.namespaceURI = "http://wsrf.globus.org/jndi/config";
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.commons.digester.RuleSet#addRuleInstances(org.apache.commons.digester.Digester)
+     */
+    public void addRuleInstances(Digester digester)
+    {
+        digester.addObjectCreate(prefix + "resourceParams", ResourceParameters.class);
+        digester.addSetProperties(prefix + "resourceParams");
+        digester.addSetNext(prefix + "resourceParams", "setParameters");
+        digester.addCallMethod(prefix + "resourceParams/parameter",
+            "addParameter", 2);
+        digester.addCallParam(prefix + "resourceParams/parameter/name", 0);
+        digester.addCallParam(prefix + "resourceParams/parameter/value", 1);
+    }
+
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/Resource.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/Resource.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/Resource.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,159 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.jndi;
+
+
+public class Resource
+{
+    private String description = null;
+    private String name = null;
+    private String scope = null;
+    private String type = null;
+    private String auth = null;
+    private ResourceParameters parameters = null;
+    
+    
+    /**
+     * @return Returns the parameters.
+     */
+    public ResourceParameters getParameters()
+    {
+        return parameters;
+    }
+
+    /**
+     * @param parameters The parameters to set.
+     */
+    public void setParameters(ResourceParameters parameters)
+    {
+        this.parameters = parameters;
+    }
+
+    /**
+     * @return Returns the auth.
+     */
+    public String getAuth()
+    {
+        return auth;
+    }
+
+    /**
+     * @param auth The auth to set.
+     */
+    public void setAuth(String auth)
+    {
+        this.auth = auth;
+    }
+
+    /**
+     * @return Returns the description.
+     */
+    public String getDescription()
+    {
+        return description;
+    }
+
+    /**
+     * @param description The description to set.
+     */
+    public void setDescription(String description)
+    {
+        this.description = description;
+    }
+
+    /**
+     * @return Returns the name.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * @param name The name to set.
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    /**
+     * @return Returns the scope.
+     */
+    public String getScope()
+    {
+        return scope;
+    }
+
+    /**
+     * @param scope The scope to set.
+     */
+    public void setScope(String scope)
+    {
+        this.scope = scope;
+    }
+
+    /**
+     * @return Returns the type.
+     */
+    public String getType()
+    {
+        return type;
+    }
+
+    /**
+     * @param type The type to set.
+     */
+    public void setType(String type)
+    {
+        this.type = type;
+    }
+
+    public String toString()
+    {
+        StringBuffer out = new StringBuffer();
+        out.append("        <resource name=\"");
+        out.append(this.name);
+        out.append("\" \r\n"); 
+        out.append("                  type=\"");
+        out.append(this.type);
+        if(this.scope != null)
+        {
+            out.append("\"\r\n");
+            out.append("                  scope=\"");
+            out.append(this.scope);
+        }
+        if(this.auth != null)
+        {
+            out.append("\"\r\n");
+            out.append("                  auth=\"");
+            out.append(this.auth);
+        }
+        if(this.description != null)
+        {
+            out.append("\"\r\n");
+            out.append("                  auth=\"");
+            out.append(this.description);
+        }
+        out.append("\">\r\n");
+        if (this.parameters != null) 
+        {
+            out.append(this.parameters.toString());
+        }
+        out.append("        </resource>\r\n");
+        return out.toString();
+    }
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ResourceLink.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ResourceLink.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ResourceLink.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,66 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.jndi;
+
+public class ResourceLink
+{
+    private String target = null;
+    private String name = null;
+
+    /**
+     * @return Returns the target.
+     */
+    public String getTarget()
+    {
+        return target;
+    }
+
+    /**
+     * @param target The target to set.
+     */
+    public void setTarget(String target)
+    {
+        this.target = target;
+    }
+
+    /**
+     * @return Returns the name.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * @param name The name to set.
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+    
+    public String toString()
+    {
+        StringBuffer out = new StringBuffer();
+        out.append("        <resourceLink name=\"");
+        out.append(this.name);
+        out.append("\" \r\n"); 
+        out.append("                      target=\"");
+        out.append(this.target);
+        out.append("\"/>\r\n");
+        return out.toString();
+    }
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ResourceParameters.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ResourceParameters.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/jndi/ResourceParameters.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,76 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.jndi;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+public class ResourceParameters
+{
+    private Map parameters = new HashMap();
+    
+    public void addParameter(String name, String value)
+    {
+        this.parameters.put(name, value);
+    }
+    
+    public String getParameter(String name)
+    {
+        return (String) this.parameters.get(name);
+    }
+    
+    public Set getParameterNames()
+    {
+        return this.parameters.keySet();
+    }
+    
+    public String toString()
+    {
+        StringBuffer out = new StringBuffer();
+        Set names;
+        String name;
+        Iterator nameIterator;
+        
+        out.append("            <resourceParams>\r\n");
+
+        
+        names = this.getParameterNames();
+        nameIterator = names.iterator();
+        
+        while(nameIterator.hasNext())
+        {
+            name = (String) nameIterator.next();
+            out.append("                <parameter>\r\n");
+            out.append("                    <name>\r\n");
+            out.append("                        ");
+            out.append(name);
+            out.append("\r\n");
+            out.append("                    </name>\r\n");        
+            out.append("                    <value>\r\n");
+            out.append("                        ");
+            out.append(this.parameters.get(name));
+            out.append("\r\n");
+            out.append("                    </value>\r\n");        
+            out.append("                </parameter>\r\n");
+        }
+
+        out.append("            </resourceParams>\r\n");
+
+        return out.toString();
+    }
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdd/WSDDEditor.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdd/WSDDEditor.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdd/WSDDEditor.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,979 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.wsdd;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.deployment.wsdd.WSDDDeployment;
+import org.apache.axis.deployment.wsdd.WSDDDocument;
+import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
+import org.apache.axis.deployment.wsdd.WSDDService;
+import org.apache.axis.utils.LockableHashtable;
+import org.apache.axis.utils.XMLUtils;
+
+import org.w3c.dom.Document;
+
+import org.globus.common.ChainedException;
+import org.globus.util.Util;
+
+// FIXME:
+// Better error handling for the class
+// Debug mode for command line client
+// Merging to and reading from properties file, is only parameters
+// (no attributes incliuded and service is expected to be deployed
+// for both cases. So cannot be used to bootstrap deployment of a new
+// service).
+public class WSDDEditor {
+
+    private static Log logger =
+        LogFactory.getLog(WSDDEditor.class.getName());
+
+    private final static String CONFIG_FILE_NAME = "server-config.wsdd";
+    private static File configFile = new File(CONFIG_FILE_NAME);
+    private final static String GLOBUS_LOCATION = "GLOBUS_LOCATION";
+    private static final String GLOBAL_CONFIG = "globalConfiguration";
+
+    private WSDDDocument wsddDoc;
+    private WSDDDeployment deployment;
+    private WSDDGlobalConfiguration globalConfig;
+    private String configFileName;
+
+    private static final String editorOptPrompt =
+        "This is an interactive edit mode. Use -help for other options\n" +
+        "Main menu:\n" +
+        "Enter (i) for interactive prompt (or)\n" +
+        "      (p) for use of properties file options (or)\n" +
+        "      (q) to quit editor tool. \n Value: ";
+
+    private static final String propertiesFilePrompt =
+        "\nOptions:\n" +
+        "write[w] : Writes to property file \n" +
+        "merge[m] : Merges properties file entries with server config\n" +
+        "Value: ";
+
+    private static final String filePrompt =
+        "Enter file name to process. If empty, server-config.wsdd in \n" +
+        "current directory is used. If not server-config.wsdd in \n" +
+        "GLOBUS_LOCATION is used.\nValue:  ";
+
+    private static final String optionPrompt =
+        "\nOptions:\n"
+        + "add[a]: Adds the value of parameter using comma separator if \n"
+        + "        parameter exists. If not a new parameter is added.\n"
+        + "set[s]: Sets the value of parameter, overwrites the old parameter\n"
+        + "        if required. New parameter will be added if not present. \n"
+        + "query[q]: Returns the value of the parameter \nValue:  ";
+
+    private static final String continuePrompt =
+        "\nOptions:\n" +
+        " Enter (c) to continue (or)\n" +
+        "       (s) to save and quit (or)\n" +
+        "       (q) to just quit.\n Value: ";
+
+    /**
+     * Looks for 'server-config.wsdd' first in $GLOBUS_LOCATION, second in
+     * current dir.
+     */
+    public WSDDEditor() throws Exception {
+
+        if (configFile.exists()) {
+            logger.debug("Current directory");
+            getConfigurationDocument(CONFIG_FILE_NAME);
+        } else {
+            String globusLocation = System.getProperty(GLOBUS_LOCATION);
+            if ((globusLocation == null) ||
+                (globusLocation.trim().equals(""))) {
+                    String err = CONFIG_FILE_NAME + " does not exist in current dir"
+                                 + " nor GLOBUS_LOCATION has been set";
+                    logger.error(err);
+                    throw new Exception(err);
+                } else {
+                    if (!globusLocation.endsWith(File.separator))
+                        globusLocation = globusLocation + File.separator;
+                    getConfigurationDocument(globusLocation + CONFIG_FILE_NAME);
+                }
+        }
+    }
+
+    /**
+     * Parameter is path and name of file
+     */
+    public WSDDEditor(String pathToConfigFile) throws Exception {
+        getConfigurationDocument(pathToConfigFile);
+    }
+
+    /**
+     * Document object representing the server config
+     */
+    public WSDDEditor(Document doc) throws Exception {
+        setWSDDValues(doc, null);
+    }
+
+    // Sets the deployment object
+    private void getConfigurationDocument(String fileName) throws Exception {
+
+        FileInputStream input = null;
+        try {
+            input = new FileInputStream(fileName);
+            Document doc = XMLUtils.newDocument(input);
+            setWSDDValues(doc, fileName);
+        }
+        catch (FileNotFoundException fnfe) {
+            throw new ChainedException("The configuration file " + fileName
+                                       + " cannot be found. ", fnfe);
+        } finally {
+            if (input != null) {
+                input.close();
+            }
+        }
+    }
+
+    // Sets all class variables.
+    private void setWSDDValues(Document doc, String filename)
+        throws Exception {
+
+        this.wsddDoc = new WSDDDocument(doc);
+        this.deployment = wsddDoc.getDeployment();
+        this.globalConfig = this.deployment.getGlobalConfiguration();
+        this.configFileName = filename;
+    }
+
+    /**
+     * Returns the path to the output file, if any was used as input.
+     */
+    public String getWSDDFilename() {
+        return this.configFileName;
+    }
+
+    /**
+     * Returns global configuration
+     */
+    public WSDDGlobalConfiguration getGlobalConfiguration() {
+        return this.globalConfig;
+    }
+
+    /**
+     * Sets parameter in globalConfiguration. Overwrites if paramater
+     * already exists. Creates a new one if does exist.
+     */
+    public void setGlobalParameter(String paramName, String value)
+        throws Exception {
+        if (this.globalConfig == null) {
+            logger.error("Global configuration is null");
+            throw new Exception("Global configuration is null");
+        }
+        globalConfig.setParameter(paramName, value);
+    }
+
+    /**
+     * Returns the value of the parameter within the global configuration.
+     * If parameter does not exist, null is returned.
+     */
+    public String getGlobalParameter(String paramName) throws Exception {
+        if (this.globalConfig == null) {
+            logger.error("Global configuration is null");
+            throw new Exception("Global configuration is null");
+        }
+        return globalConfig.getParameter(paramName);
+    }
+
+    /**
+     * Add parameter value. If parameter, exists, the value is appended
+     * with comma separators.
+     */
+    public void addGlobalParameter(String paramName, String value)
+        throws Exception {
+        if (this.globalConfig == null) {
+            logger.error("Global configuration is null");
+            throw new Exception("Global configuration is null");
+        }
+        String paramValue = globalConfig.getParameter(paramName);
+        if (paramValue == null) {
+            globalConfig.setParameter(paramName, value);
+        } else {
+            paramValue = paramValue + "," + value;
+            globalConfig.setParameter(paramName, paramValue);
+        }
+    }
+
+    /**
+     * Returns the properties for a service as an array of strings
+     * with the following structure: propertyName=propertyValue.
+     */
+    public String[] getGlobalProperties() throws Exception {
+        if (this.globalConfig == null) {
+            logger.error("Global configuration is null");
+            throw new Exception("Global configuration is null");
+        }
+        LockableHashtable props = this.globalConfig.getParametersTable();
+        return parseAsStrings(props);
+    }
+
+    /**
+     * Returns the value of the parameter within the service config block
+     * If parameter does not exist, null is returned.
+     */
+    public String getServiceParameter(String serviceName, String paramName)
+        throws Exception {
+        WSDDService service = getService(serviceName);
+        return service.getParameter(paramName);
+    }
+
+    /**
+     * Sets the value of the parameter in the service configuration block.
+     * Overwrites if paramater already exists. Creates a new one if does exist.
+     */
+    public void setServiceParameter(String serviceName, String paramName,
+                                    String value) throws Exception {
+        WSDDService service = getService(serviceName);
+        setServiceParameter(service, paramName, value);
+    }
+
+    /**
+     * Sets the value of the parameter in the service configuration block.
+     * Overwrites if paramater already exists. Creates a new one if does exist.
+     */
+    public void setServiceParameter(WSDDService service, String paramName,
+                                    String value) throws Exception {
+        service.setParameter(paramName, value);
+    }
+
+    /**
+     * Adds value to the parameter in the service configuration block.
+     * If parameter, exists, the value is appended with comma separators.
+     */
+    public void addServiceParameter(String serviceName, String paramName,
+                                    String value)
+        throws Exception {
+        WSDDService service = getService(serviceName);
+        String paramValue = service.getParameter(paramName);
+
+        if (paramValue == null) {
+            service.setParameter(paramName, value);
+        } else {
+            paramValue = paramValue + "," + value;
+            service.setParameter(paramName, paramValue);
+        }
+    }
+
+    /**
+     * Returns the properties for a service as an array of strings
+     * with the following structure: propertyName=propertyValue.
+     */
+    public String[] getServiceProperties(String serviceName)
+        throws Exception {
+        WSDDService service = getService(serviceName);
+        LockableHashtable props = service.getParametersTable();
+        return parseAsStrings(props);
+    }
+
+    private String[] parseAsStrings(LockableHashtable props) {
+        Set propSet = props.entrySet();
+        if (propSet.size() <= 0)
+            return null;
+        String properties[] = new String[propSet.size()];
+        Iterator iterator = propSet.iterator();
+        int i=0;
+        while (iterator.hasNext()) {
+            Map.Entry entry = (Map.Entry)iterator.next();
+            properties[i]= (String)entry.getKey() + "="
+                           + (String)entry.getValue();
+            i++;
+        }
+        return properties;
+    }
+
+    // returns service object for given service name.
+    public WSDDService getService(String serviceName) throws Exception {
+        // FIXME QName may need deloyment NS
+        WSDDService service =
+            this.deployment.getWSDDService(new QName(serviceName));
+        if (service == null) {
+            String err = "Service " + serviceName + " does not exist";
+            logger.error(err);
+            throw new Exception(err);
+        }
+        return service;
+    }
+
+    /**
+     * Writes changes back to the file that was used as input
+     */
+    public void writeChanges() throws Exception {
+        writeChanges(this.configFileName);
+    }
+
+    /**
+     * Writes changes to given filename
+     */
+    public void writeChanges(String pathToOutputFile) throws Exception {
+
+        if (pathToOutputFile == null) {
+            logger.error("Output file name is null");
+            throw new Exception("Output file name is null");
+        }
+        String newDeploymentDesc =
+            XMLUtils.DocumentToString(this.wsddDoc.getDOMDocument());
+        writeStringToFile(pathToOutputFile, newDeploymentDesc);
+    }
+
+    /**
+     * Fixes bad eol character on said file.
+     */
+    public void fixEolError(String pathToFile) throws Exception {
+
+        if (pathToFile == null) {
+            logger.error("File name is null");
+            throw new Exception("File name is null");
+        }
+
+        String outputString = "";
+        BufferedReader bufReader = null;
+        try {
+            bufReader = new BufferedReader(new FileReader(pathToFile));
+            String line = null;
+            while ((line = bufReader.readLine()) != null) {
+                outputString = outputString + line + "\n";
+            }
+        } catch (IOException ioe) {
+            logger.error("Could not read " + pathToFile + " file", ioe);
+            throw new ChainedException("Could not read " + pathToFile, ioe);
+        } finally {
+            if (bufReader != null) {
+                bufReader.close();
+            }
+        }
+        writeStringToFile(pathToFile, outputString);
+    }
+
+    // writes given string to a file.
+    private void writeStringToFile(String pathToFile, String stringToWrite)
+        throws Exception {
+
+        FileWriter output = null;
+        try {
+            output = new FileWriter(pathToFile);
+            output.write(stringToWrite);
+        }
+        catch (IOException ioe) {
+            logger.error("Could not write " + pathToFile + " file", ioe);
+            throw new ChainedException("Could not write " + pathToFile, ioe);
+        }
+        finally {
+            if (output != null) {
+                output.close();
+            }
+        }
+    }
+
+    // Command line interface for the editor.
+    public static void main(String[] args) throws Exception {
+        if (args.length > 0) {
+            processArguments(args);
+        }
+        do {
+            int option = getEditorOption();
+            switch (option) {
+                case 0:
+                    continue;
+
+                case 1:
+                    System.out.println("Interactive mode.\n");
+                    processInteractiveMode();
+                    break;
+
+                case 2:
+                    System.out.println("Properties file mode.\n");
+                    processPropertiesFileMode();
+                    break;
+
+                case 3:
+                    System.out.println("Quitting editor");
+                    System.exit(0);
+            }
+        } while (true);
+    }
+
+    private static void processArguments(String args[]) throws Exception {
+
+        String options =
+            " Options are:\n" +
+            " [-file fileName] <serviceOption> <operation> (or)\n"
+            + " [-file fileName] -propFile <propFileName> <serviceOption> "
+            + "<propFileOption>\n"
+            + " where:\n"
+            + "fileName : name of config file. If not used, server-config.wsdd"
+            + "\n          in current directory or "
+            + "\n          GLOBUS_LOCATION/server-config.wsdd is used.\n"
+            + "<serviceOption> : \n"
+            + "\t -service <name> : <name> is name of service \n"
+            + "\t -global         : if global configuration\n"
+            + "<operation> :\n"
+            + "\t -set <paramName> <paramValue>\n"
+            + "\t -add <paramName> <paramValue>\n"
+            + "\t -get <paramName>\n"
+            + "\t\t <paramName>  : Name of paramater\n"
+            + "\t\t <paramValue> : Value of paramater\n"
+            + "<propFileName> : Name of properties file\n"
+            + "<propFileOption> :\n"
+            + "\t-merge : Merge entries from properties file into config file\n"
+            + "\t-write : Write entries to properties file from config file\n"
+            + "To use interactive mode, use command with no arguments.";
+
+        WSDDEditor editor = null;
+        String fileName = null;
+        String serviceName = null;
+        // 0 = get, 1 = set, 2 = add
+        int operation = -1;
+        String paramName = null;
+        String value = null;
+        String propertiesFileName = null;
+        // 0 = write, 1 = merge
+        int propOpereration = -1;
+
+        int i=0;
+        int length = args.length;
+        while (i < length) {
+
+            if (args[i].equals("-help")) {
+                System.out.println(options);
+                System.exit(0);
+            }
+
+            if (args[i].equals("-file")) {
+                if ((i+1) >= length) {
+                    printAndQuit("-file option requires an argument");
+                }
+                fileName = args[++i];
+            }
+
+            if (args[i].equals("-propFile")) {
+                if ((i+1) >= length) {
+                    printAndQuit("-propFile option requires an argument");
+                }
+                propertiesFileName = args[++i];
+            }
+
+            if (args[i].equals("-service")) {
+                if ((i+1) >= length) {
+                    printAndQuit("-service option requires an argument");
+                }
+                serviceName = args[++i];
+            }
+
+            if (args[i].equals("-global")) {
+                serviceName = WSDDEditor.GLOBAL_CONFIG;
+            }
+
+            if (args[i].equals("-write")) {
+                propOpereration = 0;
+            }
+
+            if (args[i].equals("-merge")) {
+                propOpereration = 1;
+            }
+
+            if (args[i].equals("-set")) {
+                if ((i+2) >= length) {
+                    printAndQuit("-set option requires: parameterName "
+                                 + "parameterValue");
+                }
+                operation = 1;
+                paramName = args[++i];
+                value = args[++i];
+            }
+
+            if (args[i].equals("-get")) {
+                if ((i+1) >= length) {
+                    printAndQuit("-get option requires: parameterName");
+                }
+                operation = 0;
+                paramName = args[++i];
+            }
+
+            if (args[i].equals("-add")) {
+                if ((i+2) >= length) {
+                    printAndQuit("-add option requires: parameterName "
+                                 + "parameterValue");
+                }
+                operation = 2;
+                paramName = args[++i];
+                value = args[++i];
+            }
+            i++;
+        }
+
+        // Properties option
+        if (propertiesFileName != null) {
+            switch (propOpereration) {
+                case -1:
+                    printAndQuit("No valid operation chosen for given properties "
+                                 + "file ");
+
+                case 0:
+                    // write
+                    editor = getEditor(fileName);
+                    processWriteToFileOption(serviceName, editor,
+                                             propertiesFileName);
+                    break;
+
+                case 1:
+                    // read
+                    editor = getEditor(fileName);
+                    processMergeFromFileOption(serviceName, editor,
+                                               propertiesFileName);
+                    editor.writeChanges();
+                    editor.fixEolError(editor.getWSDDFilename());
+            }
+            System.exit(0);
+        }
+
+        // Non-properties-file option
+        switch (operation) {
+            case -1:
+                printAndQuit("No valid operation chosen.");
+
+            case 0:
+                // get
+                editor = getEditor(fileName);
+                processQueryOption(editor, serviceName, paramName);
+                break;
+
+            case 1:
+                // set
+                editor = getEditor(fileName);
+                processSetOption(editor, serviceName, paramName, value);
+                editor.writeChanges();
+                editor.fixEolError(editor.getWSDDFilename());
+                break;
+
+            case 2:
+                // add
+                editor = getEditor(fileName);
+                processAddOption(editor, serviceName, paramName, value);
+                editor.writeChanges();
+                editor.fixEolError(editor.getWSDDFilename());
+                break;
+        }
+        System.exit(0);
+    }
+
+    private static void printAndQuit(String err) {
+        System.err.println(err);
+        System.exit(-1);
+    }
+
+    // Process the option to interactively make changes to config file.
+    private static void processInteractiveMode() throws Exception {
+        WSDDEditor editor = getEditor();
+        // Prompt and get changes, until quit is chosen.
+        String loopOption = null;
+        do {
+            int option = processOptionPrompt();
+            switch (option) {
+                case 0:
+                    break;
+
+                case 1:
+                    if (processAddOption(editor))
+                        System.out.println("Parameter added successfully");
+                    break;
+
+                case 2:
+                    if (processSetOption(editor))
+                        System.out.println("Parameter value set successfully");
+                    break;
+
+                case 3:
+                    processQueryOption(editor);
+            }
+
+            loopOption = processContinueOptionPrompt();
+            if (loopOption.equals("s")) {
+                editor.writeChanges();
+                editor.fixEolError(editor.getWSDDFilename());
+                System.out.println("Changes committed.");
+                return;
+            }
+        } while (loopOption.equals("c"));
+    }
+
+    // Processes the option to write/merge to/from properties file.
+    private static void processPropertiesFileMode() throws Exception {
+
+        WSDDEditor editor = getEditor();
+        // Prompt and get changes, until quit is chosen.
+        String loopOption = null;
+        do {
+            String serviceName = getElementName();
+            int option = processPropFilePrompt();
+            switch (option) {
+                case 0:
+                    break;
+
+                case 1:
+                    processWriteToFileOption(serviceName, editor);
+                    break;
+
+                case 2:
+                    processMergeFromFileOption(serviceName, editor);
+                    break;
+            }
+
+            loopOption = processContinueOptionPrompt();
+            if (loopOption.equals("s")) {
+                editor.writeChanges();
+                editor.fixEolError(editor.getWSDDFilename());
+                System.out.println("Changes committed.");
+                return;
+            }
+        } while (loopOption.equals("c"));
+    }
+
+    // process properties file manipulation potion
+    private static int processPropFilePrompt() {
+        String optionInput = Util.getInput(propertiesFilePrompt);
+        if (optionInput.trim().equalsIgnoreCase("write") ||
+            optionInput.trim().equalsIgnoreCase("w"))
+            return 1;
+        else if (optionInput.trim().equalsIgnoreCase("merge") ||
+                 optionInput.trim().equalsIgnoreCase("m"))
+            return 2;
+        System.out.println("Erroneous input.\n");
+        return 0;
+    }
+
+    // Merge the service parameters from file.
+    private static void processMergeFromFileOption(String serviceName,
+                                                   WSDDEditor editor)
+        throws Exception {
+        String prompt = "Enter file name to merge from. By default, "
+                        + "servicename.properties (or globalConfiguration.properties)\n."
+                        + "Value: ";
+        // Get file name
+        boolean global = isGlobal(serviceName);
+        String fileName = getFilename(prompt, global, serviceName);
+        processMergeFromFileOption(serviceName, editor, fileName);
+    }
+
+    private static void processMergeFromFileOption(String serviceName,
+                                                   WSDDEditor editor,
+                                                   String fileName)
+        throws Exception {
+
+        boolean global = isGlobal(serviceName);
+        WSDDService service = null;
+        if (!global) {
+            service = editor.getService(serviceName);
+        }
+        Properties prop = new Properties();
+        try {
+            prop.load(new FileInputStream(fileName));
+        } catch (IOException exp) {
+            System.err.println("Could not load properties file " + fileName);
+            return;
+        }
+        for (Enumeration e = prop.propertyNames(); e.hasMoreElements();) {
+            String propKey = (String)e.nextElement();
+            if (global) {
+                editor.setGlobalParameter(propKey,
+                                          (String)prop.getProperty(propKey));
+            } else {
+                editor.setServiceParameter(service, propKey,
+                                           (String)prop.getProperty(propKey));
+            }
+        }
+        System.out.println("Properties merged successfully");
+    }
+
+    // Writes properties of a service or global configuration to a file.
+    private static void processWriteToFileOption(String serviceName,
+                                                 WSDDEditor editor)
+        throws Exception {
+
+        String prompt = "Enter file name to write to. By default, "
+                        + "servicename.properties\n.Value: ";
+        boolean global = isGlobal(serviceName);
+        String fileName = getFilename(prompt, global, serviceName);
+        processWriteToFileOption(serviceName, editor, fileName);
+    }
+
+    private static void processWriteToFileOption(String serviceName,
+                                                 WSDDEditor editor,
+                                                 String fileName)
+        throws Exception {
+
+        String serviceProperties[] = null;
+        boolean global = false;
+        if (isGlobal(serviceName)) {
+            serviceProperties = editor.getGlobalProperties();
+            global = true;
+        }
+        else
+            serviceProperties = editor.getServiceProperties(serviceName);
+
+        if (serviceProperties == null) {
+            System.out.println("No properties to write.\n");
+            return;
+        }
+
+        PrintWriter writer = null;
+        try {
+            writer = new PrintWriter(new FileWriter(fileName));
+            for (int i=0; i<serviceProperties.length; i++) {
+                writer.println(serviceProperties[i]);
+            }
+            System.out.println("Written successfully to file " + fileName);
+        } catch (IOException exp) {
+            System.err.println("Error writing to file. " + exp);
+        } finally {
+            try {
+                if (writer != null)
+                    writer.close();
+            } catch (Exception exp) {
+                System.err.println("Error closing writer. " + exp);
+            }
+        }
+    }
+
+    // Get file name
+    private static String getFilename(String prompt, boolean global,
+                                      String serviceName) {
+        String fileName = Util.getInput(prompt);
+        if ((fileName == null) || (fileName.trim().equals(""))) {
+            if (global)
+                fileName = "globalConfiguration.properties";
+            else
+                fileName = (serviceName.substring(serviceName.lastIndexOf("/")
+                                                  + 1, serviceName.length()))
+                           + ".properties";
+        }
+        return fileName;
+    }
+
+    // interactive or properties file.
+    private static int getEditorOption() {
+        String editOpts = Util.getInput(editorOptPrompt);
+        if (editOpts.trim().equalsIgnoreCase("i"))
+            return 1;
+        else if (editOpts.trim().equalsIgnoreCase("p"))
+            return 2;
+        else if (editOpts.trim().equalsIgnoreCase("q"))
+            return 3;
+        return 0;
+    }
+
+    // file name for config file.
+    private static String processFileInput() {
+        String optionInput = Util.getInput(filePrompt);
+        if ((optionInput == null) || (optionInput.trim().equals("")))
+            return null;
+        else
+            return optionInput;
+    }
+
+    // add, set, get options are processed.
+    private static int processOptionPrompt() {
+        String optionInput = Util.getInput(optionPrompt);
+        if (optionInput.trim().equalsIgnoreCase("add") ||
+            optionInput.trim().equalsIgnoreCase("a"))
+            return 1;
+        else if (optionInput.trim().equalsIgnoreCase("set") ||
+                 optionInput.trim().equalsIgnoreCase("s"))
+            return 2;
+        else if (optionInput.trim().equalsIgnoreCase("query") ||
+                 optionInput.trim().equalsIgnoreCase("q"))
+            return 3;
+        else {
+            System.out.println("Erroneous input.");
+            return 0;
+        }
+    }
+
+    // add option
+    private static boolean processAddOption(WSDDEditor editor)
+        throws Exception {
+
+        String elemName = getElementName();
+        String paramName = getParameterName("add to");
+        String paramVal = getParameterValue("add");
+        return processAddOption(editor, elemName, paramName, paramVal);
+    }
+
+    private static boolean processAddOption(WSDDEditor editor, String elemName,
+                                            String paramName, String paramVal)
+        throws Exception {
+
+        try {
+            if (isGlobal(elemName)) {
+                editor.addGlobalParameter(paramName, paramVal);
+            } else {
+                editor.addServiceParameter(elemName, paramName, paramVal);
+            }
+        } catch(Exception exp) {
+            System.err.println(exp.getMessage());
+            return false;
+        }
+        return true;
+    }
+
+    // set option
+    private static boolean processSetOption(WSDDEditor editor)
+        throws Exception {
+
+        String elemName = getElementName();
+        String paramName = getParameterName("set");
+        String paramVal = getParameterValue("set");
+        return processSetOption(editor, elemName, paramName, paramVal);
+    }
+
+    private static boolean processSetOption(WSDDEditor editor, String elemName,
+                                            String paramName, String paramVal)
+        throws Exception {
+        try {
+            if (isGlobal(elemName)) {
+                editor.setGlobalParameter(paramName, paramVal);
+            } else {
+                editor.setServiceParameter(elemName, paramName, paramVal);
+            }
+        } catch(Exception exp) {
+            System.err.println(exp.getMessage());
+            return false;
+        }
+        return true;
+    }
+
+    // query option
+    private static boolean processQueryOption(WSDDEditor editor)
+        throws Exception {
+
+        String elemName = getElementName();
+        String paramName = getParameterName("query");
+        return processQueryOption(editor, elemName, paramName);
+    }
+
+    private static boolean processQueryOption(WSDDEditor editor,
+                                              String elemName, String paramName)
+        throws Exception {
+
+        String returnString = null;
+        try {
+            if (isGlobal(elemName)) {
+                returnString = editor.getGlobalParameter(paramName);
+            } else {
+                returnString = editor.getServiceParameter(elemName, paramName);
+            }
+            if (returnString == null) {
+                System.out.println("Parameter \"" + paramName + "\" does not "
+                                   + "exist in \"" + elemName + "\"");
+            } else {
+                System.out.println("Value of parameter is: \"" + returnString
+                                   + "\"");
+            }
+        } catch(Exception exp) {
+            System.err.println(exp.getMessage());
+            return false;
+        }
+        return true;
+    }
+
+    // Returns true if its a globalConfiguration element
+    private static boolean isGlobal(String elementName) {
+        if ((elementName != null) && ((elementName.equals(GLOBAL_CONFIG))
+                                      || (elementName.equalsIgnoreCase("g"))))
+            return true;
+        return false;
+    }
+
+    // continue, save & quit, quit.
+    private static String processContinueOptionPrompt() {
+
+        String optionInput = null;
+        do {
+            optionInput = Util.getInput(continuePrompt);
+        } while ((optionInput == null)
+                 || (!((optionInput.trim().equalsIgnoreCase("s"))
+                       || (optionInput.trim().equalsIgnoreCase("c"))
+                       || (optionInput.trim().equalsIgnoreCase("q")))));
+        return optionInput.trim();
+    }
+
+    // gets input for element name (globalConfig or service name)
+    private static String getElementName() {
+
+        String elementName = null;
+        String msg =
+            "Enter service name (or) 'globalConfiguration' or 'g'\n"
+            + "for global parameters: ";
+        do {
+            elementName = Util.getInput(msg);
+        } while ((elementName == null) || (elementName.trim().equals("")));
+        return elementName;
+    }
+
+    // gets name of parameter name
+    private static String getParameterName(String optionName) {
+        String paramName = null;
+        do {
+            paramName = Util.getInput("Enter name of parameter to "
+                                      + optionName + ": ");
+        } while ((paramName == null) || (paramName.trim().equals("")));
+        return paramName;
+    }
+
+    // gets name of parameter value
+    private static String getParameterValue(String optionName) {
+        String paramVal = null;
+        do {
+            paramVal =   Util.getInput("Enter value of parameter to "
+                                       + optionName + ": ");
+        } while ((paramVal == null) || (paramVal.trim().equals("")));
+        return paramVal;
+    }
+
+    // returns reference to editor tool
+    private static WSDDEditor getEditor() throws Exception {
+        String fileName = processFileInput();
+        return getEditor(fileName);
+    }
+
+    private static WSDDEditor getEditor(String fileName) throws Exception {
+        WSDDEditor editor = null;
+        if (fileName == null)
+            editor = new WSDDEditor();
+        else
+            editor = new WSDDEditor(fileName);
+        System.out.println("Using file " + editor.getWSDDFilename());
+        return editor;
+    }
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/GenerateBinding.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/GenerateBinding.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/GenerateBinding.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,387 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.wsdl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.globus.wsrf.tools.CommandLineTool;
+import com.ibm.wsdl.extensions.PopulatedExtensionRegistry;
+import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
+import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
+import com.ibm.wsdl.extensions.soap.SOAPBodyImpl;
+import com.ibm.wsdl.extensions.soap.SOAPFaultImpl;
+import com.ibm.wsdl.extensions.soap.SOAPOperationImpl;
+
+import org.apache.axis.message.addressing.util.AddressingUtils;
+
+public class GenerateBinding
+{
+    private static String ADDRESS = "localhost:8080/wsrf/services/";
+    private static String PROTOCOL = "http";
+    public static final String SOAP_NS =
+            "http://schemas.xmlsoap.org/wsdl/soap/";
+    public static final String HTTP_NS = "http://schemas.xmlsoap.org/soap/http";
+    private static Log logger = LogFactory.getLog(
+            GenerateBinding.class.getName());
+
+    public static void main(String[] args)
+    {
+        Definition portTypeDefinition = null;
+        CommandLine commandLine = null;
+        Options options = new Options();
+        Option option = null;
+        HelpFormatter formatter = new HelpFormatter();
+        String portTypeFile = null;
+        String fileRoot = null;
+        Definition bindingDefinition = null;
+        Definition serviceDefinition = null;
+
+        option = new Option(
+                "o", "out", true,
+                "Specifies the filename prefix for the generated bindings files");
+        option.setArgName("PREFIX");
+        option.setRequired(true);
+        options.addOption(option);
+        option = new Option(
+                "p", "protocol", true,
+                "Specifies the protocol to bind to (default: http)");
+        option.setArgName("PROTOCOL");
+        options.addOption(option);
+        option = new Option(
+                "i", "in", true,
+                "Specifies the file containing the porttype to process");
+        option.setArgName("FILE");
+        option.setRequired(true);
+        options.addOption(option);
+        options.addOption("h", "help", false, "Prints this help message");
+        CommandLineParser parser = new GnuParser();
+
+        try
+        {
+            commandLine = parser.parse(options, args);
+        }
+        catch(Exception e)
+        {
+            logger.error("", e);
+            // internationalize
+            formatter.printHelp(GenerateBinding.class.getName(), options, true);
+            CommandLineTool.sysExit(1);
+        }
+
+        if(commandLine.hasOption('h'))
+        {
+            formatter.printHelp(GenerateBinding.class.getName(), options, true);
+        }
+
+        if(commandLine.hasOption('p'))
+        {
+            PROTOCOL = commandLine.getOptionValue('p');
+        }
+
+        portTypeFile = commandLine.getOptionValue('i');
+        fileRoot = commandLine.getOptionValue('o');
+
+        args = commandLine.getArgs();
+
+        if(args.length != 0)
+        {
+            // internationalize
+            formatter.printHelp(GenerateBinding.class.getName(),
+                                options, false);
+            CommandLineTool.sysExit(1);
+        }
+
+        FileOutputStream bindingDefintionOutput = null;
+        FileOutputStream serviceDefinitionOutput = null;
+        FileInputStream portTypeInput = null;
+
+        try
+        {
+            portTypeFile = new File(portTypeFile).getCanonicalPath();
+            portTypeInput = new FileInputStream(portTypeFile);
+            WSDLFactory factory = WSDLFactory.newInstance();
+            WSDLReader reader = factory.newWSDLReader();
+            WSDLWriter writer = factory.newWSDLWriter();
+            reader.setFeature("javax.wsdl.verbose", false);
+            reader.setFeature("javax.wsdl.importDocuments", true);
+            portTypeDefinition = reader.readWSDL(null, portTypeFile);
+            bindingDefinition = factory.newDefinition();
+            serviceDefinition = factory.newDefinition();
+            if(portTypeDefinition.getQName() == null)
+            {
+                System.err.println(
+                    "Missing 'name' attribute in 'definitions' element.");
+                CommandLineTool.sysExit(1);
+            }
+
+            bindingDefinition.setQName(
+                new QName(portTypeDefinition.getQName().getLocalPart()));
+            serviceDefinition.setQName(
+                new QName(portTypeDefinition.getQName().getLocalPart()));
+
+            bindingDefinition.setTargetNamespace(
+                    portTypeDefinition.getTargetNamespace() +
+                    "/bindings");
+            bindingDefinition.setExtensionRegistry(
+                    new PopulatedExtensionRegistry());
+            bindingDefinition.addNamespace("soap", SOAP_NS);
+            bindingDefinition.addNamespace(
+                "porttype",
+                portTypeDefinition.getTargetNamespace());
+            String bindingFile = fileRoot + "_bindings.wsdl";
+            bindingDefintionOutput = new FileOutputStream(bindingFile);
+            String relativePortTypeFile =
+                    RelativePathUtil.getRelativeFileName(new File(portTypeFile),
+                                                         new File(bindingFile));
+
+            Import portTypeImport = bindingDefinition.createImport();
+            portTypeImport.setLocationURI(relativePortTypeFile);
+            portTypeImport.setNamespaceURI(
+                    portTypeDefinition.getTargetNamespace());
+            bindingDefinition.addImport(portTypeImport);
+            serviceDefinition.setTargetNamespace(
+                    portTypeDefinition.getTargetNamespace() +
+                    "/service");
+            serviceDefinition.setExtensionRegistry(
+                    new PopulatedExtensionRegistry());
+            serviceDefinition.addNamespace("soap", SOAP_NS);
+            serviceDefinition.addNamespace(
+                    "binding",
+                    bindingDefinition.getTargetNamespace());
+            String serviceFile = fileRoot + "_service.wsdl";
+            serviceDefinitionOutput = new FileOutputStream(serviceFile);
+            String relativeBindingFile =
+                    RelativePathUtil.getRelativeFileName(new File(bindingFile),
+                                                         new File(serviceFile));
+            Import bindingImport = serviceDefinition.createImport();
+            bindingImport.setLocationURI(relativeBindingFile);
+            bindingImport.setNamespaceURI(
+                    bindingDefinition.getTargetNamespace());
+            serviceDefinition.addImport(bindingImport);
+            Service service = serviceDefinition.createService();
+            if(serviceDefinition.getQName().getLocalPart().endsWith("Service"))
+            {
+                service.setQName(serviceDefinition.getQName());
+            }
+            else
+            {
+                service.setQName(
+                        new QName(serviceDefinition.getQName().getLocalPart()
+                                  + "Service"));
+            }
+            Iterator portTypeIterator =
+                    portTypeDefinition.getPortTypes().values().iterator();
+            Binding binding;
+            PortType portType;
+            while(portTypeIterator.hasNext())
+            {
+                portType = (PortType) portTypeIterator.next();
+                binding= processPortType(bindingDefinition,
+                                         portType,
+                                         portTypeDefinition);
+                bindingDefinition.addBinding(binding);
+                service.addPort(createPort(serviceDefinition,
+                                           portType,
+                                           binding));
+            }
+            writer.writeWSDL(bindingDefinition, bindingDefintionOutput);
+            serviceDefinition.addService(service);
+            writer.writeWSDL(serviceDefinition, serviceDefinitionOutput);
+        }
+        catch(Exception e)
+        {
+            e.printStackTrace();
+            CommandLineTool.sysExit(1);
+        }
+        finally
+        {
+            if(portTypeInput != null)
+            {
+                try
+                {
+                    portTypeInput.close();
+                }
+                catch(Exception io)
+                {
+                }
+            }
+        }
+    }
+
+    private static Port createPort(
+            Definition serviceDefinition,
+            PortType portType,
+            Binding binding)
+    {
+        Port port = serviceDefinition.createPort();
+        port.setName(portType.getQName().getLocalPart()
+                     + "Port");
+        port.setBinding(binding);
+        SOAPAddress soapAddress = new SOAPAddressImpl();
+        soapAddress.setLocationURI(PROTOCOL + "://" + ADDRESS);
+        port.addExtensibilityElement(soapAddress);
+        return port;
+    }
+
+    private static Binding processPortType(
+            Definition bindingDefinition, PortType portType,
+            Definition portTypeDefinition)
+    {
+        Binding binding = bindingDefinition.createBinding();
+        binding.setPortType(portType);
+        binding.setUndefined(false);
+        binding.setQName(
+                new QName(bindingDefinition.getTargetNamespace(),
+                          portType.getQName().getLocalPart()
+                          + "SOAPBinding"));
+        SOAPBinding soapBinding = new SOAPBindingImpl();
+        soapBinding.setTransportURI(HTTP_NS);
+        soapBinding.setStyle("document");
+        binding.addExtensibilityElement(soapBinding);
+        Iterator operationIterator =
+                portType.getOperations().iterator();
+        BindingOperation bindingOperation;
+        while(operationIterator.hasNext())
+        {
+            try
+            {
+                bindingOperation =
+                processOperation(bindingDefinition,
+                                 portType.getQName(),
+                                 (Operation) operationIterator.next(),
+                                 portTypeDefinition);
+                binding.addBindingOperation(bindingOperation);
+            }
+            catch(Exception e)
+            {
+                System.err.println("Failed to add operation to binding");
+                e.printStackTrace();
+                CommandLineTool.sysExit(1);
+            }
+        }
+        return binding;
+    }
+
+    private static BindingOperation processOperation(
+            Definition bindingDefinition, QName portTypeQName,
+            Operation operation, Definition portTypeDefinition) 
+        throws Exception
+    {
+        BindingOperation bindingOperation =
+                bindingDefinition.createBindingOperation();
+        bindingOperation.setOperation(operation);
+        bindingOperation.setName(operation.getName());
+        Input input = operation.getInput();
+        if(input == null)
+        {
+            throw new Exception("Operation is lacking a <input> element");
+        }
+        Message inputMessage = input.getMessage();
+        if(inputMessage == null)
+        {
+            throw new Exception("Input is lacking a <message> element");
+        }
+        List inputParts = inputMessage.getOrderedParts(null);
+        if (inputParts == null || inputParts.isEmpty()) 
+        {
+            throw new Exception("No <part> element for input message: "  +
+                                inputMessage.getQName());
+            
+        }
+        SOAPOperation soapOperation = new SOAPOperationImpl();
+        String action = AddressingUtils.getInputAction(portTypeQName,
+                                                       operation);
+        soapOperation.setSoapActionURI(action);
+        bindingOperation.addExtensibilityElement(soapOperation);
+        BindingInput bindingInput =
+                bindingDefinition.createBindingInput();
+        SOAPBody soapBody = new SOAPBodyImpl();
+        soapBody.setUse("literal");
+        bindingInput.addExtensibilityElement(soapBody);
+        bindingOperation.setBindingInput(bindingInput);
+        if(operation.getOutput() != null)
+        {
+            BindingOutput bindingOutput =
+                    bindingDefinition.createBindingOutput();
+            soapBody = new SOAPBodyImpl();
+            soapBody.setUse("literal");
+            bindingOutput.addExtensibilityElement(soapBody);
+            bindingOperation.setBindingOutput(bindingOutput);
+        }
+        Iterator faulIterator =
+                operation.getFaults().values().iterator();
+        BindingFault bindingFault;
+        while(faulIterator.hasNext())
+        {
+            bindingFault = processFault(
+                    (Fault) faulIterator.next(),
+                    bindingDefinition);
+            bindingOperation.addBindingFault(bindingFault);
+        }
+        return bindingOperation;
+    }
+
+    private static BindingFault processFault(
+            Fault fault, Definition bindingDefinition)
+    {
+        SOAPFault soapFault = new SOAPFaultImpl();
+        soapFault.setName(fault.getName());
+        soapFault.setUse("literal");
+        BindingFault bindingFault =
+                bindingDefinition.createBindingFault();
+        bindingFault.addExtensibilityElement(soapFault);
+        bindingFault.setName(fault.getName());
+        return bindingFault;
+    }
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/RelativePathUtil.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/RelativePathUtil.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/RelativePathUtil.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,81 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.wsdl;
+
+import java.io.File;
+
+import java.util.LinkedList;
+
+
+public class RelativePathUtil {
+    /**
+     * Returns the name of one file relative to another.  The name it returns
+     * uses forward slashes "/" instead of the system specific file separator.
+     */
+    public static String getRelativeFileName(
+        File target,
+        File realativeTo
+    ) {
+        LinkedList targetList = getPathList(target);
+        LinkedList relativeList = getPathList(realativeTo);
+
+        while (
+            !targetList.isEmpty() && !relativeList.isEmpty() &&
+                targetList.getFirst().equals(relativeList.getFirst())
+        ) {
+            targetList.removeFirst();
+            relativeList.removeFirst();
+        }
+
+        StringBuffer fileName = new StringBuffer();
+
+        while (!relativeList.isEmpty()) {
+            fileName.append("../");
+            relativeList.removeFirst();
+        }
+
+        while (!targetList.isEmpty()) {
+            fileName.append(targetList.removeFirst());
+            fileName.append('/');
+        }
+
+        fileName.append(target.getName());
+
+        return fileName.toString();
+    }
+
+    private static LinkedList getPathList(File file) {
+        if (!file.isAbsolute()) {
+            file = file.getAbsoluteFile();
+        }
+
+        LinkedList list = new LinkedList();
+
+        if (!file.isDirectory()) {
+            file = file.getParentFile();
+        }
+
+        while (file != null) {
+            if (file.getName().length() > 0) { //getName() returns "" for the root dir 
+                list.addFirst(file.getName());
+            }
+
+            file = file.getParentFile();
+        }
+
+        return list;
+    }
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/TypesProcessor.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/TypesProcessor.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/TypesProcessor.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,498 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.wsdl;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.xerces.xs.XSElementDeclaration;
+import org.apache.xerces.xs.XSParticle;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.utils.XMLUtils;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+public class TypesProcessor implements WSDLPreprocessorConstants
+{
+    private Definition definition;
+    private Map imports = null;
+    private Map includes = null;
+
+    private static Log logger =
+        LogFactory.getLog(TypesProcessor.class.getName());
+
+    //Todo: better error handling
+
+    public TypesProcessor(Definition definition)
+    {
+        this.definition = definition;
+    }
+
+    private String addPrefix(String namespace, String prefix)
+    {
+        String pref = this.definition.getPrefix(namespace);
+        if (pref == null)
+        {
+            if (this.definition.getNamespace(prefix) == null)
+            {
+                this.definition.addNamespace(prefix, namespace);
+                pref = prefix;
+            }
+            else
+            {
+                int i = 0;
+                while ( this.definition.getNamespace("ns" + i) != null )
+                {
+                    i++;
+                }
+                pref = "ns" + i;
+                this.definition.addNamespace(pref, namespace);
+            }
+        }
+        return pref;
+    }
+
+    public void addWSAImport(Map schemaDocumentLocations)
+        throws Exception
+    {
+        Element schema = getSchema();
+        Document doc = schema.getOwnerDocument();
+
+        addSchemaDefinitions(WSA_NS, schemaDocumentLocations, schema);
+        addPrefix(WSA_NS, "wsa");
+    }
+
+    private Element getSchema() throws Exception
+    {
+        Types types = this.definition.getTypes();
+        if(types == null)
+        {
+            types = definition.createTypes();
+            this.definition.setTypes(types);
+        }
+        Element schema = null;
+        List elementList = types.getExtensibilityElements();
+        if(elementList.isEmpty())
+        {
+            UnknownExtensibilityElement extensibilityElement =
+                new UnknownExtensibilityElement();
+
+            DocumentBuilder docBuilder =
+                DocumentBuilderFactory.newInstance().newDocumentBuilder();
+
+            Document doc = docBuilder.newDocument();
+            schema = doc.createElementNS(XSD_NS, "xsd:schema");
+            Attr nameSpace =
+                doc.createAttributeNS("http://www.w3.org/2000/xmlns/",
+                                      "xmlns:xsd");
+            nameSpace.setValue(XSD_NS);
+            schema.setAttributeNode(nameSpace);
+            nameSpace = doc.createAttribute("targetNamespace");
+            nameSpace.setValue(definition.getTargetNamespace());
+            schema.setAttributeNode(nameSpace);
+            schema.appendChild(doc.createTextNode("\n      "));
+            doc.appendChild(schema);
+            extensibilityElement.setElement(schema);
+            types.addExtensibilityElement(extensibilityElement);
+        }
+        else
+        {
+            schema =
+            ((UnknownExtensibilityElement) elementList.get(0)).getElement();
+        }
+        return schema;
+    }
+
+    public void addResourceProperties(
+        QName portTypeName, Map resourcePropertyElements,
+        Map schemaDocumentLocations) throws Exception
+    {
+        logger.debug("Starting to build resource properties element");
+        PortType portType = this.getPortType(portTypeName);
+
+        QName resourceProperties =
+            (QName) portType.getExtensionAttribute(RP);
+
+        addPrefix(WSRP_NS, "wsrp");
+
+        Element schema = getSchema();
+        Document doc = schema.getOwnerDocument();
+        String schemaPrefix = "";
+        if(schema.getPrefix() != null)
+        {
+            schemaPrefix = schema.getPrefix() + ":";
+        }
+
+        Element properties = null;
+        if(resourceProperties == null)
+        {
+            resourceProperties =
+            new QName(portType.getQName().getLocalPart() +
+                      "GTWSDLResourceProperties");
+            portType.setExtensionAttribute(RP, resourceProperties);
+            properties = doc.createElementNS(
+                XSD_NS,
+                schemaPrefix + "element");
+            properties.setAttribute("name", resourceProperties.getLocalPart());
+            properties.appendChild(doc.createTextNode("\n        "));
+            schema.appendChild(properties);
+            schema.appendChild(doc.createTextNode("\n    "));
+        }
+        else
+        {
+            NodeList elementNodes = schema.getElementsByTagNameNS(
+                XSD_NS, "element");
+            String name;
+            Element element;
+            for(int i = 0; i < elementNodes.getLength(); i++)
+            {
+                element = (Element) elementNodes.item(i);
+                name = element.getAttribute("name");
+                if(name != null &&
+                   XMLUtils.getQNameFromString(name, element).
+                    getLocalPart().equals(
+                        resourceProperties.getLocalPart()))
+                {
+                    properties = element;
+                    break;
+                }
+            }
+
+            if(properties == null)
+            {
+                throw new Exception();
+            }
+        }
+        String type = properties.getAttribute("type");
+        NodeList complexTypeElements;
+        Element complexType = null;
+
+        if(type != null && !type.equals(""))
+        {
+            complexTypeElements = schema.getElementsByTagNameNS(
+                XSD_NS,
+                "complexType");
+            Element currentType;
+            QName currentName;
+            QName typeName = XMLUtils.getFullQNameFromString(type,
+                                                             properties);
+            for(int i = 0; i < complexTypeElements.getLength(); i++)
+            {
+                currentType = (Element) complexTypeElements.item(i);
+                currentName = XMLUtils.getFullQNameFromString(
+                    currentType.getAttribute("name"),
+                    currentType);
+                if(currentName.getLocalPart().equals(
+                    typeName.getLocalPart()))
+                {
+                    complexType = currentType;
+                    break;
+                }
+            }
+            if(complexType == null)
+            {
+                throw new Exception();
+            }
+        }
+        else
+        {
+            complexTypeElements = properties.getElementsByTagNameNS(
+                XSD_NS,
+                "complexType");
+            if(complexTypeElements.getLength() > 0)
+            {
+                complexType = (Element) complexTypeElements.item(0);
+            }
+            else
+            {
+                complexType =
+                doc.createElementNS(
+                    XSD_NS,
+                    schemaPrefix + "complexType");
+                complexType.appendChild(doc.createTextNode("\n          "));
+                properties.appendChild(complexType);
+                properties.appendChild(doc.createTextNode("\n      "));
+            }
+        }
+
+        NodeList sequenceElements = complexType.getElementsByTagNameNS(
+            XSD_NS, "sequence");
+        Element sequence;
+        if(sequenceElements.getLength() > 0)
+        {
+            sequence = (Element) sequenceElements.item(0);
+        }
+        else
+        {
+            sequence = doc.createElementNS(XSD_NS,
+                                           schemaPrefix + "sequence");
+            complexType.appendChild(sequence);
+            complexType.appendChild(doc.createTextNode("\n        "));
+        }
+
+        Collection resourcePropertiesList =
+            resourcePropertyElements.values();
+        Iterator elementIterator = resourcePropertiesList.iterator();
+        int nsCounter = 0;
+
+        while(elementIterator.hasNext())
+        {
+            sequence.appendChild(doc.createTextNode("\n            "));
+            Element resourcePropertyElement = doc.createElementNS(
+                XSD_NS,
+                schemaPrefix + "element");
+            XSParticle particle = (XSParticle) elementIterator.next();
+            XSElementDeclaration element =
+                (XSElementDeclaration) particle.getTerm();
+            String prefix = XMLUtils.getPrefix(element.getNamespace(),
+                                               schema);
+
+            addSchemaDefinitions(element,
+                                 schemaDocumentLocations,
+                                 schema);
+
+            if(prefix == null)
+            {
+                prefix = "rpns" + String.valueOf(nsCounter++);
+                Attr nameSpace =
+                    doc.createAttributeNS("http://www.w3.org/2000/xmlns/",
+                                          "xmlns:" + prefix);
+                nameSpace.setValue(element.getNamespace());
+                schema.setAttributeNode(nameSpace);
+            }
+
+            resourcePropertyElement.setAttribute("ref",
+                                                 prefix + ":"
+                                                 + element.getName());
+            resourcePropertyElement.setAttribute(
+                "minOccurs",
+                String.valueOf(
+                    particle.getMinOccurs()));
+            if(particle.getMaxOccursUnbounded())
+            {
+                resourcePropertyElement.setAttribute(
+                    "maxOccurs",
+                    String.valueOf(
+                        "unbounded"));
+            }
+            else
+            {
+                resourcePropertyElement.setAttribute(
+                    "maxOccurs",
+                    String.valueOf(
+                        particle.getMaxOccurs()));
+            }
+            sequence.appendChild(resourcePropertyElement);
+        }
+        sequence.appendChild(doc.createTextNode("\n          "));
+        logger.debug("Resource properties element: " +
+                     XMLUtils.ElementToString(properties));
+    }
+
+    private void addSchemaDefinitions(XSElementDeclaration element,
+                                      Map schemaDocumentLocations,
+                                      Element schema)
+    {
+        String elementNS = element.getNamespace();
+        addSchemaDefinitions(elementNS, schemaDocumentLocations, schema);
+    }
+
+    private void addSchemaDefinitions(String elementNS,
+                                      Map schemaDocumentLocations,
+                                      Element schema)
+    {
+        Map map = (Map) schemaDocumentLocations.get(elementNS);
+        if (map == null)
+        {
+            return;
+        }
+        Set locations = map.keySet();
+        Iterator locationsIterator = locations.iterator();
+        String targetNS = schema.getAttribute("targetNamespace");
+        Document owner = schema.getOwnerDocument();
+        String schemaPrefix = schema.getPrefix();
+        if(schemaPrefix == null)
+        {
+            schemaPrefix = "";
+        }
+        else
+        {
+            schemaPrefix += ":";
+        }
+        this.populateImportsMap(schema);
+        this.populateIncludesMap(schema);
+
+        while(locationsIterator.hasNext())
+        {
+            String location = (String) locationsIterator.next();
+            if(!location.equals(definition.getDocumentBaseURI()))
+            {
+                location = WSDLPreprocessor.getRelativePath(
+                    definition.getDocumentBaseURI(),
+                    location);
+
+                if(elementNS.equals(targetNS))
+                {
+                    Map includes = (Map) this.includes.get(elementNS);
+
+                    if(includes == null)
+                    {
+                        includes = new HashMap();
+                        this.includes.put(elementNS, includes);
+                    }
+
+                    if(!includes.containsKey(location))
+                    {
+                        Element include = owner.createElementNS(
+                            XSD_NS, schemaPrefix + "include");
+                        include.setAttribute("schemaLocation", location);
+                        schema.insertBefore(owner.createTextNode("\n"),
+                                            schema.getFirstChild());
+                        schema.insertBefore(include,
+                                            schema.getFirstChild());
+                        schema.insertBefore(owner.createTextNode("\n"),
+                                            schema.getFirstChild());
+                        includes.put(location, null);
+                    }
+                }
+                else
+                {
+                    Map imports = (Map) this.imports.get(elementNS);
+
+                    if(imports == null)
+                    {
+                        imports = new HashMap();
+                        this.imports.put(elementNS, imports);
+                    }
+
+                    if(!imports.containsKey(location))
+                    {
+                        Element xsdImport = owner.createElementNS(
+                            XSD_NS, schemaPrefix + "import");
+                        xsdImport.setAttribute("namespace", elementNS);
+                        xsdImport.setAttribute("schemaLocation", location);
+                        schema.insertBefore(owner.createTextNode("\n"),
+                                            schema.getFirstChild());
+                        schema.insertBefore(xsdImport,
+                                            schema.getFirstChild());
+                        schema.insertBefore(owner.createTextNode("\n"),
+                                            schema.getFirstChild());
+                        imports.put(location, null);
+                    }
+                }
+            }
+        }
+    }
+
+    private void populateImportsMap(Element schema)
+    {
+        if(this.imports == null)
+        {
+            this.imports = new HashMap();
+            NodeList importNodes =
+                schema.getElementsByTagNameNS(XSD_NS, "import");
+            for(int i = 0; i < importNodes.getLength(); i++)
+            {
+                Element xsdImport = (Element) importNodes.item(i);
+                String namespace = xsdImport.getAttribute("namespace") == null ?
+                                   schema.getAttribute("targetNamespace") :
+                                   xsdImport.getAttribute("namespace");
+                Map locations = (Map) this.imports.get(namespace);
+                if(locations == null)
+                {
+                    locations = new HashMap();
+                    this.imports.put(namespace, locations);
+                }
+                locations.put(xsdImport.getAttribute("schemaLocation"), null);
+            }
+        }
+    }
+
+    private void populateIncludesMap(Element schema)
+    {
+        if(this.includes == null)
+        {
+            this.includes = new HashMap();
+            NodeList includeNodes =
+                schema.getElementsByTagNameNS(XSD_NS, "include");
+            for(int i = 0; i < includeNodes.getLength(); i++)
+            {
+                Element include = (Element) includeNodes.item(i);
+                String namespace = schema.getAttribute("targetNamespace");
+                Map locations = (Map) this.includes.get(namespace);
+                if(locations == null)
+                {
+                    locations = new HashMap();
+                    this.includes.put(namespace, locations);
+                }
+                locations.put(include.getAttribute("schemaLocation"), null);
+            }
+        }
+    }
+
+    public PortType getPortType(QName portTypeName) throws Exception
+    {
+        Map portTypes = definition.getPortTypes();
+        PortType portType = null;
+
+        if(portTypeName != null)
+        {
+            if(portTypeName.getNamespaceURI() == null ||
+               portTypeName.getNamespaceURI().length() == 0)
+            {
+                portTypeName = new QName(definition.getTargetNamespace(),
+                                         portTypeName.getLocalPart());
+            }
+
+            portType = (PortType) portTypes.get(portTypeName);
+            if(portType == null)
+            {
+                throw new Exception();
+            }
+        }
+        else
+        {
+            // Just pick the first one
+            Set portTypeSet = portTypes.entrySet();
+            Object portTypeArray[] = portTypeSet.toArray();
+
+            if(portTypeArray.length < 1)
+            {
+                throw new Exception();
+            }
+            portType = (PortType) ((Map.Entry) portTypeArray[0]).getValue();
+        }
+        return portType;
+    }
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/WSDL2Java.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/WSDL2Java.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/WSDL2Java.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,64 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.wsdl;
+
+import org.apache.axis.utils.CLOption;
+import org.apache.axis.utils.CLOptionDescriptor;
+import org.apache.axis.wsdl.toJava.Emitter;
+import org.apache.axis.wsdl.gen.Parser;
+
+public class WSDL2Java 
+    extends org.apache.axis.message.addressing.tools.wsdl.WSDL2Java {
+
+    /** Field type collision protection disable */
+    protected static final int DISABLE_TYPE_COLLISION_OPT = 'l';
+
+    /** Field emitter */
+    private Emitter emitter;
+    
+    protected static final CLOptionDescriptor[] options =
+        new CLOptionDescriptor[]{
+            new CLOptionDescriptor("noTypeCollisionProtection",
+                                   CLOptionDescriptor.ARGUMENT_DISALLOWED,
+                                   DISABLE_TYPE_COLLISION_OPT,
+                                   "disable type collision protection")
+        };
+
+    protected WSDL2Java() {
+        addOptions(options);
+    }
+
+    protected Parser createParser() {
+        this.emitter = (Emitter)super.createParser();
+        return this.emitter;
+    }
+
+    protected void parseOption(CLOption option) {
+        switch (option.getId()) {
+        case DISABLE_TYPE_COLLISION_OPT:
+            emitter.setTypeCollisionProtection(false);
+            break;
+        default:
+            super.parseOption(option);
+        }
+    }
+
+    public static void main(String[] args) {
+        WSDL2Java gsdl2java = new WSDL2Java();
+        gsdl2java.run(args);
+    }
+    
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/WSDLPreprocessor.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/WSDLPreprocessor.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/WSDLPreprocessor.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,790 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.wsdl;
+
+import java.io.File;
+import java.io.FileDescriptor;
+import java.io.FileOutputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.PortType;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.AttributeExtensible;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.namespace.QName;
+
+import org.apache.xerces.dom.DOMInputImpl;
+import org.apache.xerces.impl.xs.XMLSchemaLoader;
+import org.apache.xerces.impl.xs.XSComplexTypeDecl;
+import org.apache.xerces.xs.StringList;
+import org.apache.xerces.xs.XSElementDeclaration;
+import org.apache.xerces.xs.XSModel;
+import org.apache.xerces.xs.XSModelGroup;
+import org.apache.xerces.xs.XSNamespaceItem;
+import org.apache.xerces.xs.XSNamespaceItemList;
+import org.apache.xerces.xs.XSObjectList;
+import org.apache.xerces.xs.XSParticle;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.axis.utils.XMLUtils;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.ls.LSInput;
+
+import org.globus.wsrf.tools.CommandLineTool;
+
+// TODO: need to i18n
+public class WSDLPreprocessor extends CommandLineTool implements WSDLPreprocessorConstants
+{
+    private static int nameSpaceCounter = 0;
+    private static boolean wsaImport = false;
+    private static Log logger = LogFactory.getLog(WSDLPreprocessor.class.getName());
+    private static boolean quiet = false;
+
+    public static void main(String[] args)
+    {
+        QName portTypeName = null;
+        String outFileName = null;
+        String inFileName = null;
+        CommandLine commandLine = null;
+        WSDLFactory factory = null;
+        Options options = new Options();
+        Option option = null;
+        HelpFormatter formatter = new HelpFormatter();
+        PortType portType = null;
+        Definition definition = null;
+        FileOutputStream outFile = null;
+        Map schemaDocumentLocations = new HashMap();
+
+        try
+        {
+            factory = WSDLFactory.newInstance();
+        }
+        catch(Exception e)
+        {
+            String msg = "ERROR: Failed to load WSDL parser implementation";
+            logger.error(msg, e);
+            System.err.println(msg);
+            sysExit(1);
+        }
+
+        WSDLReader reader = factory.newWSDLReader();
+        WSDLWriter writer = factory.newWSDLWriter();
+
+        // Don't import docs for now
+
+        reader.setFeature("javax.wsdl.verbose", false);
+        reader.setFeature("javax.wsdl.importDocuments", false);
+
+        option = new Option("o", "out", true,
+                            "Specifies the file to write the processed WSDL to (default STDOUT)");
+        option.setArgName("FILE");
+        options.addOption(option);
+        option = new Option("p", "porttype", true,
+                            "Specifies the top level porttype to process");
+        option.setArgName("PORTTYPE");
+        options.addOption(option);
+        option = new Option("i", "in", true,
+                            "Specifies the file containing the WSDL to process");
+        option.setArgName("FILE");
+        options.addOption(option);
+        options.addOption("h", "help", false, "Prints this help message");
+        options.addOption("q", "quiet", false, "Don't print warnings");
+        CommandLineParser parser = new GnuParser();
+
+        try
+        {
+            commandLine = parser.parse(options, args);
+        }
+        catch(Exception e)
+        {
+            logger.error("", e);
+            formatter.printHelp(WSDLPreprocessor.class.getName(), options, true);
+            sysExit(1);
+        }
+
+        if(commandLine.hasOption('h'))
+        {
+            formatter.printHelp(WSDLPreprocessor.class.getName(), options, true);
+            sysExit(0);
+        }
+
+        if(commandLine.hasOption('p'))
+        {
+            portTypeName = new QName(commandLine.getOptionValue('p'));
+        }
+
+        inFileName = commandLine.getOptionValue('i');
+
+        if(commandLine.hasOption('o'))
+        {
+            outFileName = commandLine.getOptionValue('o');
+        }
+
+        if(commandLine.hasOption('q'))
+        {
+            quiet = true;
+        }
+
+        args = commandLine.getArgs();
+
+        if(args.length != 0)
+        {
+            // internationalize
+            formatter.printHelp(WSDLPreprocessor.class.getName(), options, false);
+            sysExit(1);
+        }
+
+        try
+        {
+            if(outFileName != null)
+            {
+                outFile = new FileOutputStream(outFileName);
+            }
+            else
+            {
+                outFile = new FileOutputStream(FileDescriptor.out);
+            }
+        }
+        catch(Exception e)
+        {
+            String msg = "ERROR: Couldn't open output file " +
+                outFileName == null ? "STDOUT" : outFileName;
+            logger.error(msg, e);
+            System.err.println(msg);
+            sysExit(1);
+        }
+
+        try
+        {
+            definition = reader.readWSDL(null, inFileName);
+        }
+        catch(Exception e)
+        {
+            String msg = "ERROR: Couldn't read WSDL input file "
+                + inFileName;
+            logger.error(msg, e);
+            System.err.println(msg);
+            sysExit(1);
+        }
+
+        TypesProcessor typesProcessor = new TypesProcessor(definition);
+
+        try
+        {
+            portType = typesProcessor.getPortType(portTypeName);
+        }
+        catch(Exception e)
+        {
+            String msg = "ERROR: Couldn't find "
+                         + portTypeName == null ? "any" :
+                         portTypeName.toString() + " porttype.";
+            logger.error(msg, e);
+            System.err.println(msg);
+            sysExit(1);
+        }
+        portTypeName = portType.getQName();
+
+        ExtensionRegistry extensionAttributes = new ExtensionRegistry();
+        extensionAttributes.registerExtensionAttributeType(
+            PortType.class,
+            EXTENDS,
+            AttributeExtensible.LIST_OF_QNAMES_TYPE);
+        extensionAttributes.registerExtensionAttributeType(
+            PortType.class, RP,
+            AttributeExtensible.QNAME_TYPE);
+        reader.setExtensionRegistry(extensionAttributes);
+
+        try
+        {
+            if(!quiet)
+            {
+                reader.setFeature("javax.wsdl.verbose", true);
+            }
+            reader.setFeature("javax.wsdl.importDocuments", true);
+            definition = reader.readWSDL(null, inFileName);
+        }
+        catch(Exception e)
+        {
+            String msg = "ERROR: Couldn't read WSDL input file "
+                + inFileName;
+            logger.error(msg, e);
+            System.err.println(msg);
+            sysExit(1);
+        }
+
+        typesProcessor = new TypesProcessor(definition);
+        portType = definition.getPortType(portTypeName);
+        List portTypeNames = getDependencies(portType);
+        Map resourcePropertyElements = new HashMap();
+        flatten(portType, definition, definition, portTypeNames,
+                resourcePropertyElements,
+                schemaDocumentLocations);
+
+
+        if(!resourcePropertyElements.isEmpty())
+        {
+            try
+            {
+                typesProcessor.addResourceProperties(portTypeName,
+                                                     resourcePropertyElements,
+                                                     schemaDocumentLocations);
+            }
+            catch(Exception e)
+            {
+                String msg = "ERROR: Failed to add resource properties";
+                logger.error(msg, e);
+                System.err.println(msg);
+                System.err.println(e.toString());
+                sysExit(2);
+            }
+        }
+
+        if(wsaImport)
+        {
+            try
+            {
+                typesProcessor.addWSAImport(schemaDocumentLocations);
+            }
+            catch(Exception e)
+            {
+                String msg = "ERROR: Failed to add WSA XSD import";
+                logger.error(msg, e);
+                System.err.println(msg);
+                System.err.println(e.toString());
+                sysExit(2);
+            }
+        }
+
+        try
+        {
+            writer.writeWSDL(definition, outFile);
+        }
+        catch(Exception e)
+        {
+            String msg = "ERROR: Failed to process WSDL";
+            logger.error(msg, e);
+            System.err.println(msg);
+            System.err.println(e.toString());
+            sysExit(3);
+        }
+    }
+
+    private static PortType flatten(
+        PortType portType,
+        Definition definition,
+        Definition parentDefinition,
+        List portTypeNames,
+        Map resourcePropertyElements,
+        Map schemaDocumentLocations)
+    {
+        Map portTypes = definition.getPortTypes();
+        Iterator portTypeIterator = portTypes.values().iterator();
+
+        while(portTypeIterator.hasNext())
+        {
+            PortType currentPortType = (PortType) portTypeIterator.next();
+
+            if(portTypeNames != null
+               && portTypeNames.contains(currentPortType.getQName()))
+            {
+                logger.debug("Found porttype: " +
+                             currentPortType.getQName());
+
+                QName resourceProperties = (QName)
+                    currentPortType.getExtensionAttribute(RP);
+
+                if(resourceProperties != null)
+                {
+                    logger.debug("Adding resource properties for porttype: " +
+                                 currentPortType.getQName());
+                    resourcePropertyElements.putAll(
+                        getResourceProperties(resourceProperties,
+                                              definition,
+                                              schemaDocumentLocations));
+                }
+
+                List newDependencies = getDependencies(currentPortType);
+
+                if(newDependencies != null && !newDependencies.isEmpty())
+                {
+                    flatten(currentPortType, definition, parentDefinition,
+                            newDependencies,
+                            resourcePropertyElements,
+                            schemaDocumentLocations);
+                    if(!newDependencies.isEmpty() &&
+                       definition != parentDefinition)
+                    {
+                        System.err.println(
+                            "WARNING: The following porttypes are missing:");
+                        Iterator portTypeNamesIterator =
+                            newDependencies.iterator();
+                        while(portTypeNamesIterator.hasNext())
+                        {
+                            System.err.println(
+                                "\t" + ((QName) portTypeNamesIterator.next()).toString());
+                        }
+                    }
+                }
+
+                fixNameSpaces(currentPortType, parentDefinition);
+                List operations = currentPortType.getOperations();
+                ListIterator operationsIterator = operations.listIterator();
+                Operation operation;
+                Input input;
+                Output output;
+
+                while(operationsIterator.hasNext())
+                {
+                    operation = (Operation) operationsIterator.next();
+                    input = operation.getInput();
+                    output = operation.getOutput();
+
+                    if(portType.getOperation(
+                        operation.getName(),
+                        input == null ? null : input.getName(),
+                        output == null ? null : output.getName()) == null)
+                    {
+                        if (input != null &&
+                            input.getExtensionAttribute(WSA_ACTION) != null) {
+                            wsaImport = true;
+                            Element schema = getSchemaElement(definition);
+                            if (schema != null) {
+                                XSModel schemaModel = loadSchema(schema, definition);
+                                populateLocations(schemaModel,
+                                                  schemaDocumentLocations,
+                                                  definition);
+                            }
+                        }
+                        portType.addOperation(operation);
+                    }
+                }
+
+                addImports(definition, parentDefinition);
+
+                portTypeNames.remove(currentPortType.getQName());
+            }
+        }
+
+        if(portTypeNames == null || portTypeNames.isEmpty())
+        {
+            return portType;
+        }
+        else
+        {
+            // Only go to immediate imports - nested imports are not processed
+            if(definition == parentDefinition)
+            {
+                Map imports = new HashMap();
+                imports.putAll(definition.getImports());
+                Iterator importNSIterator = imports.values().iterator();
+
+                while(importNSIterator.hasNext() && !portTypeNames.isEmpty())
+                {
+                    Vector importVector = (Vector) importNSIterator.next();
+                    Iterator importIterator = importVector.iterator();
+                    while(importIterator.hasNext() && !portTypeNames.isEmpty())
+                    {
+                        // Name space?
+                        // I think the rule is to set the target name space to the
+                        // namespace
+                        // specified by import statement if not already defined
+                        Import importDef = (Import) importIterator.next();
+                        flatten(portType, importDef.getDefinition(),
+                                parentDefinition, portTypeNames,
+                                resourcePropertyElements,
+                                schemaDocumentLocations);
+                    }
+                }
+
+                if(!portTypeNames.isEmpty() && !quiet)
+                {
+                    System.err.println(
+                        "WARNING: The following porttypes are missing:");
+                    Iterator portTypeNamesIterator = portTypeNames.iterator();
+                    while(portTypeNamesIterator.hasNext())
+                    {
+                        System.err.println(
+                            "\t" +
+                            ((QName) portTypeNamesIterator.next()).toString());
+                    }
+                }
+            }
+
+            return portType;
+        }
+    }
+
+    private static void addImports(
+        Definition definition, Definition parentDefinition)
+    {
+        Collection imports = definition.getImports().values();
+        Iterator importsIterator = imports.iterator();
+
+        while(importsIterator.hasNext())
+        {
+            Vector importsVector = (Vector) importsIterator.next();
+            Iterator importsVectorIterator = importsVector.iterator();
+            boolean addImport = true;
+            while(importsVectorIterator.hasNext())
+            {
+                Import currentImport =
+                    (Import) importsVectorIterator.next();
+                String location = currentImport.getLocationURI();
+                if(location != null && (location.startsWith(".") ||
+                                        location.indexOf('/') == -1))
+                {
+                    location =
+                        getRelativePath(
+                            parentDefinition.getDocumentBaseURI(),
+                            currentImport.getDefinition().getDocumentBaseURI());
+                    currentImport.setLocationURI(location);
+                }
+                List parentImports = parentDefinition.getImports(
+                    currentImport.getNamespaceURI());
+                if(parentImports != null)
+                {
+                    Iterator parentImportsIterator = parentImports.iterator();
+                    while(parentImportsIterator.hasNext())
+                    {
+                        Import parentImport =
+                            (Import) parentImportsIterator.next();
+                        if(parentImport.getLocationURI().equals(location))
+                        {
+                            addImport = false;
+                            break;
+                        }
+                    }
+                }
+                if(addImport)
+                {
+                    parentDefinition.addImport(currentImport);
+                }
+                addImport = true;
+            }
+        }
+    }
+
+    private static List getDependencies(PortType portType)
+    {
+        List result = (List) portType.getExtensionAttribute(EXTENDS);
+
+        if(result != null)
+        {
+            portType.getExtensionAttributes().remove(EXTENDS);
+        }
+
+        return result;
+    }
+
+    private static Element getSchemaElement(Definition def)
+    {
+        Types types = def.getTypes();
+        if(types == null)
+        {
+            return null;
+        }
+        List elementList = types.getExtensibilityElements();
+        if (elementList.isEmpty())
+        {
+            return null;
+        }
+        else
+        {
+            return ((UnknownExtensibilityElement)elementList.get(0)).getElement();
+        }
+    }
+
+    private static XSModel loadSchema(Element schema, Definition def)
+    {
+        // add namespaces from definition element
+        Map definitionNameSpaces = def.getNamespaces();
+        Set nameSpaces = definitionNameSpaces.entrySet();
+        Iterator nameSpacesIterator = nameSpaces.iterator();
+
+        while(nameSpacesIterator.hasNext())
+        {
+            Entry nameSpaceEntry = (Entry) nameSpacesIterator.next();
+            if ( !"".equals((String) nameSpaceEntry.getKey()) &&
+                 !schema.hasAttributeNS("http://www.w3.org/2000/xmlns/",
+                                        (String) nameSpaceEntry.getKey()))
+             {
+                 Attr nameSpace =
+                     schema.getOwnerDocument().createAttributeNS(
+                            "http://www.w3.org/2000/xmlns/",
+                            "xmlns:" + nameSpaceEntry.getKey());
+                 nameSpace.setValue((String) nameSpaceEntry.getValue());
+                 schema.setAttributeNode(nameSpace);
+             }
+        }
+
+        LSInput schemaInput = new DOMInputImpl();
+        schemaInput.setStringData(
+                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+                + XMLUtils.ElementToString(schema));
+        logger.debug("Loading schema in types section of definition " +
+                     def.getDocumentBaseURI());
+        schemaInput.setSystemId(def.getDocumentBaseURI());
+        XMLSchemaLoader schemaLoader = new XMLSchemaLoader();
+        XSModel schemaModel = schemaLoader.load(schemaInput);
+        logger.debug("Done loading");
+        return schemaModel;
+    }
+
+    private static void populateLocations(XSModel schemaModel,
+                                          Map documentLocations,
+                                          Definition def) {
+        XSNamespaceItemList namespaceItemList =
+            schemaModel.getNamespaceItems();
+        for(int i = 0; i < namespaceItemList.getLength(); i++)
+        {
+            XSNamespaceItem namespaceItem = namespaceItemList.item(i);
+            Map locations = (Map) documentLocations.get(
+                                  namespaceItem.getSchemaNamespace());
+            if(locations == null)
+            {
+                locations = new HashMap();
+                documentLocations.put(namespaceItem.getSchemaNamespace(),
+                                      locations);
+            }
+
+            StringList list = namespaceItem.getDocumentLocations();
+            for(int j = 0; j < list.getLength(); j++)
+            {
+                if(!list.item(j).equals(def.getDocumentBaseURI()))
+                {
+                    locations.put(list.item(j), null);
+                }
+            }
+        }
+    }
+
+    public static Map getResourceProperties(
+        QName resourceProperties,
+        Definition def,
+        Map documentLocations)
+    {
+        HashMap resourcePropertyElements = new HashMap();
+
+        if(resourceProperties != null)
+        {
+            Types types = def.getTypes();
+            if(types == null)
+            {
+                if(!quiet)
+                {
+                    System.err.println(
+                        "WARNING: The " + def.getDocumentBaseURI()
+                        + " definition does not have a types section");
+                }
+                return resourcePropertyElements;
+            }
+
+            List elementList = types.getExtensibilityElements();
+            // assume only on schema element for now
+            if(elementList.size() > 1)
+            {
+                if(!quiet)
+                {
+                    System.err.println(
+                        "WARNING: The types section in "
+                        + def.getDocumentBaseURI()
+                        + " contains more than one top level element.");
+                }
+                // maybe throw error
+            }
+            Element schema =
+                ((UnknownExtensibilityElement)
+                elementList.get(0)).getElement();
+
+            XSModel schemaModel = loadSchema(schema, def);
+
+            XSElementDeclaration resourcePropertiesElement =
+                schemaModel.getElementDeclaration(
+                    resourceProperties.getLocalPart(),
+                    resourceProperties.getNamespaceURI());
+
+            if(resourcePropertiesElement != null)
+            {
+                XSComplexTypeDecl type =
+                    (XSComplexTypeDecl)
+                        resourcePropertiesElement.getTypeDefinition();
+                XSParticle particle = type.getParticle();
+                XSModelGroup sequence = (XSModelGroup) particle.getTerm();
+                XSObjectList objectList = sequence.getParticles();
+
+                for(int i = 0; i < objectList.getLength(); i++)
+                {
+                    XSParticle part = (XSParticle) objectList.item(i);
+                    Object term = part.getTerm();
+                    if (term instanceof XSElementDeclaration) {
+                        XSElementDeclaration resourceProperty =
+                            (XSElementDeclaration)term;
+                        resourcePropertyElements.put(
+                            new QName(resourceProperty.getNamespace(),
+                                      resourceProperty.getName()), part);
+                    }
+                    else
+                    {
+                        System.err.println(
+                            "ERROR: Invalid resource properties document "
+                            + resourceProperties.toString());
+                        sysExit(1);
+                    }
+                }
+            }
+            else
+            {
+                Map imports = def.getImports();
+                Iterator importNSIterator = imports.values().iterator();
+                while(importNSIterator.hasNext()
+                      && resourcePropertyElements.isEmpty())
+                {
+                    Vector importVector = (Vector) importNSIterator.next();
+                    Iterator importIterator = importVector.iterator();
+                    while(importIterator.hasNext()
+                          && resourcePropertyElements.isEmpty())
+                    {
+                        Import importDef = (Import) importIterator.next();
+                        // process imports
+                        resourcePropertyElements.putAll(getResourceProperties(
+                            resourceProperties, importDef.getDefinition(),
+                            documentLocations));
+                    }
+                }
+
+                if(resourcePropertyElements.isEmpty())
+                {
+                    // throw error
+                    System.err.println(
+                        "ERROR: Unable to resolve resource properties "
+                        + resourceProperties.toString());
+                    //TODO: This is bad, should clean up and throw exception instead
+                    sysExit(1);
+                }
+            }
+
+            populateLocations(schemaModel, documentLocations, def);
+        }
+        return resourcePropertyElements;
+    }
+
+    private static void fixNameSpaces(
+        PortType porttype, Definition definition)
+    {
+        List operations = porttype.getOperations();
+        Iterator operationsIterator = operations.iterator();
+
+        while(operationsIterator.hasNext())
+        {
+            Operation operation = (Operation) operationsIterator.next();
+            Input input = operation.getInput();
+            if(input != null)
+            {
+                Message inMessage = input.getMessage();
+
+                if(inMessage != null &&
+                   definition.getPrefix(
+                       inMessage.getQName().getNamespaceURI()) == null)
+                {
+                    definition.addNamespace(
+                        "gtwsdl"
+                        + String.valueOf(
+                            nameSpaceCounter++),
+                        inMessage.getQName().getNamespaceURI());
+                }
+            }
+
+            Output output = operation.getOutput();
+
+            if(output != null)
+            {
+                Message outMessage = output.getMessage();
+                if(outMessage != null &&
+                   definition.getPrefix(
+                       outMessage.getQName().getNamespaceURI()) == null)
+                {
+                    definition.addNamespace(
+                        "gtwsdl"
+                        + String.valueOf(
+                            nameSpaceCounter++),
+                        outMessage.getQName().getNamespaceURI());
+                }
+            }
+
+            Map faults = operation.getFaults();
+
+            if(faults != null)
+            {
+                Iterator faultIterator = faults.values().iterator();
+                while(faultIterator.hasNext())
+                {
+                    Message faultMessage =
+                        ((Fault) faultIterator.next()).getMessage();
+                    if(definition.getPrefix(
+                        faultMessage.getQName().getNamespaceURI()) == null)
+                    {
+                        definition.addNamespace(
+                            "gtwsdl"
+                            + String.valueOf(
+                                nameSpaceCounter++),
+                            faultMessage.getQName().getNamespaceURI());
+                    }
+                }
+            }
+        }
+    }
+
+    //Todo: move to utility class?
+
+    protected static String getRelativePath(
+        String srcPathURI, String destPathURI)
+    {
+        String destPath = destPathURI.substring(5);
+        String srcPath = srcPathURI.substring(5);
+        return RelativePathUtil.getRelativeFileName(new File(destPath),
+                                                    new File(srcPath));
+    }
+
+}

Added: incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/WSDLPreprocessorConstants.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/WSDLPreprocessorConstants.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/source/src/org/globus/wsrf/tools/wsdl/WSDLPreprocessorConstants.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,38 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.wsdl;
+
+import javax.xml.namespace.QName;
+
+public interface WSDLPreprocessorConstants
+{
+    public static final String WSDL_NS = "http://schemas.xmlsoap.org/wsdl/";
+    public static final String XSD_NS = "http://www.w3.org/2001/XMLSchema";
+    public static final String WSDLPP_NS =
+        "http://www.globus.org/namespaces/2004/10/WSDLPreprocessor";
+    public static final String WSRP_NS =
+        "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd";
+    public static final QName EXTENDS = new QName(WSDLPP_NS,
+                                                  "extends");
+    public static final QName RP = new QName(WSRP_NS,
+                                             "ResourceProperties");
+
+    public static final String WSA_NS =
+        "http://schemas.xmlsoap.org/ws/2004/03/addressing";
+
+    public static final QName WSA_ACTION =
+        new QName(WSA_NS, "Action");
+}

Added: incubator/apollo/globus/tools/test/build.xml
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/test/build.xml?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/test/build.xml	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,152 @@
+<?xml version="1.0"?>
+
+<project default="all" name="globus_wsrf_tools_test" basedir=".">
+    <description>
+        Targets for testing the tooling
+    </description>
+
+    <!-- 
+    Give user a chance to override without editing this file
+    (and without typing -D each time it compiles it) 
+    -->
+    
+    <property environment="env"/>
+    
+    <property file="build.properties"/>
+    <property file="${user.home}/build.properties"/>
+    
+    <property name="env.GLOBUS_LOCATION" value="../../../install"/>
+    <property name="deploy.dir" location="${env.GLOBUS_LOCATION}"/>
+    <property name="package.name" value="globus_wsrf_tools_test"/>
+    <property name="jar.name" value="${package.name}.jar"/>
+    <property name="gar.name" value="${package.name}.gar"/>
+    <property name="wsdl.dir" location="wsdl"/>
+    <property name="build.packages" location=
+        "${deploy.dir}/share/globus_wsrf_common/build-packages.xml"/>
+    <property name="build.stubs" location=
+        "${deploy.dir}/share/globus_wsrf_tools/build-stubs.xml"/>
+    <property name="java.debug" value="on"/>
+
+    <property name="build.dir"  location="build"/>
+    <property name="build.dest" location="${build.dir}/classes"/>
+    <property name="stubs.dir" location="${build.dir}/stubs"/>
+    <property name="build.lib.dir" location="${build.dir}/lib"/>
+    <property name="schema.src"   location="${deploy.dir}/share/schema"/>
+    <property name="schema.dest"  location="${build.dir}/schema"/>
+    <property name="garjars.id" value="garjars"/>
+    <fileset dir="${build.lib.dir}" id="garjars"/>
+
+    <property name="junit.reports.dir" value="test-reports"/>
+    <property name="junit.haltonfailure" value="true"/>
+    <property name="junit.timeout" value="60000"/>
+    <property name="junit.jvmarg" value="-Dignore" />
+
+    <property name="test.server.url" 
+              value="http://localhost:8080/wsrf/services/"/>
+
+    <target name="init">
+        <mkdir dir="${build.dir}"/>
+        <mkdir dir="${build.dest}"/>
+        <mkdir dir="${build.lib.dir}"/>
+        <mkdir dir="${stubs.dir}"/>
+        <mkdir dir="${schema.dest}"/>
+        <copy toDir="${schema.dest}">
+            <fileset dir="${schema.src}" casesensitive="yes">
+                <include name="wsrf/**/*"/>
+                <include name="ws/**/*"/>
+            </fileset>
+        </copy>
+    </target>
+
+    <target name="compile" depends="init">
+        <javac srcdir="src" destdir="${build.dest}" debug="${java.debug}">
+            <include name="**/*.java"/>
+            <classpath>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                </fileset>
+            </classpath>
+        </javac>
+    </target>
+
+    <target name="jar" depends="compile">
+        <jar destfile="${build.lib.dir}/${jar.name}" basedir="${build.dest}"/>
+    </target>
+
+    <target name="dist" depends="jar">
+        <ant antfile="${build.packages}" target="makeGar">
+            <reference refid="${garjars.id}"/>  
+        </ant>
+    </target>
+
+    <target name="deploy" depends="dist">
+        <ant antfile="${build.packages}" target="deployGar"/>
+    </target>  
+
+    <target name="testStubs" depends="init">
+        <copy toDir="${schema.dest}">
+            <fileset dir="${wsdl.dir}" casesensitive="yes">
+                <include name="*.wsdl"/>
+            </fileset>
+        </copy>
+
+    	<ant antfile="${build.stubs}" target="flatten">
+            <property name="source.flatten.dir" location="${schema.dest}"/>
+            <property name="target.flatten.dir" location="${schema.dest}"/>
+            <property name="wsdl.source" value="test.wsdl"/>
+            <property name="wsdl.target" value="test_flattened.wsdl"/>
+            <property name="wsdl.porttype" value="test"/>
+    	</ant> 
+    </target>
+
+    <target name="test" depends="compile">
+      <antcall target="testStubs"/>
+      <property name="server.arg" value="-Dignore" />
+      <antcall target="runTests"/>
+    </target>
+
+    <target name="testServer" depends="compile">
+      <antcall target="testStubs"/>
+      <property name="server.arg" 
+                value="-Dweb.server.url=${test.server.url}" />
+      <antcall target="runTests"/>
+    </target>
+
+    <target name="runTests">
+        <mkdir dir="${junit.reports.dir}" />
+        <junit printsummary="yes" 
+             haltonfailure="${junit.haltonfailure}" 
+             fork="yes" 
+             timeout="${junit.timeout}">
+            <sysproperty key="GLOBUS_LOCATION"
+                value="${deploy.dir}"/>
+            <classpath>
+                <pathelement location="${build.dest}"/>
+                <pathelement location="${deploy.dir}"/>
+                <fileset dir="${deploy.dir}/lib">
+                    <include name="*.jar"/>
+                    <exclude name="${stubs.jar.name}"/>
+                    <exclude name="${jar.name}"/>
+                </fileset>
+            </classpath>
+        <formatter type="xml" />
+        <batchtest todir="${junit.reports.dir}">
+         <fileset dir="${build.dest}">
+            <include name="**/PackageTests.class" />
+         </fileset>
+        </batchtest>
+        <jvmarg value="-Djava.endorsed.dirs=${deploy.dir}/endorsed"/>
+        <jvmarg line="${junit.jvmarg}" />
+      </junit>
+    </target>
+
+    <target name="all" depends="deploy"/>
+
+    <target name="clean">
+        <delete dir="tmp"/>
+        <delete dir="${build.dir}"/>
+        <delete file="${gar.name}"/>
+        <delete dir="${test.reports.dir}"/>
+    </target>
+        
+</project>

Added: incubator/apollo/globus/tools/test/pkgdata/filelist
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/test/pkgdata/filelist?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/test/pkgdata/filelist	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,2 @@
+etc/globus_packages/globus_wsrf_tools_test/undeploy.xml
+lib/globus_wsrf_tools_test.jar

Added: incubator/apollo/globus/tools/test/pkgdata/pkg_data_src.gpt
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/test/pkgdata/pkg_data_src.gpt?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/test/pkgdata/pkg_data_src.gpt	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE gpt_package_metadata SYSTEM "package.dtd">
+
+<gpt_package_metadata Format_Version="0.01" Name="globus_java_ws_core_tools_test">
+
+    <Aging_Version Age="0" Major="0" Minor="1"/>
+    <Description>
+        Tests for the Java WS Core Tools package
+    </Description>
+    <Functional_Group>Core</Functional_Group>
+    <Version_Stability Release="alpha" />
+
+    <src_pkg >
+
+        <Source_Dependencies Type="compile" >
+            <Dependency Name="globus_java_ws_core_tools" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+            <Dependency Name="globus_ws_core_schema" Package="pgm">
+                <Version>
+                    <Simple_Version Major="0"/>
+                </Version>
+            </Dependency>
+        </Source_Dependencies>
+
+        <Build_Environment >
+            <cflags ></cflags>
+            <external_includes ></external_includes>
+            <pkg_libs ></pkg_libs>
+            <external_libs ></external_libs>
+        </Build_Environment>
+
+        <With_Flavors build="no" />
+
+        <Version_Label>0.1</Version_Label>
+
+        <Build_Instructions>
+            <Build_Step>ant deploy -Ddeploy.dir=INSTALLDIR_GPTMACRO</Build_Step>
+        </Build_Instructions>
+
+    </src_pkg >
+
+</gpt_package_metadata>

Added: incubator/apollo/globus/tools/test/src/org/globus/wsrf/tools/wsdd/PackageTests.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/test/src/org/globus/wsrf/tools/wsdd/PackageTests.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/test/src/org/globus/wsrf/tools/wsdd/PackageTests.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,33 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.wsdd;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.framework.TestResult;
+
+public class PackageTests extends TestSuite {
+
+    public PackageTests(String name) {
+        super(name);
+    }
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new PackageTests("WSDD Tests");
+	suite.addTestSuite(TestWSDDEditor.class);
+        return suite;
+    }
+}

Added: incubator/apollo/globus/tools/test/src/org/globus/wsrf/tools/wsdd/TestWSDDEditor.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/test/src/org/globus/wsrf/tools/wsdd/TestWSDDEditor.java?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/test/src/org/globus/wsrf/tools/wsdd/TestWSDDEditor.java	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,162 @@
+/*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.globus.wsrf.tools.wsdd;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import java.util.StringTokenizer;
+
+import org.xml.sax.InputSource;
+
+import org.globus.wsrf.tools.wsdd.WSDDEditor;
+
+import org.w3c.dom.Document;
+
+import java.io.ByteArrayInputStream;
+
+import org.globus.wsrf.utils.XmlUtils;
+
+public class TestWSDDEditor extends TestCase {
+
+    static final String testServerConfig1 =
+	"<?xml version=\"1.0\" encoding=\"UTF-8\"?> "
+	+ "<deployment xmlns=\"http://xml.apache.org/axis/wsdd/\" "
+	+ "xmlns:java=\"http://xml.apache.org/axis/wsdd/providers/java\">"
+	+ " <globalConfiguration>   <parameter name=\"sendMultiRefs\""
+	+ " value=\"true\"/> <parameter name=\"adminPassword\" "
+	+ "value=\"admin\"/> <parameter name=\"sweeperThreads\" "
+	+ "value=\"3\"/> </globalConfiguration> "
+	+ " <service name=\"core/logging/OgsiLoggingManagementService\""
+	+ " provider=\"Handler\" style=\"wrapped\" use=\"literal\">"
+	+ " <parameter name=\"logBufferSize\" value=\"12\"/> "
+	+ " <parameter name=\"persistent\" value=\"true\"/> "
+	+ "  <parameter name=\"allowedMethods\" value=\"*\"/> </service>"
+	+ " <service name=\"core/admin/AdminService\""
+	+ " provider=\"Handler\" style=\"wrapped\" use=\"literal\">"
+	+ " <parameter name=\"persistent\" value=\"false\"/> "
+	+ "  <parameter name=\"allowedMethods\" value=\"random\"/> </service>"
+	+ " </deployment>";
+
+    public TestWSDDEditor(String name){
+	super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(TestWSDDEditor.class);
+    }
+
+    public void testWSDDEditor() throws Exception {
+        InputSource is =
+            new InputSource(new ByteArrayInputStream(
+				testServerConfig1.getBytes()));
+        Document doc = XmlUtils.newDocument(is);
+	WSDDEditor testEditor = new WSDDEditor(doc);
+
+	// get on a good global param
+	String value = testEditor.getGlobalParameter("adminPassword");
+	assertTrue(value.equals("admin"));
+	
+	// get on bad global param.
+	assertTrue(testEditor.getGlobalParameter("dummyparam") == null);
+	
+	// get all global parameters.
+	String globalProperties[] = testEditor.getGlobalProperties();
+	assertTrue(globalProperties != null);
+	assertTrue(globalProperties.length == 3);
+	assertTrue(validateProperty(globalProperties[2], "sendMultiRefs",
+				    "true"));
+	assertTrue(validateProperty(globalProperties[1], "sweeperThreads",
+				    "3"));
+	assertTrue(validateProperty(globalProperties[0], "adminPassword",
+				    "admin"));
+
+	// set on existing global param.
+	testEditor.setGlobalParameter("adminPassword", "testPass");
+	String val = testEditor.getGlobalParameter("adminPassword");
+	assertTrue(val.equals("testPass"));
+
+	// set on new global param
+	testEditor.setGlobalParameter("newDummyParam", "testPass");
+
+	// get on the new global param
+	String newTestVal = testEditor.getGlobalParameter("newDummyParam");
+	assertTrue(newTestVal.equals("testPass"));
+
+	// add to the new param
+	testEditor.addGlobalParameter("newDummyParam", "testPass2");
+	String appendedVal = testEditor.getGlobalParameter("newDummyParam");
+	assertTrue(appendedVal.equals("testPass,testPass2"));
+
+	// get good param from a service
+	String serviceName1 = "core/logging/OgsiLoggingManagementService";
+	val = testEditor.getServiceParameter(serviceName1, "logBufferSize");
+	assertTrue(val.equals("12"));
+	
+	// get bad param from service.
+	val = testEditor.getServiceParameter(serviceName1, "dummyNewParam");
+	assertTrue(val == null);
+
+	// properties on service.
+	String serviceProps[] = testEditor.getServiceProperties(serviceName1);
+	assertTrue(serviceProps != null);
+	assertTrue(serviceProps.length == 3);
+	assertTrue(validateProperty(serviceProps[0], "allowedMethods",
+				    "*"));
+	assertTrue(validateProperty(serviceProps[1], "persistent",
+				    "true"));
+	assertTrue(validateProperty(serviceProps[2], "logBufferSize",
+				    "12"));
+
+	// set on existing service param
+	testEditor.setServiceParameter(serviceName1, "logBufferSize", "100");
+	val = testEditor.getServiceParameter(serviceName1, "logBufferSize");
+	assertTrue(val.equals("100"));
+	
+	// set on new service param
+	testEditor.setServiceParameter(serviceName1, "logNewParam","dummyVal");
+	
+	// get on new service param
+	String newServiceVal = 
+	    testEditor.getServiceParameter(serviceName1, "logNewParam");
+	assertTrue(newServiceVal.equals("dummyVal"));
+
+	// add to the new param
+	testEditor.addServiceParameter(serviceName1, "logNewParam",
+				       "dummyVal2");
+	String newServiceVal1 = 
+	    testEditor.getServiceParameter(serviceName1, "logNewParam");
+	assertTrue(newServiceVal1.equals("dummyVal,dummyVal2"));
+    }
+
+    private boolean validateProperty(String val, String name, String value) {
+	if (val == null)
+	    return false;
+	try {
+	    StringTokenizer strtok = new StringTokenizer(val, "=");
+	    if (strtok.countTokens() != 2)
+		return false;
+	    if (!name.equals(strtok.nextToken()))
+		return false;
+	    if (!value.equals(strtok.nextToken()))
+		return false;
+	} catch (Exception exp) {
+	    fail("Unable to parse string" + exp);
+	}
+	return true;
+    }
+}

Added: incubator/apollo/globus/tools/test/wsdl/bar.wsdl
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/test/wsdl/bar.wsdl?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/test/wsdl/bar.wsdl	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name="Bar" 
+    targetNamespace="http://www.globus.org/bar" 
+    xmlns:gtwsdl="http://www.globus.org/namespaces/2004/01/GTWSDLExtensions"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"> 
+
+    <portType name="bar" gtwsdl:implements="notfound">
+        <operation name="foobar"/>
+    </portType>
+
+</definitions>

Added: incubator/apollo/globus/tools/test/wsdl/foo.wsdl
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/test/wsdl/foo.wsdl?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/test/wsdl/foo.wsdl	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name="Foo" 
+    targetNamespace="http://www.globus.org/foo" 
+    xmlns:gtwsdl="http://www.globus.org/namespaces/2004/01/GTWSDLExtensions"
+    xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd" 
+    xmlns:bar="http://www.globus.org/bar" 
+    xmlns:foo="http://www.globus.org/foo" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/"> 
+
+    <import location="bar.wsdl" namespace="http://www.globus.org/bar"/>
+
+    <types>
+        <xsd:schema targetNamespace="http://www.globus.org/foo"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:tns="http://www.globus.org/foo"
+            attributeFormDefault="qualified"
+            elementFormDefault="qualified">
+
+            <xsd:element name="foobarRP">
+                <xsd:complexType/>
+            </xsd:element>
+
+            <xsd:element name="foobarProperties">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element ref="tns:foobarRP" minOccurs="1"
+                            maxOccurs="1"/>
+                        <xsd:element ref="tns:foobarRP" 
+                            minOccurs="1" maxOccurs="1"/>
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+
+        </xsd:schema>
+    </types>
+
+
+    <portType name="foo" 
+        gtwsdl:implements="bar:bar" 
+        wsrp:ResourceProperties="foo:foobarProperties">
+        <operation name="foo"/>
+    </portType>
+
+</definitions>

Added: incubator/apollo/globus/tools/test/wsdl/test.wsdl
Url: http://svn.apache.org/viewcvs/incubator/apollo/globus/tools/test/wsdl/test.wsdl?view=auto&rev=124127
==============================================================================
--- (empty file)
+++ incubator/apollo/globus/tools/test/wsdl/test.wsdl	Tue Jan  4 09:11:50 2005
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions name="Test" 
+    targetNamespace="http://www.globus.org/test"
+    xmlns:tns="http://www.globus.org/test"
+    xmlns:foo="http://www.globus.org/foo" 
+    xmlns:gtwsdl="http://www.globus.org/namespaces/2004/01/GTWSDLExtensions"
+    xmlns:wsrpw="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl" 
+    xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/"> 
+
+    <import location="foo.wsdl" namespace="http://www.globus.org/foo"/>
+
+    <import 
+        namespace="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl"
+        location="wsrf/properties/WS-ResourceProperties.wsdl"/>
+
+    <types>
+        <xsd:schema targetNamespace="http://www.globus.org/test"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:tns="http://www.globus.org/test"
+            attributeFormDefault="qualified"
+            elementFormDefault="qualified">
+
+            <xsd:element name="testRP">
+                <xsd:complexType/>
+            </xsd:element>
+
+            <xsd:element name="testProperties">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element ref="tns:testRP" 
+                            minOccurs="1" maxOccurs="1"/>
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+
+        </xsd:schema>
+    </types>
+
+    <portType name="test" 
+        gtwsdl:implements="foo:foo wsrpw:QueryResourceProperties"
+        wsrp:ResourceProperties="tns:testProperties">
+        <operation name="bar"/>
+    </portType>
+
+</definitions>

---------------------------------------------------------------------
To unsubscribe, e-mail: apollo-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: apollo-dev-help@ws.apache.org