// Path: monica-framework/src/main/java/monica/framework/tools/Utils.java
// public class Utils {
// 	public static File getPropertiesPath(String propertiesName) {
// 		String[] pathArray = System.getProperty("java.class.path").split(";");
// 		for (String s : pathArray) {
// 			File newFile = new File(s + File.separator + propertiesName);
// 			if (newFile.exists()) {
// 				return newFile;
// 			}			
// 		}
// 		return null;
// 	}
// 	
// 	public static URL loadResources(String propertiesName) throws IOException {
// 		String[] pathArray = System.getProperty("java.class.path").split(";");
// 		URL  inURL = Utils.class.getClassLoader().getResource(propertiesName);
// 		if (null !=inURL) {
// 			return inURL;
// 		}			
// 		return null;
// 	}
// 
// }
// 
// Path: monica-framework/src/main/java/monica/framework/transport/TransportFile.java
// public class TransportFile implements Serializable{
// 
// 	private static final long serialVersionUID = 1L;
// 	private String fileName;
// 	private byte[] content;
// 	
// 	
// 	public String getFileName() {
// 		return fileName;
// 	}
// 	public void setFileName(String fileName) {
// 		this.fileName = fileName;
// 	}
// 	public byte[] getContent() {
// 		return content;
// 	}
// 	public void setContent(byte[] content) {
// 		this.content = content;
// 	}
// 	
// 	
// }
// 
// Path: monica-starter/src/main/java/monica/starter/client/ClientStarter.java
// public class ClientStarter {
// 	private final Logger log = LoggerFactory.getLogger(getClass());
// 	private final String SERVER_IP_CACHE = "server_ip";
// 	private final String SERVER_PORT_CACHE = "server_port";
// 	private final String SOCKET_CHANNEL = "channel"; 
// 
// 	public void start() throws Exception {
// 		ConfigurationContext.loadYamlClientConfig();
// 		new ZookeeperMonicaClient().start();
// 		new ServiceBuilder().servicesInit().route().loadbalance().build();
// 		String ip = (String) RegistryContext.clientCache.get(SERVER_IP_CACHE);
// 		int port = Integer.valueOf((String) RegistryContext.clientCache.get(SERVER_PORT_CACHE));
// 		Client client = ClientFactory.newFactory().getConsumerClient();	
// 		Executors.newSingleThreadExecutor().execute(new NettyRunnable(client, ip, port));
// 		for (;;) {
// 			if (client.isStarted()) {
// 				new RegistryCentre().setUri(createUri()).setType(RegistryType.CLIENT).start();
// 				if (RegistryCentre.registryFinished()) {
// 					log.info("monica client start successfully!");
// 				}
// 				break;
// 			}
// 		}
// 
// 	}
// 
// 	// register the  consumer
// 	private UriSpec createUri() {
// 		return new UriSpec();
// 	}
// 	
// 	
// 	public Channel getSocketChannel(){
// 		return (Channel)ConfigurationContext.propMap.get(SOCKET_CHANNEL);
// 	}
// 
// 	public static void main(String args[]) {
// 		ClientStarter container = new ClientStarter();
// 		try {
// 			container.start();
// 		} catch (Exception e) {
// 			e.printStackTrace();
// 		}
// 	}
// }


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.Properties;
import java.util.concurrent.Executors;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import monica.framework.tools.Utils;
import monica.framework.transport.TransportFile;
import monica.starter.client.ClientStarter;

/*
 * Copyright 2017 The Monica Project
 *
 * The Monica Project licenses this file to you 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 monica.examples;



/**
 * 
 * @author lucy@polarcoral.com
 *
 *         2017-08-29
 */
public class MonicaClient {

	public static void main(String args[]) throws FileNotFoundException, IOException {
		Properties pps = new Properties();

// Path: monica-framework/src/main/java/monica/framework/tools/Utils.java
// public class Utils {
// 	public static File getPropertiesPath(String propertiesName) {
// 		String[] pathArray = System.getProperty("java.class.path").split(";");
// 		for (String s : pathArray) {
// 			File newFile = new File(s + File.separator + propertiesName);
// 			if (newFile.exists()) {
// 				return newFile;
// 			}			
// 		}
// 		return null;
// 	}
// 	
// 	public static URL loadResources(String propertiesName) throws IOException {
// 		String[] pathArray = System.getProperty("java.class.path").split(";");
// 		URL  inURL = Utils.class.getClassLoader().getResource(propertiesName);
// 		if (null !=inURL) {
// 			return inURL;
// 		}			
// 		return null;
// 	}
// 
// }
// 
// Path: monica-framework/src/main/java/monica/framework/transport/TransportFile.java
// public class TransportFile implements Serializable{
// 
// 	private static final long serialVersionUID = 1L;
// 	private String fileName;
// 	private byte[] content;
// 	
// 	
// 	public String getFileName() {
// 		return fileName;
// 	}
// 	public void setFileName(String fileName) {
// 		this.fileName = fileName;
// 	}
// 	public byte[] getContent() {
// 		return content;
// 	}
// 	public void setContent(byte[] content) {
// 		this.content = content;
// 	}
// 	
// 	
// }
// 
// Path: monica-starter/src/main/java/monica/starter/client/ClientStarter.java
// public class ClientStarter {
// 	private final Logger log = LoggerFactory.getLogger(getClass());
// 	private final String SERVER_IP_CACHE = "server_ip";
// 	private final String SERVER_PORT_CACHE = "server_port";
// 	private final String SOCKET_CHANNEL = "channel"; 
// 
// 	public void start() throws Exception {
// 		ConfigurationContext.loadYamlClientConfig();
// 		new ZookeeperMonicaClient().start();
// 		new ServiceBuilder().servicesInit().route().loadbalance().build();
// 		String ip = (String) RegistryContext.clientCache.get(SERVER_IP_CACHE);
// 		int port = Integer.valueOf((String) RegistryContext.clientCache.get(SERVER_PORT_CACHE));
// 		Client client = ClientFactory.newFactory().getConsumerClient();	
// 		Executors.newSingleThreadExecutor().execute(new NettyRunnable(client, ip, port));
// 		for (;;) {
// 			if (client.isStarted()) {
// 				new RegistryCentre().setUri(createUri()).setType(RegistryType.CLIENT).start();
// 				if (RegistryCentre.registryFinished()) {
// 					log.info("monica client start successfully!");
// 				}
// 				break;
// 			}
// 		}
// 
// 	}
// 
// 	// register the  consumer
// 	private UriSpec createUri() {
// 		return new UriSpec();
// 	}
// 	
// 	
// 	public Channel getSocketChannel(){
// 		return (Channel)ConfigurationContext.propMap.get(SOCKET_CHANNEL);
// 	}
// 
// 	public static void main(String args[]) {
// 		ClientStarter container = new ClientStarter();
// 		try {
// 			container.start();
// 		} catch (Exception e) {
// 			e.printStackTrace();
// 		}
// 	}
// }


// Path: monica-examples/src/main/java/monica/examples/MonicaClient.java
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.Properties;
import java.util.concurrent.Executors;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import monica.framework.tools.Utils;
import monica.framework.transport.TransportFile;
import monica.starter.client.ClientStarter;

/*
 * Copyright 2017 The Monica Project
 *
 * The Monica Project licenses this file to you 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 monica.examples;



/**
 * 
 * @author lucy@polarcoral.com
 *
 *         2017-08-29
 */
public class MonicaClient {

	public static void main(String args[]) throws FileNotFoundException, IOException {
		Properties pps = new Properties();

		File file = Utils.getPropertiesPath("path.properties");
