Package org.apache.slide.util.conf

Examples of org.apache.slide.util.conf.Configuration


            factory.setNamespaceAware(false);
            factory.setValidating(false);
            SAXParser parser = factory.newSAXParser();
           
            Populate pop = new Populate();
            Configuration configuration = new ConfigurationElement
                (pop.load(new InputSource(reader), parser.getXMLReader()));
           
            importData(token, configuration);
           
        } catch (javax.xml.parsers.FactoryConfigurationError e) {
View Full Code Here


       
        Enumeration contentInteceptorsDef =
            config.getConfigurations("content-interceptor");
        try {
            while (contentInteceptorsDef.hasMoreElements()) {
                Configuration contentInterceptorDef =
                    (Configuration) contentInteceptorsDef.nextElement();
                String classname = contentInterceptorDef.getAttribute("class");
               
                // Load contentInterceptor parameters
                Enumeration contentInterceptorParametersDef =
                    contentInterceptorDef.getConfigurations("parameter");
                Hashtable contentInterceptorParameters = new Hashtable();
                while (contentInterceptorParametersDef.hasMoreElements()) {
                    Configuration parameterDefinition = (Configuration)
                        contentInterceptorParametersDef.nextElement();
                    String parameterName =
                        parameterDefinition.getAttribute("name");
                    String parameterValue = parameterDefinition.getValue();
                    contentInterceptorParameters.put(parameterName,
                                                     parameterValue);
                }
               
                try {
View Full Code Here

        defaultProperties = new Hashtable();
        Enumeration defaultPropertiesDef =
            config.getConfigurations("default-property");
        try {
            while (defaultPropertiesDef.hasMoreElements()) {
                Configuration defaultProperty =
                    (Configuration) defaultPropertiesDef.nextElement();
                String name = defaultProperty.getAttribute("name");
                String value = defaultProperty.getAttribute("value", "");
                String propertyNamespace = defaultProperty.getAttribute
                    ("namespace", NodeProperty.DEFAULT_NAMESPACE);
                String role = defaultProperty.getAttribute("role");
                addDefaultProperty(role, name, value, propertyNamespace);
            }
        } catch (ConfigurationException e) {
            throw new InvalidNamespaceConfigurationException
                (namespace, e.getMessage());
View Full Code Here

    private void setParameters(Configuration config, Namespace namespace) throws InvalidNamespaceConfigurationException {
        parameters = new Hashtable();
        Enumeration parametersDef = config.getConfigurations("parameter");
        try {
            while (parametersDef.hasMoreElements()) {
                Configuration parameter =
                    (Configuration) parametersDef.nextElement();
                addParameter(parameter.getAttribute("name"),
                             parameter.getValue());
            }
        } catch (ConfigurationException e) {
            throw new InvalidNamespaceConfigurationException
                (namespace, e.getMessage());
        }
View Full Code Here

        // Note : the base role should be the last one.
        addRoleMapping(NOBODY, BASE_ROLE);
        Enumeration roleMappingsDef = config.getConfigurations("role");
        try {
            while (roleMappingsDef.hasMoreElements()) {
                Configuration roleMappingDef =
                    (Configuration) roleMappingsDef.nextElement();
                addRoleMapping(roleMappingDef.getAttribute("name"),
                               roleMappingDef.getValue());
            }
        } catch (ConfigurationException e) {
            throw new InvalidNamespaceConfigurationException
                (namespace, e.getMessage());
        }
View Full Code Here

            // We've made sure that the object exists.
            // We now parse the permissions definition list, adding each
            // permission to the object's permission list.
            while (permissionDefinitions.hasMoreElements()) {
               
                Configuration permissionDefinition =
                    (Configuration) permissionDefinitions.nextElement();
                // Create the NodePermission object matching the Castor object
               
                String subjectUri =
                    permissionDefinition.getAttribute("subject");
               
                if (accessToken.getNamespaceConfig().getUsersPath().equals(subjectUri)) {
                    subjectUri = SubjectNode.ALL_URI;
                }
               
                String actionUri =
                    permissionDefinition.getAttribute("action");
               
                if (accessToken.getNamespaceConfig().getActionsPath().equals(actionUri)) {
                    actionUri = ActionNode.ALL_URI;
                }
               
                boolean inheritable = true;
               
                try {
                    if (permissionDefinition.getAttribute("inheritable")
                        .equals("false")) {
                        inheritable = false;
                    }
                } catch (ConfigurationException e) {
                }
               
                boolean negative = false;
               
                try {
                    if (permissionDefinition.getAttribute("negative")
                        .equals("true")) {
                        negative = true;
                    }
                } catch (ConfigurationException e) {
                }
               
                NodePermission permission = new NodePermission
                    (uri, subjectUri, actionUri, inheritable, negative);
               
                // Adding the NodePermission to the ObjectNode
                accessToken.getSecurityHelper()
                    .grantPermission(token, permission);
               
            }
           
            // Retrieve the list of revisions of the object
            Enumeration revisionDefinitions =
                objectDefinition.getConfigurations("revision");
            boolean revisionDefinitionsFound = false;
           
            // We parse the revision definition list
            while (revisionDefinitions.hasMoreElements()) {
               
                revisionDefinitionsFound = true;
                Configuration revisionDefinition =
                    (Configuration) revisionDefinitions.nextElement();
                loadObjectRevision(accessToken, token, uri,
                                   revisionDefinition);
               
            }
           
            if (!revisionDefinitionsFound) {
                loadDefaultObjectRevision(accessToken, token, uri);
            }
           
           
        } catch (ObjectNotFoundException e) {
            // Should NEVER happen
            accessToken.getLogger().log(e,LOG_CHANNEL,Logger.WARNING);
            accessToken.getLogger().log
                (e.toString(),LOG_CHANNEL,Logger.WARNING);
        } catch (VetoException e) {
            accessToken.getLogger().log(e,LOG_CHANNEL,Logger.WARNING);
            accessToken.getLogger().log(e.toString(),LOG_CHANNEL,Logger.WARNING);
        } catch (LinkedObjectNotFoundException e) {
            // Icorrect link
            accessToken.getLogger().log(e,LOG_CHANNEL,Logger.WARNING);
            accessToken.getLogger().log
                ("Incorrect link found while creating " + uri,
                 LOG_CHANNEL,Logger.WARNING);
        } catch (AccessDeniedException e) {
            // Security exception
            accessToken.getLogger().log
                ("Insufficient credentials to create object",
                 LOG_CHANNEL,Logger.INFO);
        } catch (ObjectLockedException e) {
            // Lock exception
            accessToken.getLogger().log
                ("Lock-Token required",
                 LOG_CHANNEL,Logger.INFO);
        }
       
       
        Enumeration childConfigurations =
            objectDefinition.getConfigurations("objectnode");
       
        while(childConfigurations.hasMoreElements()) {
            Configuration childConfiguration =
                (Configuration) childConfigurations.nextElement();
            loadObjectNode(accessToken, token, childConfiguration);
        }
       
    }
View Full Code Here

            SAXParserFactory factory = SAXParserFactory.newInstance();
            factory.setNamespaceAware(false);
            factory.setValidating(false);
            SAXParser parser = factory.newSAXParser();
            Populate pop = new Populate();
            Configuration slideConfiguration =
                new ConfigurationElement(
                pop.load(
                                            new InputSource(
                            new StringReader("<revision/>")), parser.getXMLReader()));
            loadObjectRevision(accessToken, token, uri, slideConfiguration);
View Full Code Here

        if (revisionDescriptor == null) {
            revisionDescriptor = new NodeRevisionDescriptor(0);
        }
       
        while (propertyDefinitions.hasMoreElements()) {
            Configuration propertyDefinition =
                (Configuration) propertyDefinitions.nextElement();
            String propertyName = propertyDefinition.getAttribute("name");
            String propertyValue = propertyDefinition.getValue();
            String propertyNamespace = propertyDefinition.getAttribute
                ("namespace", NodeProperty.DEFAULT_NAMESPACE);
            NodeProperty property = revisionDescriptor.getProperty
                (propertyName, propertyNamespace);
            if (property == null)
                revisionDescriptor.setProperty(propertyName, propertyNamespace,
View Full Code Here

        SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setNamespaceAware(false);
        factory.setValidating(false);
        SAXParser parser = factory.newSAXParser();
        Populate pop = new Populate();
        Configuration slideConfiguration =
            new ConfigurationElement(pop.load(new InputSource
                                                  (configurationInputStream), parser.getXMLReader()));
       
        Domain.init(slideConfiguration);
       
View Full Code Here

       
        // Loading domain parameters
        Enumeration parametersEnum =
            configuration.getConfigurations("parameter");
        while( parametersEnum.hasMoreElements() ) {
            Configuration p = (Configuration)parametersEnum.nextElement();
            parameters.put( p.getAttribute("name"), p.getValue() );
        }
        info( "Domain parameters: "+String.valueOf(parameters) );
       
        // Loading namespaces
        Enumeration namespaceDefinitions =
            configuration.getConfigurations("namespace");
       
        while (namespaceDefinitions.hasMoreElements()) {
           
            initNamespace((Configuration) namespaceDefinitions.nextElement());
           
        }
       
        if (namespaces.isEmpty()) {
            throw new DomainInitializationFailedError();
        }
       
        namespacesInitialized = true;

        Enumeration extractorConfigurations = configuration.getConfigurations("extractors");
        if ( extractorConfigurations.hasMoreElements() ) {
            Configuration extractorConfiguration = (Configuration)extractorConfigurations.nextElement();
            ExtractorManager.getInstance().configure(extractorConfiguration);
        }

        Enumeration eventConfigurations = configuration.getConfigurations("events");
        if ( eventConfigurations.hasMoreElements() ) {
            Configuration eventConfiguration = (Configuration)eventConfigurations.nextElement();
            EventDispatcher.getInstance().configure(eventConfiguration);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.slide.util.conf.Configuration

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.