You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2005/05/17 10:28:49 UTC
svn commit: r170547 -
/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java
Author: chathura
Date: Tue May 17 01:28:48 2005
New Revision: 170547
URL: http://svn.apache.org/viewcvs?rev=170547&view=rev
Log:
Client Stub added.
Added:
webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java
Added: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java?rev=170547&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java (added)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java Tue May 17 01:28:48 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.clientapi;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.context.EngineContextFactory;
+import org.apache.axis.deployment.DeploymentException;
+import org.apache.axis.engine.AxisFault;
+
+
+
+
+
+
+
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public abstract class Stub {
+
+ protected org.apache.axis.context.ConfigurationContext _confiurationContext;
+
+ protected org.apache.axis.description.ServiceDescription _service;
+
+ protected static org.apache.axis.description.OperationDescription[] _operations;
+
+ /**
+ * If _maintainSession is set to True all the calls will use the same
+ * ServiceContext and the user can Share information through that
+ * ServiceContext across operations.
+ */
+ protected boolean _maintainSession = false;
+
+ protected String _currentSessionId = null;
+
+
+ protected Stub(QName serviceName, String axis2Home)throws DeploymentException, AxisFault{
+ _confiurationContext = new EngineContextFactory().buildClientEngineContext(axis2Home);
+ _service = new org.apache.axis.description.ServiceDescription();
+ _service.setName(serviceName);
+
+ for (int i = 0; i < _operations.length; i++) {
+ _service.addOperation(_operations[i]);
+ }
+
+ _confiurationContext.getEngineConfig().addService(_service);
+ }
+
+ public abstract void _setSessionInfo(Object key, Object value) throws Exception;
+
+ public abstract Object _getSessionInfo(Object key) throws Exception ;
+
+
+ public void _startSession(){
+ _maintainSession = true;
+
+ _currentSessionId = getID() ;
+ }
+
+ public void _endSession(){
+ _maintainSession = false;
+ }
+
+ protected String _getServiceContextID(){
+ if(_maintainSession)
+ return _currentSessionId;
+ else
+ return getID();
+ }
+
+ private String getID(){
+ //TODO Get the UUID generator to generate values
+ return Long.toString(System.currentTimeMillis());
+ }
+}