@@ -0,0 +1,3175 @@
+/**%0D%0A * Copyright (c) 2005-2007 Intalio inc.%0D%0A *%0D%0A * All rights reserved. This program and the accompanying materials%0D%0A * are made available under the terms of the Eclipse Public License v1.0%0D%0A * which accompanies this distribution, and is available at%0D%0A * http://www.eclipse.org/legal/epl-v10.html%0D%0A *%0D%0A * Contributors:%0D%0A * Intalio inc. - initial API and implementation%0D%0A */%0D%0Apackage org.intalio.tempo.deployment.rmi;%0D%0A%0D%0Aimport java.io.FileInputStream;%0D%0Aimport java.io.IOException;%0D%0Aimport java.rmi.registry.LocateRegistry;%0D%0Aimport java.rmi.registry.Registry;%0D%0Aimport java.util.Properties;%0D%0A%0D%0Aimport org.intalio.tempo.deployment.DeploymentService;%0D%0Aimport org.intalio.tempo.deployment.spi.DeploymentServiceCallback;%0D%0Aimport org.springframework.util.SystemPropertyUtils;%0D%0A%0D%0A/**%0D%0A * RMI configuration and lookup for DeploymentService.%0D%0A */%0D%0Apublic class DeploymentServiceRMI %7B%0D%0A    public static final String DEFAULT_PROPERTY_FILE     = %22file:$%7Borg.intalio.tempo.configDirectory%7D/tempo-deploy.properties%22;%0D%0A    public static final String DEFAULT_DEPLOYMENT_SERVICE_NAME  = %22DeploymentService%22;%0D%0A    public static final String DEFAULT_DEPLOYMENT_CALLBACK_NAME = %22DeploymentServiceCallback%22;%0D%0A    public static final int    DEFAULT_RMI_PORT      = 1099;%0D%0A%0D%0A    public String  propertyFile = DEFAULT_PROPERTY_FILE;%0D%0A    public int     rmiPort      = DEFAULT_RMI_PORT;%0D%0A    public String  deploymentServiceName  = DEFAULT_DEPLOYMENT_SERVICE_NAME;%0D%0A    public String  deploymentCallbackName = DEFAULT_DEPLOYMENT_CALLBACK_NAME;%0D%0A%0D%0A    /**%0D%0A     * Default constructor.%0D%0A     */%0D%0A    public DeploymentServiceRMI() %7B%0D%0A    %7D%0D%0A    %0D%0A    /**%0D%0A     * Load configuration from properties file.%0D%0A     */%0D%0A    public void loadProperties() %7B%0D%0A        String configFile = SystemPropertyUtils.resolvePlaceholders(propertyFile);%0D%0A        try %7B%0D%0A            Properties props = new Properties();%0D%0A            props.load(new FileInputStream(configFile));%0D%0A            rmiPort = Integer.parseInt((String) props.getProperty(%22rmi.port%22, Integer.toString(DEFAULT_RMI_PORT)));%0D%0A            deploymentServiceName = (String) props.getProperty(%22deployment.service.name%22, DEFAULT_DEPLOYMENT_SERVICE_NAME);%0D%0A            deploymentCallbackName = (String) props.getProperty(%22deployment.callback.name%22, DEFAULT_DEPLOYMENT_CALLBACK_NAME);%0D%0A        %7D catch (IOException except) %7B%0D%0A            throw new RuntimeException(except);%0D%0A        %7D%0D%0A    %7D%0D%0A%0D%0A    /**%0D%0A     * Lookup DeploymentService in RMI Registry.%0D%0A     */%0D%0A    public DeploymentService lookupDeploymentService() %7B%0D%0A        return lookup(deploymentServiceName);%0D%0A    %7D%0D%0A    %0D%0A    /**%0D%0A     * Lookup DeploymentService in RMI Registry.%0D%0A     */%0D%0A    public DeploymentServiceCallback lookupDeploymentCallback() %7B%0D%0A        return lookup(deploymentCallbackName);%0D%0A    %7D%0D%0A    %0D%0A    /**%0D%0A     * Lookup an object in RMI Registry.%0D%0A     */%0D%0A    @SuppressWarnings(%22unchecked%22)%0D%0A    private %3CT%3E T lookup(String name) %7B%0D%0A        try %7B%0D%0A            Registry registry = LocateRegistry.getRegistry(rmiPort);%0D%0A            return (T) registry.lookup(name);%0D%0A        %7D catch (Exception except) %7B%0D%0A            throw new RuntimeException(except);%0D%0A        %7D%0D%0A    %7D%0D%0A    %0D%0A%7D%0D%0A

Add RMI helper