Package com.sun.enterprise.admin.common.exception

Examples of com.sun.enterprise.admin.common.exception.DeploymentException


     */
    public static DeployableObjectType getTypeFromFile(String name, String filePath)
        throws DeploymentException {

        if(filePath == null)
            throw new DeploymentException("deploy file not specified");

        try {
            //@@@ special handling the deployment of .class POJO webservice
            //class. 
            if (filePath.endsWith(".class")) {
                // get the top directory from the moduleID, in the case of
                // autodeploy, the moduleID will be the full class name (with package)
                // with . replaced with _
                StringTokenizer tk = new StringTokenizer(name, "_");
                File f = new File(filePath);
                for (int i=0;i<tk.countTokens();i++) {
                    f = f.getParentFile();
                }
                try {
                    // it's important to not cache this because the class can
                    // change overtime... we need to load the last one.
                    URL[] urls = new URL[1];
                    urls[0] = f.toURL();
                    URLClassLoader cLoader = new URLClassLoader(urls,
                                DeploymentServiceUtils.class.getClassLoader());
                    String className = name.replaceAll("_", ".");
                    Class clazz = cLoader.loadClass(className);
                    if (clazz!=null && clazz.getAnnotation(javax.ejb.Stateless.class)!=null) {
                        return DeployableObjectType.EJB;
                    } else {
                        return DeployableObjectType.WEB;
                    }                   
                } catch(Exception e) {
                    sLogger.log(Level.WARNING, e.getMessage(), e);
                    return DeployableObjectType.WEB;
                }
            }

            Archivist archivist =
                ArchivistFactory.getArchivistForArchive(filePath);
            ModuleType moduleType = archivist.getModuleType();
            return getDeployableObjectType(moduleType);
        } catch (IOException ioe) {
            DeploymentException de = new DeploymentException(
                localStrings.getString(
                    "enterprise.deployment.ioexc_getting_archtype", filePath));
            de.initCause(ioe);
            throw de;
        } catch(Exception  ex) {
            DeploymentException de = new DeploymentException(
                localStrings.getString(
                    "enterprise.deployment.unknown.application.type", filePath));
            de.initCause(ex);
            throw de;
        }
    }
View Full Code Here


                if (isRegistered(name, depObjTypes[i])) {
                    return depObjTypes[i];
                }
            }
        }catch(Exception e){
            throw new DeploymentException(e.getMessage());
        }
        String msg = localStrings.getString(
            "enterprise.deployment.component.not.registered", name);
        throw new DeploymentException(msg);
    }
View Full Code Here

                    localStrings.getString( "admin.server.core.mbean.config.no_such_event",
                                            new Integer(eventType) );
                throw new RuntimeException( msg );
            }
        } catch (ConfigException ex) {
            DeploymentException de = new DeploymentException(ex.getMessage());
            de.initCause(ex);
            throw de;
        }

        //set target destination for the event
        if (targetName != null) {
            event.setTargetDestination(targetName);
        }

        if (event instanceof ApplicationDeployEvent
                || event instanceof ModuleDeployEvent) {
            AdminEventCache.populateConfigChange(getConfigContext(), event);
        }
       
        if (sLogger.isLoggable(Level.FINEST)) {
            sLogger.log(Level.FINEST, "mbean.event_sent", event.getEventInfo());
        } else {
            sLogger.log(Level.FINE, "mbean.send_event", event.toString());
        }

        AdminEventResult multicastResult =
                AdminEventMulticaster.multicastEvent(event);
        sLogger.log(Level.FINE, "mbean.event_res",
                multicastResult.getResultCode());
        sLogger.log(Level.FINE, "mbean.event_reply",
                multicastResult.getAllMessagesAsString());
        boolean eventSuccess = true;
            //ALREADY SET in Admin Event Multicaster
            //AdminEventCache cache =
            //        AdminEventCache.getInstance(mInstanceName);
            //cache.setRestartNeeded(true);

            // if there is an exception thrown when loading modules
            // rethrow the exception
            AdminEventListenerException ale = null;
            ale = multicastResult.getFirstAdminEventListenerException();
            if (ale != null) {
                sLogger.log(Level.WARNING, "mbean.event_failed",
                    ale.getMessage());
                DeploymentException de =
                    new DeploymentException(ale.getMessage());
                de.initCause(ale);
                throw de;
            }
        return eventSuccess;
    }
View Full Code Here

        status = deploy(props);
        for(int i = 1; i < targets.length; i++) {
            try {
                associateApplication(props, targets[i]);
            } catch(MBeanConfigException m) {
                DeploymentException e = new DeploymentException(m.getMessage());
                e.initCause(m);
                throw e;
            }
        }
        return status;
    }
View Full Code Here

        props.setProperty(DeploymentProperties.TARGET, targets[0]);
        for(int i = 1; i < targets.length; i++) {
            try {
                disassociateApplication(props, targets[i]);
            } catch (MBeanConfigException m) {
                DeploymentException e = new DeploymentException(m.getMessage());
                e.initCause(m);
                throw e;
            }
        }
        status = undeploy(props);
        return status;
View Full Code Here

     */
    public com.sun.enterprise.deployment.backend.DeploymentStatus undeploy(Properties props)
                                    throws DeploymentException {
        String name = props.getProperty(DeploymentProperties.NAME);
        if(name == null)                   
            throw new DeploymentException("name not specified in undeploy");
       
        sLogger.log(Level.FINE, "mbean.begin_undeploy", name);
        try {
                      
            DeployableObjectType objectType = getRegisteredType(name);
View Full Code Here

                sLogger.log(Level.WARNING, "mbean.deploy_failed", e);
            }
            else {
                sLogger.log(Level.WARNING, "mbean.redeploy_failed", e);
            }
            DeploymentException newE = new DeploymentException(e.getMessage());
            newE.initCause(e);
            throw newE;
        }
        finally {
            deleteFile(archiveName);
        }
View Full Code Here

                sLogger.log(Level.WARNING, "mbean.deploy_failed", e);
            }
            else {
                sLogger.log(Level.WARNING, "mbean.redeploy_failed", e);
            }
            throw new DeploymentException(e.getMessage());
        }
        finally {
            deleteFile(filePath);
        }
        return loadStatus;
View Full Code Here

                sLogger.log(Level.WARNING, "mbean.deploy_failed", e);
            }
            else {
                sLogger.log(Level.WARNING, "mbean.redeploy_failed", e);
            }
            throw new DeploymentException(e.getMessage());
        }
        finally {
            deleteFile(filePath);
        }
        return loadStatus;
View Full Code Here

                sLogger.log(Level.WARNING, "mbean.deploy_failed", e);
            }
            else {
                sLogger.log(Level.WARNING, "mbean.redeploy_failed", e);
            }
            throw new DeploymentException(e.getMessage());
        }
        finally {
            deleteFile(filePath);
        }
        return loadStatus;
View Full Code Here

TOP

Related Classes of com.sun.enterprise.admin.common.exception.DeploymentException

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.