blob: daf3f777338239d60c34f130e96b44277d9c2ce8 [file] [log] [blame]
/*
* Copyright 2003-2004 The Apache Software Foundation.
// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author Srinath Perera(hemapani@openource.lk)
* @author Susantha Kumara(susantha@opensource.lk, skumara@virtusa.com)
*/
package org.apache.axis.wsdl.wsdl2ws.cpp.literal;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import org.apache.axis.wsdl.wsdl2ws.CUtils;
import org.apache.axis.wsdl.wsdl2ws.WrapperFault;
import org.apache.axis.wsdl.wsdl2ws.info.Type;
import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
public class ServiceHeaderWriter
extends org.apache.axis.wsdl.wsdl2ws.cpp.ServiceHeaderWriter
{
public ServiceHeaderWriter(WebServiceContext wscontext) throws WrapperFault
{
super(wscontext);
}
/* (non-Javadoc)
* @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writeAttributes()
*/
protected void writeAttributes() throws WrapperFault
{}
/* (non-Javadoc)
* @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writeClassComment()
*/
protected void writeClassComment() throws WrapperFault
{
try
{
c_writer.write("/*\n");
c_writer.write(" * Copyright 2003-2006 The Apache Software Foundation.\n\n");
c_writer.write(" *\n");
c_writer.write(" * Licensed under the Apache License, Version 2.0 (the \"License\");\n");
c_writer.write(" * you may not use this file except in compliance with the License.\n");
c_writer.write(" * You may obtain a copy of the License at\n");
c_writer.write(" *\n");
c_writer.write(" *\t\thttp://www.apache.org/licenses/LICENSE-2.0\n");
c_writer.write(" *\n");
c_writer.write(" * Unless required by applicable law or agreed to in writing, software\n");
c_writer.write(" * distributed under the License is distributed on an \"AS IS\" BASIS,\n");
c_writer.write(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
c_writer.write(" * See the License for the specific language governing permissions and\n");
c_writer.write(" * limitations under the License.\n");
c_writer.write(" *\n");
c_writer.write(" * This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)\n");
c_writer.write(" * This file contains declaration of the web service\n");
c_writer.write(" */\n\n");
}
catch (IOException e)
{
throw new WrapperFault(e);
}
}
/* (non-Javadoc)
* @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writePreprocssorStatements()
*/
protected void writePreprocessorStatements() throws WrapperFault
{
// TODO - remove and use parent class method
try
{
Type atype;
Iterator types = this.wscontext.getTypemap().getTypes().iterator();
HashSet typeSet = new HashSet();
HashSet removeSet = new HashSet();
c_writer.write("#include <axis/AxisUserAPI.hpp>\n");
c_writer.write("#include <axis/AxisUserAPIArrays.hpp>\n");
c_writer.write("#include <axis/ISoapAttachment.hpp>\n");
c_writer.write("#include \"AxisServiceException.hpp\" \n\n");
while (types.hasNext())
{
atype = (Type) types.next();
if (!atype.isExternalized())
continue;
typeSet.add(atype.getLanguageSpecificName());
if (atype.isRestriction())
removeSet.add(CUtils.getArrayNameForType(atype.getLanguageSpecificName()));
}
Iterator ritr = removeSet.iterator();
while (ritr.hasNext())
typeSet.remove(ritr.next());
Iterator itr = typeSet.iterator();
while (itr.hasNext())
{
c_writer.write(
"#include \"" + itr.next().toString() + CUtils.getHeaderFileExtension() + "\"\n");
}
//writeFaultHeaders();
c_writer.write("\n");
}
catch (IOException e)
{
throw new WrapperFault(e);
}
}
}