Package org.wso2.carbon

Examples of org.wso2.carbon.CarbonException


    }

    private Writer getWriter(boolean append) throws CarbonException {
        jsFunction_createFile();
        if (reader != null) {
            throw new CarbonException(
                    "Cannot write to the already reading file. Please close the file beforehand by calling close().");
        }
        if (writer == null) {
            try {
                writer = new BufferedWriter(new FileWriter(file, append));
            } catch (IOException e) {
                throw new CarbonException(e);
            }
        }
        return writer;
    }
View Full Code Here


                                           boolean inNewExpr) throws CarbonException {
        if (args.length == 1) {
            if (args[0] instanceof Resource && !(args[0] instanceof Scriptable)) {
                return new ResourceHostObject((Resource) args[0], cx);
            } else if (args[0] instanceof Scriptable) {
                throw new CarbonException("Resource object cannot be initialized directly, " +
                                          "use registry.newResource() instead");
            } else {
                throw new CarbonException("Invalid argument type for Resource constructor");
            }
        } else {
            throw new CarbonException("Resource object cannot be initialized directly, use " +
                                      "registry.newResource() instead");
        }
    }
View Full Code Here

        ResourceHostObject resourceHostObject = (ResourceHostObject) thisObj;
        if (arguments.length == 2) {
            if (arguments[0] instanceof String && arguments[1] instanceof String) {
                resourceHostObject.resource.addProperty((String) arguments[0], (String) arguments[1]);
            } else {
                throw new CarbonException("Invalid argument types for addProperty() method");
            }
        } else {
            throw new CarbonException("Invalid no. of arguments for addProperty() method");
        }
    }
View Full Code Here

        ResourceHostObject resourceHostObject = (ResourceHostObject) thisObj;
        if (arguments.length == 1) {
            if (arguments[0] instanceof String) {
                return resourceHostObject.resource.getProperty((String) arguments[0]);
            } else {
                throw new CarbonException("Invalid argument type for getProperty() method");
            }
        } else {
            throw new CarbonException("Invalid no. of arguments for getProperty() method");
        }
    }
View Full Code Here

        ResourceHostObject resourceHostObject = (ResourceHostObject) thisObj;
        if (arguments.length == 1) {
            if (arguments[0] instanceof String) {
                return new NativeArray(resourceHostObject.resource.getPropertyValues((String) arguments[0]).toArray());
            } else {
                throw new CarbonException("Invalid argument type for getProperty() method");
            }
        } else {
            throw new CarbonException("Invalid no. of arguments for getProperty() method");
        }
    }
View Full Code Here

                property.put("value", property, properties.get(key));
                props.add(property);
            }
            return new NativeArray(props.toArray());
        } else {
            throw new CarbonException("getProperties() method doesn't accept arguments");
        }
    }
View Full Code Here

                arguments[2] instanceof String) {

                resourceHostObject.resource.editPropertyValue((String) arguments[0], (String) arguments[1],
                                                              (String) arguments[2]);
            } else {
                throw new CarbonException("Invalid argument types for editProperty() method");
            }
        } else {
            throw new CarbonException("Invalid no. of arguments for editProperty() method");
        }
    }
View Full Code Here

        ResourceHostObject resourceHostObject = (ResourceHostObject) thisObj;
        if (arguments.length == 1) {
            if (arguments[0] instanceof String) {
                resourceHostObject.resource.removeProperty((String) arguments[0]);
            } else {
                throw new CarbonException("Invalid argument type for removeProperty() method");
            }
        } else {
            throw new CarbonException("Invalid no. of arguments for removeProperty() method");
        }
    }
View Full Code Here

        ResourceHostObject resourceHostObject = (ResourceHostObject) thisObj;
        if (arguments.length == 2) {
            if (arguments[0] instanceof String && arguments[1] instanceof String) {
                resourceHostObject.resource.removePropertyValue((String) arguments[0], (String) arguments[1]);
            } else {
                throw new CarbonException("Invalid argument types for removePropertyValue() method");
            }
        } else {
            throw new CarbonException("Invalid no. of arguments for removePropertyValue() method");
        }
    }
View Full Code Here

                resourceHostObject.resource.setProperty((String) arguments[0], (String) arguments[1]);
            } else if (arguments[0] instanceof String && arguments[1] instanceof NativeArray) {
                resourceHostObject.resource.setProperty((String) arguments[0], (List) Context.jsToJava(
                        arguments[1], List.class));
            } else {
                throw new CarbonException("Invalid argument types for setProperty() method");
            }
        } else {
            throw new CarbonException("Invalid no. of arguments for setProperty() method");
        }
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.CarbonException

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.