Remove obsolete commands package

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1589177 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/crankstart/launcher/commands/InstallBundle.java b/src/main/java/org/apache/sling/crankstart/launcher/commands/InstallBundle.java
deleted file mode 100644
index 1df274c..0000000
--- a/src/main/java/org/apache/sling/crankstart/launcher/commands/InstallBundle.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 org.apache.sling.crankstart.launcher.commands;
-
-import java.io.InputStream;
-import java.net.URL;
-
-import org.apache.sling.crankstart.api.CrankstartCommand;
-import org.apache.sling.crankstart.api.CrankstartContext;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** CrankstartCommand that installs a bundle */
-public class InstallBundle implements CrankstartCommand {
-    public static final String I_BUNDLE = "bundle ";
-    private final Logger log = LoggerFactory.getLogger(getClass());
-    
-    @Override
-    public boolean appliesTo(String commandLine) {
-        return commandLine.startsWith(I_BUNDLE);
-    }
-
-    @Override
-    public void execute(CrankstartContext crankstartContext, String commandLine) throws Exception {
-        final String bundleRef = U.removePrefix(I_BUNDLE, commandLine);
-        final URL url = new URL( "mvn:" + bundleRef);
-        final BundleContext ctx = crankstartContext.getOsgiFramework().getBundleContext();
-        final String ref = "crankstart://" + bundleRef;
-        final InputStream bundleStream = url.openStream();
-        try {
-            ctx.installBundle(ref, url.openStream());
-            log.info("bundle installed: {}", ref);
-        } finally {
-            bundleStream.close();
-        }
-    }
-}
diff --git a/src/main/java/org/apache/sling/crankstart/launcher/commands/Log.java b/src/main/java/org/apache/sling/crankstart/launcher/commands/Log.java
deleted file mode 100644
index 569c83d..0000000
--- a/src/main/java/org/apache/sling/crankstart/launcher/commands/Log.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 org.apache.sling.crankstart.launcher.commands;
-
-import org.apache.sling.crankstart.api.CrankstartCommand;
-import org.apache.sling.crankstart.api.CrankstartContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** CrankstartCommand that logs a message */
-public class Log implements CrankstartCommand {
-    public static final String I_LOG = "log";
-    private final Logger log = LoggerFactory.getLogger(getClass());
-    
-    @Override
-    public boolean appliesTo(String commandLine) {
-        return commandLine.startsWith(I_LOG);
-    }
-
-    @Override
-    public void execute(CrankstartContext crankstartContext, String commandLine) throws Exception {
-        log.info(U.removePrefix(I_LOG, commandLine));
-    }
-}
diff --git a/src/main/java/org/apache/sling/crankstart/launcher/commands/SetOsgiFrameworkProperty.java b/src/main/java/org/apache/sling/crankstart/launcher/commands/SetOsgiFrameworkProperty.java
deleted file mode 100644
index 4661430..0000000
--- a/src/main/java/org/apache/sling/crankstart/launcher/commands/SetOsgiFrameworkProperty.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 org.apache.sling.crankstart.launcher.commands;
-
-import org.apache.sling.crankstart.api.CrankstartCommand;
-import org.apache.sling.crankstart.api.CrankstartContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** CrankstartCommand that logs a message */
-public class SetOsgiFrameworkProperty implements CrankstartCommand {
-    public static final String I_OSGI_PROPERTY = "osgi.property";
-    private final Logger log = LoggerFactory.getLogger(getClass());
-    
-    @Override
-    public boolean appliesTo(String commandLine) {
-        return commandLine.startsWith(I_OSGI_PROPERTY);
-    }
-
-    @Override
-    public void execute(CrankstartContext crankstartContext, String commandLine) throws Exception {
-        final String args = U.removePrefix(I_OSGI_PROPERTY, commandLine);
-        final String [] parts = args.split(" ");
-        if(parts.length != 2) {
-            log.warn("Invalid OSGi property statement, ignored: [{}]", commandLine);
-            return;
-        }
-        final String key = parts[0].trim();
-        final String value = parts[1].trim();
-        log.info("Setting OSGI property {}={}", key, value);
-        crankstartContext.setOsgiFrameworkProperty(key, value);
-    }
-}
diff --git a/src/main/java/org/apache/sling/crankstart/launcher/commands/StartBundles.java b/src/main/java/org/apache/sling/crankstart/launcher/commands/StartBundles.java
deleted file mode 100644
index bcd0eda..0000000
--- a/src/main/java/org/apache/sling/crankstart/launcher/commands/StartBundles.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 org.apache.sling.crankstart.launcher.commands;
-
-import org.apache.sling.crankstart.api.CrankstartCommand;
-import org.apache.sling.crankstart.api.CrankstartContext;
-import org.osgi.framework.Bundle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** CrankstartCommand that logs a message */
-public class StartBundles implements CrankstartCommand {
-    public static final String I_START_ALL_BUNDLES = "start.all.bundles";
-    private final Logger log = LoggerFactory.getLogger(getClass());
-    
-    @Override
-    public boolean appliesTo(String commandLine) {
-        return commandLine.startsWith(I_START_ALL_BUNDLES);
-    }
-
-    @Override
-    public void execute(CrankstartContext crankstartContext, String commandLine) throws Exception {
-        int count = 0;
-        for (Bundle bundle : crankstartContext.getOsgiFramework().getBundleContext().getBundles()) {
-            log.info("Starting bundle {}", bundle.getSymbolicName());
-            bundle.start();
-            count++;
-        }
-        
-        // TODO check that all bundles have started? 
-        // or use a crankstart instruction for that?
-        log.info("{} bundles processed", count);
-    }
-}
diff --git a/src/main/java/org/apache/sling/crankstart/launcher/commands/StartFramework.java b/src/main/java/org/apache/sling/crankstart/launcher/commands/StartFramework.java
deleted file mode 100644
index 205d1c9..0000000
--- a/src/main/java/org/apache/sling/crankstart/launcher/commands/StartFramework.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 org.apache.sling.crankstart.launcher.commands;
-
-import org.apache.sling.crankstart.api.CrankstartCommand;
-import org.apache.sling.crankstart.api.CrankstartContext;
-import org.osgi.framework.launch.FrameworkFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/** CrankstartCommand that logs a message */
-public class StartFramework implements CrankstartCommand {
-    public static final String I_START_FRAMEWORK = "start.framework";
-    private final Logger log = LoggerFactory.getLogger(getClass());
-    
-    @Override
-    public boolean appliesTo(String commandLine) {
-        return commandLine.startsWith(I_START_FRAMEWORK);
-    }
-
-    @Override
-    public void execute(CrankstartContext crankstartContext, String commandLine) throws Exception {
-        // TODO get framework as a Maven artifact?
-        FrameworkFactory frameworkFactory = java.util.ServiceLoader.load(FrameworkFactory.class).iterator().next();
-        crankstartContext.setOsgiFramework(frameworkFactory.newFramework(crankstartContext.getOsgiFrameworkProperties()));
-        crankstartContext.getOsgiFramework().start();
-        log.info("OSGi framework started");
-    }
-}
diff --git a/src/main/java/org/apache/sling/crankstart/launcher/commands/U.java b/src/main/java/org/apache/sling/crankstart/launcher/commands/U.java
deleted file mode 100644
index d736771..0000000
--- a/src/main/java/org/apache/sling/crankstart/launcher/commands/U.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 org.apache.sling.crankstart.launcher.commands;
-
-class U {
-    static String removePrefix(String prefix, String line) {
-        return line.substring(prefix.length()).trim();
-    }
-}