Examples of RuleServiceManagementException


Examples of org.wso2.carbon.rule.service.RuleServiceManagementException

     */
    protected String createServiceRepository(AxisConfiguration axisConfig) {
        String repository = axisConfig
                .getRepository().getPath();
        if (CarbonUtils.isURL(repository)) {
            throw new RuleServiceManagementException(
                    "Uploading services to URL repo is not supported ", log);
        }

        String servicesDir = repository + File.separator +
                RuleConstants.RULE_SERVICE_REPOSITORY_NAME;
View Full Code Here

Examples of org.wso2.carbon.rule.service.RuleServiceManagementException

    protected String getServicePath(AxisConfiguration axisConfig, String serviceName) {
        AxisService axisService;
        try {
            axisService = axisConfig.getService(serviceName);
        } catch (AxisFault axisFault) {
            throw new RuleServiceManagementException(
                    "Error accessing rule service with name " + serviceName, log);
        }
        String servicePath = null;
        if (axisService != null) {
            Parameter servicePathParameter =
View Full Code Here

Examples of org.wso2.carbon.rule.service.RuleServiceManagementException

        InputStream inputStream = null;
        try {
            inputStream = new FileInputStream(ruleFile);
            OMElement omElement = OMElementHelper.getInstance().toOM(inputStream);
            if (omElement == null) {
                throw new RuleServiceManagementException("Cannot create an XML representation for" +
                        " the file in the service : " + serviceName + ". File was :" + ruleFile,
                        log);
            }
            omElement.detach();
            return omElement;

        } catch (FileNotFoundException e) {
            throw new RuleServiceManagementException("Cannot find the file : " + ruleFile + " ," +
                    " belongs to rule service with name : " + serviceName, log);
        } finally {
            if (inputStream != null) {
                try {
                    inputStream.close();
View Full Code Here

Examples of org.wso2.carbon.rule.service.RuleServiceManagementException

                        ServiceDescriptionSerializer.serializeToServiceXML(
                                ruleServiceDescription, parent, AXIOM_XPATH_SERIALIZER);
                servicesXML.build();
                servicesXML.serialize(os);
            } catch (Exception e) {
                throw new RuleServiceManagementException("Cannot write services XML", e, log);
            }

        } else {
            if (serviceXMLFile.exists()) {
                serviceXMLFile.delete();
            }
        }

        String rslFileName = ruleServiceDescription.getName() + "." +
                RuleConstants.RULE_FILE_EXTENSION;
        File ruleFile = new File(paths.getWorkingDirPath() + File.separator + "META-INF" +
                File.separator + rslFileName);
        File absoluteFile = ruleFile.getAbsoluteFile();
        if (absoluteFile.exists()) {
            absoluteFile.delete();
        }
        try {
            absoluteFile.createNewFile();
        } catch (IOException e) {
            throw new RuleServiceManagementException("Error creating a rule service file : " +
                    absoluteFile, log);
        }

        try {
            OutputStream os = new FileOutputStream(ruleFile);
            OMElement ruleServiceXML =
                    ServiceDescriptionSerializer.serializeToRuleServiceConfiguration(
                            ruleServiceDescription, NULL_NS,
                            AXIOM_XPATH_SERIALIZER, CONFIGURATION_EXTENSION_SERIALIZER);
            ruleServiceXML.build();
            ruleServiceXML.serialize(os);
        } catch (Exception e) {
            throw new RuleServiceManagementException("Cannot write to the rule service file : " +
                    ruleFile, e, log);
        }

        ArchiveManipulator archiveManipulator = new ArchiveManipulator();
        try {
            String servicePath = paths.getServicePath();
            if (!servicePath.endsWith(RuleConstants.RULE_SERVICE_ARCHIVE_EXTENSION)) {
                File serviceFile = new File(servicePath);
                File absoluteServiceFile = serviceFile.getAbsoluteFile();
                if (absoluteServiceFile.exists()) {
                    absoluteServiceFile.delete();
                }
                servicePath = servicePath.substring(0, servicePath.lastIndexOf(".") + 1) +
                        RuleConstants.RULE_SERVICE_ARCHIVE_EXTENSION;
            }
            archiveManipulator.archiveDir(servicePath, paths.getWorkingDirPath());
        } catch (IOException e) {
            throw new RuleServiceManagementException("Error creating a archive a rule service ", e,
                    log);
        }
//        saveToRegistry(paths, ruleServiceDescription.getName());
        cleanUp(paths);
    }
View Full Code Here

Examples of org.wso2.carbon.rule.service.RuleServiceManagementException

            final FileOutputStream fos = new FileOutputStream(factFile);
            dataHandler.writeTo(fos);
            fos.flush();
            fos.close();
        } catch (IOException e) {
            throw new RuleServiceManagementException("Cannot write facts", e, log);
        }
        ArchiveManipulator archiveManipulator = new ArchiveManipulator();
        try {
            String[] strings = archiveManipulator.check(factFile.getAbsolutePath());
            List<String> list = filterClasses(strings);
            return list.toArray(new String[list.size()]);
        } catch (IOException e) {
            throw new RuleServiceManagementException("Cannot extractPayload classes from the fact" +
                    " file", e, log);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.rule.service.RuleServiceManagementException

            final FileOutputStream fos = new FileOutputStream(factFile);
            dataHandler.writeTo(fos);
            fos.flush();
            fos.close();
        } catch (IOException e) {
            throw new RuleServiceManagementException("Cannot write Rule File", e, log);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.rule.service.RuleServiceManagementException

                try {
                    String[] strings =
                            new ArchiveManipulator().check(file.getAbsolutePath());
                    facts.addAll(filterClasses(strings));
                } catch (IOException e) {
                    throw new RuleServiceManagementException("Cannot extractPayload classes from " +
                            "the fact file", e, log);
                }
            }
        }
        if(facts.contains("dom")){
View Full Code Here

Examples of org.wso2.carbon.rule.service.RuleServiceManagementException

                servicePath.endsWith(RuleConstants.RULE_SERVICE_ARCHIVE_EXTENSION)) {
            ArchiveManipulator manipulator = new ArchiveManipulator();
            try {
                manipulator.extractFromStream(new FileInputStream(sourceFile), targetDirectory);
            } catch (IOException e) {
                throw new RuleServiceManagementException(
                        "Error extracting files from a source:  " + sourceFile +
                                " into destination : " + targetDirectory, log);
            }
        } else {
            new File(targetDirectory).mkdirs();
View Full Code Here

Examples of org.wso2.carbon.rule.service.RuleServiceManagementException

        return classes;
    }

    private String getClassNameFromResourceName(String resourceName) {
        if (!resourceName.endsWith(".class")) {
            throw new RuleServiceManagementException("The resource name doesn't refer to" +
                    " a class file", log);
        }
        return resourceName.substring(0, resourceName.length() - 6).replace('/', '.');
    }
View Full Code Here

Examples of org.wso2.carbon.rule.service.RuleServiceManagementException

        validateRuleServiceDescription(serviceDescription, serviceXML);
        AxisConfiguration axisConfig = getAxisConfig();
        try {
            AxisService axisService = axisConfig.getService(name);
            if (axisService != null) {
                throw new RuleServiceManagementException("There is already a service " +
                        "with the given name : " + name, log);
            }
            RuleServiceAdminHandler adminHandler = getRuleServiceAdminHandler(fileExtension);
            adminHandler.saveRuleService(getAxisConfig(), axisService, serviceDescription);
        } catch (AxisFault axisFault) {
            throw new RuleServiceManagementException("Error while accessing " +
                    "the service with the name : " + name, axisFault, log);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.