Package org.apache.axis2.description

Examples of org.apache.axis2.description.AxisServiceGroup


     * @throws ServerException
     */
    public ParameterMetaData getServiceGroupParameter(String serviceGroupName, String paramName)
            throws ServerException {

        AxisServiceGroup serviceGroup = null;

        try {
            serviceGroup = getAxisConfig().getServiceGroup(serviceGroupName);
            Parameter parameter = serviceGroup.getParameter(paramName);

            if (parameter == null) {
                return null;
            }

View Full Code Here


     * @throws AxisFault
     */
    public void setServiceGroupParameter(String serviceGroupId, String parameterElement)
            throws AxisFault {

        AxisServiceGroup axisServiceGroup = getAxisConfig().getServiceGroup(serviceGroupId);

        OMElement param = null;
        try {
            XMLStreamReader xmlSR = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(
                    parameterElement.getBytes()));
            param = new StAXOMBuilder(xmlSR).getDocumentElement();
        } catch (XMLStreamException e) {
            String msg = "Cannot create OMElement from parameter: " + parameterElement;
            log.error(msg, e);
            throw new AxisFault(msg, e);
        }

        Parameter parameter = ParameterUtil.createParameter(param);
        if (axisServiceGroup.getParameter(parameter.getName()) != null) {
            if (!axisServiceGroup.getParameter(parameter.getName()).isLocked()) {
                axisServiceGroup.addParameter(parameter);
            }
        } else {
            axisServiceGroup.addParameter(parameter);
        }

        try {
            persistenceManager.updateServiceGroupParameter(axisServiceGroup, parameter);
        } catch (Exception e) {
View Full Code Here

     * @param parameterName
     * @throws AxisFault
     */
    public void removeServiceGroupParameter(String serviceGroupId, String parameterName)
            throws AxisFault {
        AxisServiceGroup axisServiceGroup = getAxisConfig().getServiceGroup(serviceGroupId);

        if (axisServiceGroup == null) {
            throw new AxisFault("invalid service group name service group not found" +
                                serviceGroupId);
        }

        axisServiceGroup.removeParameter(ParameterUtil.createParameter(parameterName, null));
    }
View Full Code Here

                             + "The repository in use is " + axis2Repo;
            log.error(message);
            throw new AxisFault(message);
        }
        String uuid = String.valueOf(System.currentTimeMillis() + Math.random()) + ".aar";
        AxisServiceGroup axisServiceGroup = configurationContext.getAxisConfiguration()
                .getServiceGroup(serviceGroupName);
        if (axisServiceGroup == null) {
            String error = "Service group " + serviceGroupName + " not found!";
            log.error(error);
            throw new AxisFault(error);
        }

        //TODO until a proper way to find the service type from Axis2, following workaround has
        // TODO been applied to JIRA - 378
        if (serviceGroupName.indexOf(".jar") > -1 || serviceGroupName.indexOf(".class") > -1) {
            String message = "Archive creation not supported for " + serviceGroupName;
            log.error(message);
            throw new AxisFault(message);
        }
        URL axisServiceGroupURL = null;
        // Filtering axis1 services and data services from creating archives
        //TODO AxisServiceGroup should have a getFileURL method;
        for (Iterator iterator = axisServiceGroup.getServices(); iterator.hasNext();) {
            AxisService as = (AxisService) iterator.next();
            for (Parameter parameter : as.getParameters()) {
                String name = parameter.getName();

                Object obj = parameter.getValue();
                String value = "";
                if (obj != null) {
                    value = obj.toString();
                }
                if (name.equals("serviceType")
                    && (value.equals("axis1") ||
                        value.equals("data_service") ||
                        value.equals("jaxws") ||
                        value.equals("proxy") ||
                        value.equals("bpel") ||
                        value.equals("bpelmgt"))) {
                    String message = "WSO2 Carbon does not "
                                     + "support creating archive for " + value + " services.";
                    log.warn(message);
                    throw new AxisFault(message);
                }
            }

            if (axisServiceGroupURL == null) {
                if (as.getFileName() == null) {
                    String msg = "Request to create a service archive file for a " +
                                 "service group not found in side repo";
                    log.warn(msg);
                    throw new AxisFault(msg);
                }
                axisServiceGroupURL = as.getFileName();
            }
        }

        if (axisServiceGroupURL == null) {
            String error = ServiceArchiveCreator.class.getName() + " AxisServiceGroup "
                           + serviceGroupName + " location couldn't be found.";
            log.error(error);
            throw new AxisFault(error);
        }

        String workdir = (String) configurationContext.getProperty(ServerConstants.WORK_DIR);
        if (workdir == null) {
            String msg = "Work dir does not exist. Please make sure that the " +
                         ServerConstants.WORK_DIR + " property points to a proper workdir.";
            log.error(msg);
            throw new AxisFault(msg);
        }
        File f = new File(workdir + File.separator + "dump_aar" + File.separator + uuid);
        if (!f.exists() && !f.mkdirs()) {
            log.warn("Could not create " + f.getAbsolutePath());
        }

        try {

            File file = new File(axisServiceGroupURL.getPath());
            ArchiveManipulator am = new ArchiveManipulator();
            if (file.isDirectory()) {
                FileManipulator.copyDir(file, f);
            } else if (file.isFile() && axisServiceGroupURL.getPath().endsWith(".class")) {
                FileManipulator.copyFileToDir(file, f);
            } else {
                am.extract(axisServiceGroupURL.getPath(), f.getAbsolutePath());
            }

            File servicesF =
                    new File(f.getAbsolutePath() + File.separator + "META-INF", "services.xml");

            String servicesXmlPath = servicesF.getAbsolutePath();
            // delete the existing services.xml file
            if (servicesF.exists() && !servicesF.delete()) {
                log.warn("Could not delete the existing services.xml at : " +
                        servicesF.getAbsolutePath());
            }
            // create the new serices.xml file using the created xml infoset
            File newServicesXml = new File(servicesXmlPath);
            OMElement axisServiceGroupXMLInfoset = createServiceGroupXMLInfoset(axisServiceGroup);
            OutputStream os = new FileOutputStream(newServicesXml);
            axisServiceGroupXMLInfoset.serializeAndConsume(os);

            File[] oldWsdls = f.listFiles(new FileFilter() {
                public boolean accept(File fw) {
                    return fw.getName().endsWith(".wsdl");
                }
            });

            if (oldWsdls != null) {
                for (int i = 0; i < oldWsdls.length; i++) {
                    File oldWsdl = oldWsdls[i];
                    if (oldWsdl.exists() && !oldWsdl.delete()) {
                        log.warn("Could not delete " + oldWsdl.getAbsolutePath());
                    }
                }
            }
            //Creating wsdls
            for (Iterator iterator = axisServiceGroup.getServices(); iterator.hasNext();) {
                AxisService axisService = (AxisService) iterator.next();

                boolean isRpcMessageReceiver = false;
                for (Iterator ops = axisService.getOperations(); ops.hasNext();) {
                    MessageReceiver receiver =
View Full Code Here

        serializeParameterList(serviceParameterList, serviceEle, fac, ns);

        //service level engaged modules.
        Collection serviceEngagedModuleCollection = axisService.getEngagedModules();
        AxisDescription parent = axisService.getParent();
        AxisServiceGroup asg = (AxisServiceGroup) parent;
        Collection asgEngagedModulesCollection = asg.getEngagedModules();
        List asOnlyModuleList = new ArrayList();
        for (Iterator iterator = serviceEngagedModuleCollection.iterator(); iterator.hasNext();) {
            AxisModule axisModule = (AxisModule) iterator.next();
            if (asgEngagedModulesCollection.contains(axisModule.getName())) {
                continue;
View Full Code Here

                    configurationName));

        serverManager.init(configurationInformation, contextInfo);
        serverManager.start();

        AxisServiceGroup serviceGroup = axisConf.getServiceGroup(
                SynapseConstants.SYNAPSE_SERVICE_NAME);
        serviceGroup.addParameter("hiddenService", "true");

        addDeployers(configurationContext);

        return contextInfo;
    }
View Full Code Here

        for (Object serviceParam : serviceParams) {
            Parameter parameter = (Parameter) serviceParam;
            allParameters.add(parameter.getParameterElement().toString());
        }

        AxisServiceGroup axisServiceGroup = (AxisServiceGroup) service.getParent();
        ArrayList serviceGroupParams = axisServiceGroup.getParameters();

        for (Object serviceGroupParam : serviceGroupParams) {
            Parameter parameter = (Parameter) serviceGroupParam;
            allParameters.add(parameter.getParameterElement().toString());
        }
View Full Code Here

                    // With the change to the deployment mechanism in axis2 now it checks weather a
                    // transport is active before displaying it in the WSDL. This check needs access
                    // to the AxisConfiguration, and it it is null it returns false. Hence we have
                    // to put in a hck here to get the conversion to work correctly.
                    MessageContext messageContext = MessageContext.getCurrentMessageContext();
                    AxisServiceGroup axisServiceGroup = new AxisServiceGroup();
                    axisServiceGroup.setParent(
                            messageContext.getConfigurationContext().getAxisConfiguration());
                    service.setParent(axisServiceGroup);
                    service.printWSDL2(outStream);
                } else if (WSDL2Constants.WSDL_NAMESPACE
                        .equals(documentElementNS.getNamespaceURI())) {
View Full Code Here

            serverManager.init(configurationInformation, contextInfo);
            serverManager.start();


            AxisServiceGroup serviceGroup = axisConf.getServiceGroup(
                    SynapseConstants.SYNAPSE_SERVICE_NAME);
            serviceGroup.addParameter("hiddenService", "true");

            return contextInfo;

        } else {
            handleFatal("Couldn't initialize Synapse, " +
View Full Code Here

            if (DefaultAppDeployer.AAR_TYPE.equals(type) ||
                    DefaultAppDeployer.JAXWS_TYPE.equals(type) ||
                    DefaultAppDeployer.DS_TYPE.equals(type)) {

                AxisServiceGroup sg;
                if (instanceName == null) {
                    sg = findServiceGroupForArtifact(artifact);
                    if (sg != null) {
                        // set the instance name in Artifact so that we don't have to find it
                        // next time
                        artifact.setRuntimeObjectName(sg.getServiceGroupName());
                    }
                } else {
                    sg = getAxisConfig().getServiceGroup(instanceName);
                }

                if (sg == null) {
                    continue;
                }
                // set the service group name
                ServiceGroupMetadata sgMetadata = new ServiceGroupMetadata();
                sgMetadata.setSgName(sg.getServiceGroupName());
                sgMetadata.setSgType(type);

                // find services in the service group
                List<String> services = new ArrayList<String>();
                for (Iterator serviceIter = sg.getServices(); serviceIter.hasNext();) {
                    AxisService axisService = (AxisService) serviceIter.next();
                    // ignore if this is a client side serivce
                    if (axisService.isClientSide()) {
                        break;
                    }
View Full Code Here

TOP

Related Classes of org.apache.axis2.description.AxisServiceGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.