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

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


        throws InstanceAlreadyExistsException, ControlException
    {
        if(isBadInstanceName(instanceName))
        {
            String msg = localStrings.getString( "admin.server.core.mbean.bad_instance_name", instanceName );
            throw new ControlException( msg );
        }
       
        ObjectName siObjectName =
            ObjectNames.getServerInstanceObjectName(instanceName);
        MBeanServer mbs = MBeanServerFactory.getMBeanServer();
        if (!mbs.isRegistered(siObjectName))
        {
            try
            {
                InstanceDefinition instance = new InstanceDefinition(instanceName,
                        hostPort.getPort());
                if (runAsUser != null)
                {
                    instance.setUser(runAsUser);
                }
                ServerManager.instance().createServerInstance(instance);
                sLogger.log(Level.INFO, "mbean.created_instance", instanceName);
            }
            catch (Exception e)
            {
                sLogger.log(Level.WARNING, "mbean.create_instance_failed", e);
                throw new ControlException(e.getMessage());
            }
        }
        else
        {
            String msg = localStrings.getString( "admin.server.core.mbean.config.instance_already_exists", instanceName );
View Full Code Here


        throws InstanceAlreadyExistsException, ControlException
    {
        if(isBadInstanceName(instanceName))
        {
            String msg = localStrings.getString( "admin.server.core.mbean.bad_instance_name" );
            throw new ControlException( msg );
        }
       
        ArgChecker.checkValid(hAndp, "hostport"); //noi18n
        ArgChecker.checkValid(instanceName, "instanceName",
                              StringValidator.getInstance()); //noi18n
        ObjectName siObjectName =
            ObjectNames.getServerInstanceObjectName(instanceName);
        MBeanServer mbs = MBeanServerFactory.getMBeanServer();
        if (!mbs.isRegistered(siObjectName))
        {
            try
            {
                /* call the script to create instance */
                InstanceDefinition instance =
                    new InstanceDefinition(hAndp.getHost(), hAndp.getPort(),
                        instanceName, mailHost, user, docRoot, jmsPort,
                        jmsUser, jmsPasswd);
                ServerManager.instance().createServerInstance(instance);
                sLogger.log(Level.INFO, "mbean.created_instance", instanceName);
            }
            catch (Exception e)
            {
                sLogger.log(Level.WARNING, "mbean.create_instance_failed", e);
                throw new ControlException(e.getMessage());
            }
        }
        else
        {
            throw new InstanceAlreadyExistsException(instanceName);
View Full Code Here

        if(!sm.instanceExists(instanceName))
        {
            String msg = localStrings.getString(
                    "admin.server.core.mbean.config.instance_does_not_exist",
                    instanceName);
            throw new ControlException(msg);
        }
        boolean alive = false;
        RMIClient serverInstancePinger = AdminChannel.getRMIClient(instanceName);
        alive = serverInstancePinger.isAlive();
        if(alive)
        {
      String msg = localStrings.getString(
                    "admin.server.core.mbean.config.delete_alive_instance",
                    instanceName);
            throw new ControlException(msg);
        }

       
        try
        {
            // Unregister all instance related MBeans
            MBeanServer mbs = MBeanServerFactory.getMBeanServer();
            ObjectName[] objectNames  = ObjectNameHelper.
                    getInstanceRelatedMBeans(mbs, instanceName);
            for(int i=0; i<objectNames.length; i++)
            {
                try
                {
                    mbs.unregisterMBean(objectNames[i]);
                }
                catch(Exception e)
                {
                    sLogger.log(Level.CONFIG, "delete_unregistration_failed",
                            objectNames[i]);
                }
            }
            // Message to Config to refresh contexts
            InstanceEnvironment instanceEnvironment = new
                    InstanceEnvironment(instanceName);
            String fileUrl  = instanceEnvironment.getConfigFilePath();
            ConfigFactory.removeConfigContext(fileUrl);

            String instanceRoot = instanceEnvironment.getInstancesRoot();
            deleteJMSProviderInstance(instanceRoot, instanceName);
           
            // Now stop it delete the files from file system */
            sm.deleteServerInstance(instanceName);
            sLogger.log(Level.INFO, "mbean.del_instance_ok", instanceName);
        }
        catch(Exception e)
        {
            sLogger.log(Level.WARNING, "mbean.del_instance_failed", e);
            throw new ControlException(e.getMessage());
        }
    }
View Full Code Here

      byte[] bytes  = aChunk.getBytes();
            sOut.write(bytes);
        }
        catch(Exception e)
        {
            throw new ControlException(e.getMessage());
        }
        finally
        {
            try
            {
        if (aChunk.isLast())
        {
          sOut.close();
          mStreamTable.remove(filePath);
                    sLogger.log(Level.INFO, "mbean.upload_done", filePath);
        }
            }
            catch(Exception fe)
            {
        throw new ControlException(fe.getMessage());
            }
        }
    }
View Full Code Here

      catch (Exception ce)
      {
                sLogger.log(Level.WARNING, "mbean.upload_failed", filePath);
      }
     
      throw new ControlException(e.getMessage());
    }
    return ( fOut );
  }
View Full Code Here

        filePath = RelativePathResolver.resolvePath(filePath);
        File downloadFile = new File(filePath);
        if (!downloadFile.exists())
        {
      String msg = localStrings.getString( "admin.server.core.mbean.config.file_doesnot_exist", filePath );
            throw new ControlException( msg );
        }
        try
        {
            if (lock == null)
            {
                lock = new Lock();
            }
            lock.attempt(1000);
        }
        catch (Exception ie)
        {
      String msg = localStrings.getString( "admin.server.core.mbean.config.could_not_acquire_lock", ie.toString() );
            throw new ControlException( msg );
        }
        if (downloadInfo == null)
        {
            downloadInfo = new DownloadInfo();
        }
View Full Code Here

    {
        sLogger.log(Level.FINE, "mbean.begin_download");
        if (downloadInfo == null)
        {
      String msg = localStrings.getString( "admin.server.core.mbean.config.call_preparedownload_first" );
            throw new ControlException( msg );
        }
        else if (!downloadInfo.isPrepared)
        {
      String msg = localStrings.getString( "admin.server.core.mbean.config.call_preparedownload_first" );
            throw new ControlException( msg );
        }
        if ((chunkIndex >= downloadInfo.numChunks) || (chunkIndex < 0))
        {
      String msg = localStrings.getString( "admin.server.core.mbean.config.invalid_chunk_index" );
            throw new ControlException( msg );
    }
        RandomAccessFile    raf         = null;
        ByteChunk           byteChunk   = null;
        try
        {
            raf = new RandomAccessFile(downloadInfo.downloadFile, "r");
            byte[] bytes = new byte[ByteChunk.kChunkMaxSize];
            raf.seek(downloadInfo.numBytesRead);
            int actualBytesRead = raf.read(bytes, 0, ByteChunk.kChunkMaxSize);
            /*
            Debug.println("Read " + actualBytesRead + " from " +
                          downloadInfo.numBytesRead);
            */
            if (actualBytesRead < bytes.length)
            {
                byte[] newBytes = new byte[actualBytesRead];
                for (int i = 0; i < newBytes.length; i++)
                {
                    newBytes[i] = bytes[i];
                }
                bytes = newBytes;
            }
            downloadInfo.numBytesRead += actualBytesRead;
            boolean isFirstChunk    = (chunkIndex == 0);
            boolean isLastChunk     =
                (chunkIndex == (downloadInfo.numChunks - 1));
            sLogger.log(Level.FINEST, "chunkIndex = " + chunkIndex +
                          " isFirstChunk = " + isFirstChunk +
                          " isLastChunk = " + isLastChunk);
            byteChunk = new ByteChunk(bytes,
                             downloadInfo.downloadFile.getAbsolutePath(),
                             isFirstChunk, isLastChunk);
        }
        catch (Exception ioe)
        {
            sLogger.log(Level.FINE, "mbean.download_failed", ioe);
            downloadInfo.reset();
            try
            {
                lock.release();
            }
            catch (Exception e)
            {
                sLogger.log(Level.FINEST, "lock could not be released");
            }
            throw new ControlException(ioe.toString());
        }
        finally
        {
            if (raf != null)
            {
View Full Code Here

            }
            assert size == i;
    }
    catch (Exception e)
    {
      throw new ControlException(e.getMessage());
    }
        return ( domains );
    }
View Full Code Here

    } catch (ControlException cex) {
        String msg = localStrings.getString( "admin.server.core.mbean.config.timeout_reached_server_stopping_exception", mInstanceName );
              //throw new ControlException( msg );
    }
        String msg = localStrings.getString( "admin.server.core.mbean.config.timeout_reached_server_starting_exception", mInstanceName );
              throw new ControlException( msg );
      } else {
    sLogger.log(Level.INFO, "mbean.start_instance_success", mInstanceName);
      }
      //
        }
        catch (Exception e)
        {
            sLogger.log(Level.SEVERE,
                    "mbean.start_instance_failed", mInstanceName);
            sLogger.log(Level.SEVERE,
                    "mbean.start_instance_failed_details", e);
            throw new ControlException(e.getMessage());
        }
        return ( null );
    }
View Full Code Here

            }
        }
        catch (Exception e)
        {
            sLogger.log(Level.WARNING, "mbean.set_debug_failed", e);
            throw new ControlException(e.getLocalizedMessage());
        }
        start(true, passwords);
        return port;
    }
View Full Code Here

TOP

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

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.