/*
 * Copyright (c) 2008-2012, Hazelcast, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.hazelcast.impl.management;

import com.hazelcast.logging.ILogger;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.logging.Level;

// author: sancar - 17.12.2012
public class VersionMismatchLogRequest implements ConsoleRequest {

    private String manCenterVersion;

    public VersionMismatchLogRequest(String manCenterVersion){
        this.manCenterVersion = manCenterVersion;
    }

    public VersionMismatchLogRequest(){
        super();
    }

    public int getType() {
        return ConsoleRequestConstants.REQUEST_TYPE_LOG_VERSION_MISMATCH;
    }

    public Object readResponse(DataInput in) throws IOException {
        return "SUCCESS";
    }

    public void writeResponse(ManagementCenterService mcs, DataOutput dos) throws Exception {
        final ILogger logger = mcs.getHazelcastInstance().node.getLogger(VersionMismatchLogRequest.class.getName());
        mcs.setVersionMismatch(true);
        logger.log(Level.SEVERE, "The version of the management center is " + manCenterVersion);
    }

    public void writeData(DataOutput out) throws IOException {
        out.writeUTF(manCenterVersion);
    }

    public void readData(DataInput in) throws IOException {
        manCenterVersion = in.readUTF();
    }
}

@@ -660,16 +660,53 @@
 ement;%0A%0A
+import com.hazelcast.core.Hazelcast;%0A
 import c
@@ -817,16 +817,73 @@
 eption;%0A
+import java.io.InputStream;%0Aimport java.util.Properties;%0A
 import j
@@ -1684,16 +1684,108 @@
 (true);%0A
+        String hazelcastVersion = mcs.getHazelcastInstance().node.initializer.getVersion();%0A
         
@@ -1814,27 +1814,66 @@
 E, %22
-The v
+V
 ersion 
-of the 
+Mismatch%5Cn%22%0A                                 + %22%5Ct
 mana
@@ -1890,13 +1890,19 @@
 ter 
-is
+version :
  %22
- 
 + ma
@@ -1907,32 +1907,118 @@
 manCenterVersion
+  + %22%5Cn%22%0A                                 + %22%5Cthazelcast version : %22+ hazelcastVersion
 );%0A    %7D%0A%0A    pu

Version mismatch log change