@@ -0,0 +1,2750 @@
+/*%0A * Copyright 2018 NEOautus Ltd. (http://neoautus.com)%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22); you may not%0A * use this file except in compliance with the License. You may obtain a copy of%0A * the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A * License for the specific language governing permissions and limitations under%0A * the License.%0A */%0A%0Apackage org.lucidj.artifactdeployer;%0A%0Aimport org.lucidj.api.core.Artifact;%0Aimport org.lucidj.api.core.ArtifactDeployer;%0A%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.http.HttpServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport java.io.IOException;%0Aimport java.io.PrintWriter;%0A%0Aimport org.apache.felix.ipojo.annotations.Component;%0Aimport org.apache.felix.ipojo.annotations.Instantiate;%0Aimport org.apache.felix.ipojo.annotations.Provides;%0Aimport org.apache.felix.ipojo.annotations.Requires;%0Aimport org.apache.felix.ipojo.annotations.ServiceProperty;%0A%0A@Component (immediate = true, publicFactory = false)%0A@Instantiate%0A@Provides (specifications = HttpServlet.class)%0Apublic class DeploySvc extends HttpServlet%0A%7B%0A    @Requires%0A    private ArtifactDeployer artifactDeployer;%0A%0A    @ServiceProperty (name=%22@service.path%22)%0A    String service = %22/deploy%22;%0A%0A    @Override%0A    public void doGet (HttpServletRequest req, HttpServletResponse resp)%0A        throws ServletException, IOException%0A    %7B%0A        resp.setContentType (%22text/plain%22);%0A        PrintWriter out = resp.getWriter ();%0A%0A        if (req.getQueryString () == null)%0A        %7B%0A            // Just the service returns true indicating it exists%0A            out.write (%22true%5Cn%22);%0A            return;%0A        %7D%0A%0A        out.write (%22### Hello from %22 + this.getClass ().getName () + %22 ###%5Cn%22);%0A        out.write (%22Artifact: %22 + req.getQueryString () + %22%5Cn%22);%0A%0A        Artifact artifact = artifactDeployer.getArtifact (req.getQueryString ());%0A%0A        if (artifact == null)%0A        %7B%0A            try%0A            %7B%0A                artifact = artifactDeployer.installArtifact (req.getQueryString ());%0A                out.write (%22Artifact installed: %22 + artifact.toString ());%0A                artifact.update ();%0A            %7D%0A            catch (Exception e)%0A            %7B%0A                out.write (%22Exception deploying file: %22 + e.getMessage ());%0A            %7D%0A        %7D%0A        else%0A        %7B%0A            out.write (%22Update artifact: %22 + artifact.toString ());%0A            artifact.update ();%0A        %7D%0A    %7D%0A%7D%0A%0A// EOF%0A

Add local service 'deploy'.