Package org.apache.turbine.services

Examples of org.apache.turbine.services.InitializationException


            File testDir = new File(testPath);
            if (!testDir.exists())
            {
                if (!testDir.mkdirs())
                {
                    throw new InitializationException(
                            "Could not create target directory!");
                }
            }
            repoPath = testPath;
            conf.setProperty(UploadService.REPOSITORY_KEY, repoPath);
View Full Code Here


        }
        catch (Exception e)
        {
            String errorMessage = "Could not initialize the scheduler service";
            log.error(errorMessage, e);
            throw new InitializationException(errorMessage, e);
        }
    }
View Full Code Here

            log.info("The instance id is #" + turbineId);
            setInit(true);
        }
        catch (Exception e)
        {
            throw new InitializationException(
                    "Could not initialize TurbineUniqueId Service", e);
        }
    }
View Full Code Here

        }
        catch (Exception e)
        {
            if (persistentPeerClassName == null || persistentPeerClass == null)
            {
                throw new InitializationException(
                    "Could not find PermissionPeer class ("
                    + persistentPeerClassName + ")", e);
            }
            if (tableName == null)
            {
                throw new InitializationException(
                    "Failed to get the table name from the Peer object", e);
            }

            if (permissionObject == null || permissionObjectName == null)
            {
                throw new InitializationException(
                    "Failed to get the object type from the Peer object", e);
            }


            if (nameColumn == null || namePropDesc == null)
            {
                throw new InitializationException(
                    "PermissionPeer " + persistentPeerClassName +
                    " has no name column information!", e);
            }
            if (idColumn == null || idPropDesc == null)
            {
                throw new InitializationException(
                    "PermissionPeer " + persistentPeerClassName +
                    " has no id column information!", e);
            }
        }
    }
View Full Code Here

            registerFactories(AssemblerBrokerService.PAGE_TYPE);
            registerFactories(AssemblerBrokerService.SCHEDULEDJOB_TYPE);
        }
        catch (TurbineException e)
        {
            throw new InitializationException(
                    "AssemblerBrokerService failed to initialize", e);
        }
        setInit(true);
    }
View Full Code Here

        }
        catch (Exception e)
        {
            if (groupPeerClassName == null || groupPeerClass == null)
            {
                throw new InitializationException(
                    "Could not find GroupPeer class ("
                    + groupPeerClassName + ")", e);
            }
            if (tableName == null)
            {
                throw new InitializationException(
                    "Failed to get the table name from the Peer object", e);
            }

            if (groupObject == null || groupObjectName == null)
            {
                throw new InitializationException(
                    "Failed to get the object type from the Peer object", e);
            }

            if (nameColumn == null || namePropDesc == null)
            {
                throw new InitializationException(
                    "GroupPeer " + groupPeerClassName + " has no name column information!", e);
            }
            if (idColumn == null || idPropDesc == null)
            {
                throw new InitializationException(
                    "GroupPeer " + groupPeerClassName + " has no id column information!", e);
            }
        }
    }
View Full Code Here

        }
        catch (Exception e)
        {
            String errorMessage = "Could not initialize the scheduler service";
            log.error(errorMessage, e);
            throw new InitializationException(errorMessage, e);
        }
    }
View Full Code Here

            String LOAD_ERROR = "No pathes for XML files were specified. " +
                    "Check that the property exists in " +
                    "TurbineResources.props and were loaded.";

            log.error(LOAD_ERROR);
            throw new InitializationException(LOAD_ERROR);
        }

        Set xmlFiles = new HashSet();

        long timeStamp = 0;

        for (Iterator it = xmlPathes.iterator(); it.hasNext();)
        {
            // Files are webapp.root relative
            String xmlPath = Turbine.getRealPath((String) it.next());
            File xmlFile = new File(xmlPath);

            log.debug("Path for XML File: " + xmlFile);

            if (!xmlFile.canRead())
            {
                String READ_ERR = "Could not read input file " + xmlPath;

                log.error(READ_ERR);
                throw new InitializationException(READ_ERR);
            }

            xmlFiles.add(xmlPath);

            log.debug("Added " + xmlPath + " as File to parse");

            // Get the timestamp of the youngest file to be compared with
            // a serialized file. If it is younger than the serialized file,
            // then we have to parse the XML anyway.
            timeStamp =
                    (xmlFile.lastModified() > timeStamp) ? xmlFile.lastModified() : timeStamp;
        }

        Map serializedMap = loadSerialized(serialDataPath, timeStamp);

        if (serializedMap != null)
        {
            // Use the serialized data as XML groups. Don't parse.
            appDataElements = serializedMap;
            log.debug("Using the serialized map");
        }
        else
        {
            // Parse all the given XML files
            appDataElements = new HashMap();

            for (Iterator it = xmlFiles.iterator(); it.hasNext();)
            {
                String xmlPath = (String) it.next();
                AppData appData = null;

                log.debug("Now parsing: " + xmlPath);
                try
                {
                    XmlToAppData xmlApp = new XmlToAppData();
                    appData = xmlApp.parseFile(xmlPath);
                }
                catch (Exception e)
                {
                    log.error("Could not parse XML file " + xmlPath, e);

                    throw new InitializationException("Could not parse XML file " +
                            xmlPath, e);
                }

                appDataElements.put(appData, xmlPath);
                log.debug("Saving appData for " + xmlPath);
            }

            saveSerialized(serialDataPath, appDataElements);
        }

        try
        {
            for (Iterator it = appDataElements.keySet().iterator(); it.hasNext();)
            {
                AppData appData = (AppData) it.next();               

                int maxPooledGroups = 0;
                List glist = appData.getGroups();

                String groupPrefix = appData.getGroupPrefix();

                for (int i = glist.size() - 1; i >= 0; i--)
                {
                    XmlGroup g = (XmlGroup) glist.get(i);
                    String groupName = g.getName();

                    boolean registerUnqualified = registerGroup(groupName, g, appData, true);

                    if (!registerUnqualified)
                    {
                        log.info("Ignored redefinition of Group " + groupName
                                + " or Key " + g.getKey()
                                + " from " + appDataElements.get(appData));
                    }

                    if (groupPrefix != null)
                    {
                        StringBuffer qualifiedName = new StringBuffer();
                        qualifiedName.append(groupPrefix)
                                .append(':')
                                .append(groupName);

                        // Add the fully qualified group name. Do _not_ check for
                        // the existence of the key if the unqualified registration succeeded
                        // (because then it was added by the registerGroup above).
                        if (!registerGroup(qualifiedName.toString(), g, appData, !registerUnqualified))
                        {
                            log.error("Could not register fully qualified name " + qualifiedName
                                    + ", maybe two XML files have the same prefix. Ignoring it.");
                        }
                    }

                    maxPooledGroups =
                            Math.max(maxPooledGroups,
                                    Integer.parseInt(g.getPoolCapacity()));

                }

                KeyedPoolableObjectFactory factory =
                        new Group.GroupFactory(appData);
                keyedPools.put(appData, new StackKeyedObjectPool(factory, maxPooledGroups));
            }

            setInit(true);
        }
        catch (Exception e)
        {
            throw new InitializationException(
                    "TurbineIntakeService failed to initialize", e);
        }
    }
View Full Code Here

        }
        catch (Exception e)
        {
            if (userPeerClassName == null || userPeerClass == null)
            {
                throw new InitializationException(
                    "Could not find UserPeer class ("
                    + userPeerClassName + ")", e);
            }
            if (tableName == null)
            {
                throw new InitializationException(
                    "Failed to get the table name from the Peer object", e);
            }

            if (userObject == null || userObjectName == null)
            {
                throw new InitializationException(
                    "Failed to get the object type from the Peer object", e);
            }


            if (nameColumn == null || namePropDesc == null)
            {
                throw new InitializationException(
                    "UserPeer " + userPeerClassName
                    + " has no name column information!", e);
            }
            if (idColumn == null || idPropDesc == null)
            {
                throw new InitializationException(
                    "UserPeer " + userPeerClassName
                    + " has no id column information!", e);
            }
            if (passwordColumn == null || passwordPropDesc == null)
            {
                throw new InitializationException(
                    "UserPeer " + userPeerClassName
                    + " has no password column information!", e);
            }
            if (firstNameColumn == null || firstNamePropDesc == null)
            {
                throw new InitializationException(
                    "UserPeer " + userPeerClassName
                    + " has no firstName column information!", e);
            }
            if (lastNameColumn == null || lastNamePropDesc == null)
            {
                throw new InitializationException(
                    "UserPeer " + userPeerClassName
                    + " has no lastName column information!", e);
            }
            if (emailColumn == null || emailPropDesc == null)
            {
                throw new InitializationException(
                    "UserPeer " + userPeerClassName
                    + " has no email column information!", e);
            }
            if (confirmColumn == null || confirmPropDesc == null)
            {
                throw new InitializationException(
                    "UserPeer " + userPeerClassName
                    + " has no confirm column information!", e);
            }
            if (createDateColumn == null || createDatePropDesc == null)
            {
                throw new InitializationException(
                    "UserPeer " + userPeerClassName
                    + " has no createDate column information!", e);
            }
            if (lastLoginColumn == null || lastLoginPropDesc == null)
            {
                throw new InitializationException(
                    "UserPeer " + userPeerClassName
                    + " has no lastLogin column information!", e);
            }
            if (objectdataColumn == null || objectdataPropDesc == null)
            {
                throw new InitializationException(
                    "UserPeer " + userPeerClassName
                    + " has no objectdata column information!", e);
            }
        }
    }
View Full Code Here

        factoryService = TurbineFactory.getService();
       
        if (factoryService == null)
        {
            throw new InitializationException("Factory Service is not configured"
                    + " but required for the Pool Service!");
        }
       
        setInit(true);
    }
View Full Code Here

TOP

Related Classes of org.apache.turbine.services.InitializationException

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.