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 he...@apache.org on 2005/01/31 05:19:48 UTC
svn commit: r149213 - in
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis:
deployment/ encoding/ engine/ impl/providers/ impl/receivers/
impl/transport/http/
Author: hemapani
Date: Sun Jan 30 20:19:46 2005
New Revision: 149213
URL: http://svn.apache.org/viewcvs?view=rev&rev=149213
Log:
fix the provider use with the Deployment and add a Encoder Interface
Added:
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/Encoder.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/OutObjectArrayImpl.java
Modified:
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/SimpleTypeEncodingUtils.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/Dispatcher.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/providers/SimpleJavaProvider.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/receivers/InOutSyncReceiver.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.java
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java?view=diff&r1=149212&r2=149213
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/deployment/DeploymentEngine.java Sun Jan 30 20:19:46 2005
@@ -253,15 +253,19 @@
urlsToLoadFrom = new URL[]{file.toURL()};
loader1 = new URLClassLoader(urlsToLoadFrom, parent);
service.setClassLoader(loader1);
- if(! currentFileItem.getClassName().equals("")){
+
+ String readInClass = currentFileItem.getClassName();
+
+ if(readInClass != null && !"".equals(readInClass)){
serviceclass = Class.forName(currentFileItem.getClassName(), true, loader1);
}
- service.setServiceClass(serviceclass);
- if(! currentFileItem.getProvideName().equals("")){
+ service.setServiceClass(serviceclass);
+
+ String readInProviderName = currentFileItem.getProvideName();
+ if(readInProviderName != null && ! "".equals(readInProviderName)){
Class provider =Class.forName(currentFileItem.getProvideName(), true, loader1);
service.setProvider((Provider)provider.newInstance());
}
- service.setServiceClass(serviceclass);
} catch (MalformedURLException e) {
throw new AxisFault(e.getMessage(),e);
} catch (Exception e) {
@@ -366,6 +370,15 @@
case SERVICE:
{
try {
+// String serviceName = currentFileItem.getName();
+// int endIndex = serviceName.lastIndexOf('.');
+// int startIndex = serviceName.lastIndexOf('/');
+// if(startIndex == -1){
+// startIndex = serviceName.lastIndexOf('\\');
+// }
+
+ // AxisService service = new AxisService(new QName(serviceName.substring(startIndex +1,endIndex -1)));
+
AxisService service = new AxisService();
unZipJAR.unzipService(currentFileItem.getAbsolutePath(), this, service);
addnewService(service);
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/Encoder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/Encoder.java?view=auto&rev=149213
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/Encoder.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/Encoder.java Sun Jan 30 20:19:46 2005
@@ -0,0 +1,28 @@
+/*
+ * 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.encoding;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axis.engine.AxisFault;
+import org.apache.axis.om.OutObject;
+
+
+public interface Encoder extends OutObject{
+ public Object deSerialize(XMLStreamReader xpp)throws AxisFault;
+ public void setObject(Object obj);
+}
Added: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/OutObjectArrayImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/OutObjectArrayImpl.java?view=auto&rev=149213
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/OutObjectArrayImpl.java (added)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/OutObjectArrayImpl.java Sun Jan 30 20:19:46 2005
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR 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.encoding;
+
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OutObject;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+
+public class OutObjectArrayImpl implements OutObject{
+ private ContentHandler cHandler;
+ private Object[] obj = null;
+ private Encoder arrayTypeEncoder;
+
+ public OutObjectArrayImpl(Object[] obj,Encoder arrayTypeEncoder){
+ this.obj = obj;
+ this.arrayTypeEncoder = arrayTypeEncoder;
+ }
+ public ContentHandler getContentHandler() {
+ return cHandler;
+ }
+
+ public void setContentHandler(ContentHandler contentHandler) {
+ this.cHandler = contentHandler;
+ arrayTypeEncoder.setContentHandler(contentHandler);
+ }
+
+ public void startBuilding() throws OMException {
+ try {
+ for(int i = 0;i<obj.length;i++){
+ cHandler.startElement(OMConstants.ARRAY_ITEM_NSURI,OMConstants.ARRAY_ITEM_LOCALNAME,"",null);
+ arrayTypeEncoder.setObject(obj[i]);
+ arrayTypeEncoder.startBuilding();
+ cHandler.endElement(OMConstants.ARRAY_ITEM_NSURI,OMConstants.ARRAY_ITEM_LOCALNAME,"");
+ }
+ } catch (SAXException e) {
+ throw new OMException(e);
+ }
+
+ }
+
+ /**
+ * @return
+ */
+ public Encoder getArrayTypeEncoder() {
+ return arrayTypeEncoder;
+ }
+
+ /**
+ * @param encoder
+ */
+ public void setArrayTypeEncoder(Encoder encoder) {
+ arrayTypeEncoder = encoder;
+ }
+
+}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/SimpleTypeEncodingUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/SimpleTypeEncodingUtils.java?view=diff&r1=149212&r2=149213
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/SimpleTypeEncodingUtils.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/SimpleTypeEncodingUtils.java Sun Jan 30 20:19:46 2005
@@ -27,6 +27,34 @@
public class SimpleTypeEncodingUtils {
+
+ public static Object[] deserializeArray(XMLStreamReader xpp,Encoder encoder)throws AxisFault{
+ ArrayList objs = new ArrayList();
+
+ try{
+ int event = xpp.next();
+ while(true){
+ if(XMLStreamConstants.START_ELEMENT == event){
+ objs.add(encoder.deSerialize(xpp));
+ }else if(XMLStreamConstants.END_ELEMENT == event){
+ break;
+ }else if(XMLStreamConstants.END_DOCUMENT == event){
+ throw new AxisFault("premature and of file");
+ }
+ event = xpp.next();
+ }
+ Object[] vals = new Object[objs.size()];
+ for(int i = 0;i<objs.size();i++){
+ vals[i] = objs.get(i);
+ }
+ return vals;
+ } catch (XMLStreamException e) {
+ throw AxisFault.makeFault(e);
+ }
+
+ }
+
+
public static String[] deserializeStringArray(XMLStreamReader xpp)throws AxisFault{
ArrayList strings = new ArrayList();
@@ -35,9 +63,9 @@
while(true){
if(XMLStreamConstants.START_ELEMENT == event){
strings.add(deserializeString(xpp));
- }if(XMLStreamConstants.END_ELEMENT == event){
+ }else if(XMLStreamConstants.END_ELEMENT == event){
break;
- }if(XMLStreamConstants.END_DOCUMENT == event){
+ }else if(XMLStreamConstants.END_DOCUMENT == event){
throw new AxisFault("premature and of file");
}
event = xpp.next();
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/Dispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/Dispatcher.java?view=diff&r1=149212&r2=149213
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/Dispatcher.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/Dispatcher.java Sun Jan 30 20:19:46 2005
@@ -56,7 +56,8 @@
}
}
if (serviceName != null) {
- AxisService service = msgctx.getGlobalContext().getRegistry().getService(serviceName);
+ EngineRegistry registry = msgctx.getGlobalContext().getRegistry();
+ AxisService service = registry.getService(serviceName);
if (service != null) {
msgctx.setService(service);
//let add the Handlers
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/providers/SimpleJavaProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/providers/SimpleJavaProvider.java?view=diff&r1=149212&r2=149213
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/providers/SimpleJavaProvider.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/providers/SimpleJavaProvider.java Sun Jan 30 20:19:46 2005
@@ -44,10 +44,10 @@
public class SimpleJavaProvider extends AbstractProvider implements Provider {
protected Log log = LogFactory.getLog(getClass());
- private QName name;
- private String scope;
- private Method method;
- private ClassLoader classLoader;
+ protected QName name;
+ protected String scope;
+ protected Method method;
+ protected ClassLoader classLoader;
public SimpleJavaProvider() {
scope = Constants.APPLICATION_SCOPE;
@@ -100,7 +100,8 @@
while(it.hasNext()){
OMNode node = (OMNode)it.next();
if(node.getType() == OMNode.ELEMENT_NODE){
- return deserializeParameters(((OMElement)node).getPullParser(true),method);
+ Object[] objs = deserializeParameters(((OMElement)node).getPullParser(true),method);
+ return objs;
}
}
return null;
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/receivers/InOutSyncReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/receivers/InOutSyncReceiver.java?view=diff&r1=149212&r2=149213
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/receivers/InOutSyncReceiver.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/receivers/InOutSyncReceiver.java Sun Jan 30 20:19:46 2005
@@ -49,7 +49,9 @@
public void invokeAndsend(MessageContext msgContext) throws AxisFault {
Provider provider = msgContext.getService().getProvider();
- MessageContext outMsgContext = provider.invoke(msgContext);
+ log.info("start invoke the web service impl");
+ MessageContext outMsgContext = provider.invoke(msgContext);
+ log.info("Invoked the Web Servivces impl");
Sender sender = new Sender();
sender.send(msgContext);
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.java?view=diff&r1=149212&r2=149213
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.java Sun Jan 30 20:19:46 2005
@@ -20,6 +20,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
+import java.net.ServerSocket;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
@@ -509,6 +510,28 @@
*/
public AxisEngine getEngine() {
return engine;
+ }
+
+ public static void main(String[] args) throws Exception{
+ if(args.length != 2){
+ System.out.println("SimpeHttpReciver repositoryLocation port");
+ }
+ SimpleHTTPReceiver reciver = new SimpleHTTPReceiver(args[0]);
+
+ ServerSocket serverSoc = null;
+ serverSoc = new ServerSocket(Integer.parseInt(args[1]));
+ reciver.setServerSocket(serverSoc);
+ Thread thread = new Thread(reciver);
+ thread.setDaemon(true);
+
+ try {
+ thread.start();
+ System.in.read();
+ } finally {
+ reciver.stop();
+
+ }
+
}
}