Package com.sun.enterprise.ee.synchronization.impl

Examples of com.sun.enterprise.ee.synchronization.impl.SynchronizationClientImpl


        // zip size is too big to stream in byte array
        // download the zip using chunking
        if (dasZipLoc != null) {

            // synchronization client to DAS
            SynchronizationClientImpl sClient =
                new SynchronizationClientImpl(
                SystemPropertyConstants.DEFAULT_SERVER_INSTANCE_NAME);

            // temp file in the remote sever
            zipfile = Utils.getTempZipFile();

            // connects to DAS
            sClient.connect();

            // down loads the zip file
            sClient.getAbsolute(dasZipLoc, zipfile);

            // closes the connection to DAS
            sClient.disconnect();
        }

        return zipfile;
    }
View Full Code Here


        if(dcrXMLFile == null) return; //no-op

        String dcrXMLNewFile= dcrXMLFile[0];
        String dcrXMLOldFile= dcrXMLFile[1];

        SynchronizationClientImpl sc = new SynchronizationClientImpl(dasName);

        _logger.log(Level.INFO,
                    "clb.admin.startSync",
                    new Object[]{dcrXMLNewFile, dasName});
        try {
            sc.connect();
            _logger.log(Level.FINEST,
                    "clb.admin.ConnectedToDAS" );
        } catch (IOException ie) {
           throw new SynchronizationException("Connection to SynchronizationClientImpl failed. IOException occured while trying to connect " + ie.getMessage());
        }
        String instanceRoot = System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY);

        String configName = getConfigName(e, serverName);

        String clbTargetLocation = instanceRoot + File.separator + CONFIG + File.separator + configName;

        //Added as a workaround for scenario when config-dir does not exist
        //under instance config
        final File clbTargetDir = new File(clbTargetLocation);
        if (!clbTargetDir.exists()) {
            try {
                AccessController.doPrivileged(new PrivilegedAction() {
                    public Object run() {
                        clbTargetDir.mkdir();
                        return null;
                    }
                });
            } catch (SecurityException ex) {
                throw new SynchronizationException(
                    "Unable to create directory " + clbTargetLocation, ex);
            }
        }
       
        _logger.log(Level.FINEST,
                    "clb.admin.FechingFile", new String[]{dcrXMLNewFile, clbTargetLocation} );

        sc.get(CONFIG + File.separator +  configName +  File.separator + dcrXMLNewFile, clbTargetLocation + File.separator + dcrXMLNewFile);


        _logger.log(Level.FINE,
                    "clb.admin.SyncSucessful", clbTargetLocation);
       
        //Reconfiguring sip load-balancer back-end dcr xml
        if (SipLoadBalancerManagerBackEnd.isLayerActive()) {
            SipLoadBalancerManagerBackEnd.getInstance().dcrReconfig(configName + File.separator + dcrXMLNewFile);
        }

     if (dcrXMLOldFile != null){
        try {
            _logger.log(Level.FINE,
                               "clb.admin.DeleteDCR", dcrXMLOldFile);

                File oldDCRFile= new File(clbTargetLocation + File.separator + dcrXMLOldFile);
                boolean value = oldDCRFile.delete();
                if (value == false)
                    _logger.log(Level.WARNING, "clb.admin.UnableToDelete", dcrXMLOldFile);
        }catch(SecurityException se){
              _logger.log(Level.WARNING, "clb.admin.UnableToDeleteWErr", new String[]{dcrXMLOldFile, se.getMessage()});
        }
     }
        try {
            sc.disconnect();
        } catch (IOException ie) {
           _logger.log(Level.FINE, "Unable to close connection to DAS "
                   + ie.getMessage());
        }
    }
View Full Code Here

        String clbXMLFile = clbXMLFileNames[0];
        String oldXMLFileName = clbXMLFileNames[1];
        // connects to DAS
        String dasName = SystemPropertyConstants.DEFAULT_SERVER_INSTANCE_NAME;

        SynchronizationClientImpl sc = new SynchronizationClientImpl(dasName);

        _logger.log(Level.INFO,
                    "clb.admin.StartSyncCLB",
                    new Object[]{clbXMLFile, dasName});
        try {
            sc.connect();
            _logger.log(Level.FINEST,
                    "clb.admin.ConnectedToDAS" );
        } catch (IOException ie) {
           throw new SynchronizationException("Connection to SynchronizationClientImpl failed. IOException occured while trying to connect " + ie.getMessage());
        }
        String instanceRoot = System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY);

        String configName = getConfigName(e, serverName);

        String clbTargetLocation = instanceRoot + File.separator + CONFIG + File.separator + configName;

        //Added as a workaround for scenario when config-dir does not exist
        //under instance config
        final File clbTargetDir = new File(clbTargetLocation);
        if (!clbTargetDir.exists()) {
            try {
                AccessController.doPrivileged(new PrivilegedAction() {
                    public Object run() {
                        clbTargetDir.mkdir();
                        return null;
                    }
                });
            } catch (SecurityException ex) {
                throw new SynchronizationException(
                    "Unable to create directory " + clbTargetLocation, ex);
            }
        }
       
        if(oldXMLFileName !=null)
        {
            try {
               

                boolean value = false;
                File myDir = new File(clbTargetLocation);

                // Define a filter for clb xml files
                if (clbXMLFile.indexOf(".v") != -1) {
                    String clbFile = clbXMLFile.substring(0,clbXMLFile.indexOf(".v"));
                    FilenameFilter select = new FileListFilter(clbFile);
                    File[] contents = myDir.listFiles(select);

                    for (int i=0; i < contents.length; i++) {
                        _logger.log(Level.FINE,
                                       "clb.admin.DeleteCLB", contents[i].getName());
                        value = contents[i].delete();
                        if (value == false)
                            _logger.log(Level.WARNING, "clb.admin.UnableToDelete", contents[i].getName());
                    }
                }
               
            }catch(SecurityException se){
                  _logger.log(Level.WARNING, "clb.admin.UnableToDeleteWErr", new String[]{oldXMLFileName, se.getMessage()});
            }
        }
       
        _logger.log(Level.FINEST,
                    "clb.admin.FechingFile", new String[]{clbXMLFile, clbTargetLocation} );

        sc.get(CONFIG + File.separator + configName + File.separator + clbXMLFile, clbTargetLocation + File.separator + clbXMLFile);

        _logger.log(Level.FINE,
                    "clb.admin.SyncCLBSucessful", clbXMLFile);
       
        try {
            sc.disconnect();

        } catch (IOException ie) {
           _logger.log(Level.FINE, "Unable to close connection to DAS : " + ie.toString());
        }
    
View Full Code Here

TOP

Related Classes of com.sun.enterprise.ee.synchronization.impl.SynchronizationClientImpl

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.