001/* 002 * (C) Copyright 2006-2008 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * matic 016 */ 017package org.nuxeo.runtime.management; 018 019import org.apache.commons.logging.Log; 020import org.apache.commons.logging.LogFactory; 021import org.nuxeo.common.xmap.annotation.XNode; 022import org.nuxeo.common.xmap.annotation.XObject; 023import org.nuxeo.runtime.api.Framework; 024 025/** 026 * @author matic 027 */ 028@XObject("locator") 029public class ServerLocatorDescriptor { 030 031 private static final Log log = LogFactory.getLog(ServerLocatorDescriptor.class); 032 033 @XNode("@default") 034 protected boolean isDefault = true; 035 036 protected boolean isExisting = true; 037 038 protected int rmiPort = 1099; 039 040 @XNode("@domain") 041 protected String domainName; 042 043 @XNode("@remote") 044 protected boolean remote = true; 045 046 public ServerLocatorDescriptor() { 047 domainName = ""; 048 } 049 050 public ServerLocatorDescriptor(String domainName, boolean isDefaultServer) { 051 this.domainName = domainName; 052 isDefault = isDefaultServer; 053 } 054 055 @XNode("@exist") 056 public void setExisting(String value) { 057 String expandedValue = Framework.expandVars(value); 058 if (expandedValue.startsWith("$")) { 059 log.warn("Cannot expand " + value + " for existing server"); 060 return; 061 } 062 isExisting = Boolean.parseBoolean(expandedValue); 063 } 064 065 @XNode("@rmiPort") 066 public void setRmiPort(String value) { 067 String expandedValue = Framework.expandVars(value); 068 if (expandedValue.startsWith("$")) { 069 log.warn("Cannot expand " + value + " for server locator"); 070 return; 071 } 072 rmiPort = Integer.parseInt(expandedValue); 073 } 074}