Save This Page
Home » maven-launchpad-plugin-2.0.6-source-release » org.apache.sling.maven.projectsupport » [javadoc | source]
    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements. See the NOTICE file distributed with this
    4    * work for additional information regarding copyright ownership. The ASF
    5    * licenses this file to You under the Apache License, Version 2.0 (the
    6    * "License"); you may not use this file except in compliance with the License.
    7    * You may obtain a copy of the License at
    8    *
    9    * http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   13    * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   14    * License for the specific language governing permissions and limitations under
   15    * the License.
   16    */
   17   package org.apache.sling.maven.projectsupport;
   18   
   19   import java.util.Map;
   20   
   21   import org.apache.felix.framework.Logger;
   22   import org.apache.sling.launchpad.base.impl.ResourceProvider;
   23   import org.apache.sling.launchpad.base.impl.Sling;
   24   import org.osgi.framework.BundleException;
   25   
   26   /**
   27    * Start a Launchpad application.
   28    *
   29    * @goal start
   30    * @requiresDependencyResolution test
   31    *
   32    */
   33   public class StartMojo extends AbstractLaunchpadStartingPlugin {
   34   
   35       /**
   36        * @parameter expression="${sling.control.port}" default-value="63000"
   37        */
   38       private int controlPort;
   39   
   40       /**
   41        * @parameter expression="${sling.control.host}"
   42        */
   43       private String controlHost;
   44   
   45       /**
   46        * {@inheritDoc}
   47        */
   48       @Override
   49       protected Sling startSling(ResourceProvider resourceProvider, final Map<String, String> props, Logger logger)
   50               throws BundleException {
   51           new ControlListener(this, getLog(), controlHost, controlPort).listen();
   52   
   53           return new Sling(this, logger, resourceProvider, props) {
   54   
   55               // overwrite the loadPropertiesOverride method to inject the
   56               // mojo arguments unconditionally. These will not be persisted
   57               // in any properties file, though
   58               protected void loadPropertiesOverride(
   59                       Map<String, String> properties) {
   60                   if (props != null) {
   61                       properties.putAll(props);
   62                   }
   63               }
   64           };
   65       }
   66   
   67   }

Save This Page
Home » maven-launchpad-plugin-2.0.6-source-release » org.apache.sling.maven.projectsupport » [javadoc | source]