karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject [5/6] git commit: Revert [KARAF-2762]
Date Thu, 06 Mar 2014 00:40:08 GMT
Revert [KARAF-2762]

Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/ed9f0785
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/ed9f0785
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/ed9f0785

Branch: refs/heads/master
Commit: ed9f0785faf28f0bf142ea67546f83684a8edb80
Parents: 662c07a
Author: Guillaume Nodet <gnodet@gmail.com>
Authored: Thu Mar 6 01:31:22 2014 +0100
Committer: Guillaume Nodet <gnodet@gmail.com>
Committed: Thu Mar 6 01:31:22 2014 +0100

----------------------------------------------------------------------
 shell/command-exporter/NOTICE                   |  71 ----------
 shell/command-exporter/pom.xml                  | 110 ---------------
 .../karaf/shell/exporter/ActionCommand.java     | 133 -------------------
 .../karaf/shell/exporter/ActionTracker.java     |  94 -------------
 .../apache/karaf/shell/exporter/Activator.java  |  42 ------
 shell/pom.xml                                   |   1 -
 6 files changed, 451 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/ed9f0785/shell/command-exporter/NOTICE
----------------------------------------------------------------------
diff --git a/shell/command-exporter/NOTICE b/shell/command-exporter/NOTICE
deleted file mode 100644
index b70f1f9..0000000
--- a/shell/command-exporter/NOTICE
+++ /dev/null
@@ -1,71 +0,0 @@
-Apache Karaf
-Copyright 2010-2014 The Apache Software Foundation
-
-
-I. Included Software
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2010).
-Licensed under the Apache License 2.0.
-
-This product includes software developed at
-OW2 (http://www.ow2.org/).
-Licensed under the BSD License.
-
-This product includes software developed at
-OPS4J (http://www.ops4j.org/).
-Licensed under the Apache License 2.0.
-
-This product includes software developed at
-Eclipse Foundation (http://www.eclipse.org/).
-Licensed under the EPL.
-
-This product includes software written by
-Antony Lesuisse.
-Licensed under Public Domain.
-
-
-II. Used Software
-
-This product uses software developed at
-FUSE Source (http://www.fusesource.org/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-AOP Alliance (http://aopalliance.sourceforge.net/).
-Licensed under the Public Domain.
-
-This product uses software developed at
-Tanuki Software (http://www.tanukisoftware.com/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-Jasypt (http://jasypt.sourceforge.net/).
-Licensed under the Apache License 2.0.
-
-This product uses software developed at
-JLine (http://jline.sourceforge.net).
-Licensed under the BSD License.
-
-This product uses software developed at
-SLF4J (http://www.slf4j.org/).
-Licensed under the MIT License.
-
-This product uses software developed at
-SpringSource (http://www.springsource.org/).
-Licensed under the Apache License 2.0.
-
-This product includes software from http://www.json.org.
-Copyright (c) 2002 JSON.org
-
-
-III. License Summary
-- Apache License 2.0
-- BSD License
-- EPL License
-- MIT License

http://git-wip-us.apache.org/repos/asf/karaf/blob/ed9f0785/shell/command-exporter/pom.xml
----------------------------------------------------------------------
diff --git a/shell/command-exporter/pom.xml b/shell/command-exporter/pom.xml
deleted file mode 100644
index cf4bca9..0000000
--- a/shell/command-exporter/pom.xml
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
-    <!--
-
-        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.
-    -->
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.karaf.shell</groupId>
-        <artifactId>shell</artifactId>
-        <version>3.1.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>command-exporter</artifactId>
-    <packaging>bundle</packaging>
-
-    <properties>
-        <appendedResourcesDirectory>${basedir}/../../etc/appended-resources</appendedResourcesDirectory>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.karaf.shell</groupId>
-            <artifactId>org.apache.karaf.shell.console</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.karaf.shell</groupId>
-            <artifactId>org.apache.karaf.shell.table</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.karaf.package</groupId>
-            <artifactId>org.apache.karaf.package.core</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.gogo.runtime</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-jdk14</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.utils</artifactId>
-            <scope>provided</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <resources>
-            <resource>
-                <directory>${project.basedir}/src/main/resources</directory>
-                <includes>
-                    <include>**/*</include>
-                </includes>
-            </resource>
-            <resource>
-                <directory>${project.basedir}/src/main/resources</directory>
-                <filtering>true</filtering>
-                <includes>
-                    <include>**/*.info</include>
-                </includes>
-            </resource>
-        </resources>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <configuration>
-                    <instructions>
-                        <Bundle-Activator>org.apache.karaf.shell.exporter.Activator</Bundle-Activator>
-                        <Export-Package>!*</Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf/blob/ed9f0785/shell/command-exporter/src/main/java/org/apache/karaf/shell/exporter/ActionCommand.java
----------------------------------------------------------------------
diff --git a/shell/command-exporter/src/main/java/org/apache/karaf/shell/exporter/ActionCommand.java
b/shell/command-exporter/src/main/java/org/apache/karaf/shell/exporter/ActionCommand.java
deleted file mode 100644
index 8779249..0000000
--- a/shell/command-exporter/src/main/java/org/apache/karaf/shell/exporter/ActionCommand.java
+++ /dev/null
@@ -1,133 +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.karaf.shell.exporter;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.felix.gogo.commands.Action;
-import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.gogo.commands.CommandWithAction;
-import org.apache.felix.gogo.commands.basic.AbstractCommand;
-import org.apache.felix.service.command.CommandProcessor;
-import org.apache.felix.service.command.Function;
-import org.apache.karaf.shell.console.CompletableFunction;
-import org.apache.karaf.shell.console.Completer;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Wraps an Action as a command using a template for the action injects
- */
-@SuppressWarnings("deprecation")
-public class ActionCommand extends AbstractCommand implements CompletableFunction {
-
-    private static Logger logger = LoggerFactory.getLogger(ActionCommand.class);
-
-    private Action actionTemplate;
-    private List<Completer> completers = new ArrayList<Completer>();
-
-    public ActionCommand(Action actionTemplate) {
-        this.actionTemplate = actionTemplate;
-        addCompleters();
-    }
-
-    public ServiceRegistration<?> registerService(BundleContext context) {
-        Class<? extends Action> actionClass = actionTemplate.getClass();
-        Command cmd = actionClass.getAnnotation(Command.class);
-        if (cmd == null) {
-            throw new IllegalArgumentException("Action class " + actionClass
-                    + " is not annotated with @Command");
-        }
-        String[] interfaces = new String[]{
-                Function.class.getName(),
-                CommandWithAction.class.getName(),
-                AbstractCommand.class.getName()
-        };
-        Hashtable<String, String> props = new Hashtable<String, String>();
-        props.put(CommandProcessor.COMMAND_SCOPE, cmd.scope());
-        props.put(CommandProcessor.COMMAND_FUNCTION, cmd.name());
-        logger.info("Registering command " + cmd.scope() + ":" + cmd.name() + " in the name
of bundle " + context.getBundle().getBundleId());
-        return context.registerService(interfaces, this, props);
-    }
-
-    @Override
-    public Class<? extends Action> getActionClass() {
-        return actionTemplate.getClass();
-    }
-
-    @Override
-    public Action createNewAction() {
-        try {
-            Action newAction = actionTemplate.getClass().newInstance();
-            copyFields(newAction);
-            return newAction;
-        } catch (InstantiationException e) {
-            throw new RuntimeException(e);
-        } catch (IllegalAccessException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    @Override
-    public List<Completer> getCompleters() {
-        return completers;
-    }
-
-    @Override
-    public Map<String, Completer> getOptionalCompleters() {
-        return null;
-    }
-
-    private void copyFields(Action newAction) {
-        Field[] fields = actionTemplate.getClass().getDeclaredFields();
-        for (Field field : fields) {
-            try {
-                if (!field.isAccessible()) {
-                    field.setAccessible(true);
-                }
-                Object value = field.get(actionTemplate);
-                field.set(newAction, value);
-            } catch (Exception e) {
-                throw new RuntimeException(e.getMessage(), e);
-            }
-        }
-    }
-
-    private void addCompleters() {
-        for (Field field : actionTemplate.getClass().getDeclaredFields()) {
-            if (Completer.class.isAssignableFrom(field.getType())) {
-                try {
-                    if (!field.isAccessible()) {
-                        field.setAccessible(true);
-                    }
-                    this.completers.add((Completer) field.get(actionTemplate));
-                } catch (Exception e) {
-                    logger.warn("Error setting completer from field " + field.getName());
-                }
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/ed9f0785/shell/command-exporter/src/main/java/org/apache/karaf/shell/exporter/ActionTracker.java
----------------------------------------------------------------------
diff --git a/shell/command-exporter/src/main/java/org/apache/karaf/shell/exporter/ActionTracker.java
b/shell/command-exporter/src/main/java/org/apache/karaf/shell/exporter/ActionTracker.java
deleted file mode 100644
index 5065759..0000000
--- a/shell/command-exporter/src/main/java/org/apache/karaf/shell/exporter/ActionTracker.java
+++ /dev/null
@@ -1,94 +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.karaf.shell.exporter;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.felix.gogo.commands.Action;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Tracks services that implement {@link org.apache.felix.gogo.commands.Action},
- * wraps each into an ActionCommand
- * and exports the command as a service in the name of the bundle exporting the Action
- */
-@SuppressWarnings("deprecation")
-final class ActionTracker extends ServiceTracker<Action, Action> {
-
-    private Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    @SuppressWarnings("rawtypes")
-    private Map<ServiceReference, ServiceRegistration> registrations =
-            new ConcurrentHashMap<ServiceReference, ServiceRegistration>();
-
-    ActionTracker(BundleContext context, Class<Action> clazz,
-                  ServiceTrackerCustomizer<Action, Action> customizer) {
-        super(context, clazz, customizer);
-    }
-
-    @Override
-    public Action addingService(ServiceReference<Action> reference) {
-        if (!registrations.containsKey(reference)) {
-            Bundle userBundle = reference.getBundle();
-            try {
-                BundleContext context = userBundle.getBundleContext();
-                ActionCommand command = new ActionCommand(context.getService(reference));
-                registrations.put(reference, command.registerService(context));
-            } catch (Exception e) {
-                logger.warn("Error exporting action as command from service of bundle "
-                        + userBundle.getSymbolicName()
-                        + "[" + userBundle.getBundleId() + "]", e);
-            }
-        }
-        return super.addingService(reference);
-    }
-
-    @Override
-    public void removedService(ServiceReference<Action> reference, Action service)
{
-        if (registrations.containsKey(reference)) {
-            try {
-                registrations.remove(reference).unregister();
-            } catch (Exception e) {
-                // Ignore .. might already be unregistered if exporting bundle stopped
-            }
-        }
-        super.removedService(reference, service);
-    }
-
-    @Override
-    public void close() {
-        for (ServiceRegistration<?> reg : registrations.values()) {
-            try {
-                reg.unregister();
-            } catch (Exception e) {
-                // Ignore .. might already be unregistered if exporting bundle stopped
-            }
-        }
-        registrations.clear();
-        super.close();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf/blob/ed9f0785/shell/command-exporter/src/main/java/org/apache/karaf/shell/exporter/Activator.java
----------------------------------------------------------------------
diff --git a/shell/command-exporter/src/main/java/org/apache/karaf/shell/exporter/Activator.java
b/shell/command-exporter/src/main/java/org/apache/karaf/shell/exporter/Activator.java
deleted file mode 100644
index 2bf000c..0000000
--- a/shell/command-exporter/src/main/java/org/apache/karaf/shell/exporter/Activator.java
+++ /dev/null
@@ -1,42 +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.karaf.shell.exporter;
-
-import org.apache.felix.gogo.commands.Action;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;
-
-@SuppressWarnings("deprecation")
-public class Activator implements BundleActivator {
-
-    private ServiceTracker<Action, Action> tracker;
-
-    @Override
-    public void start(BundleContext context) throws Exception {
-        tracker = new ActionTracker(context, Action.class, null);
-        tracker.open();
-    }
-
-    @Override
-    public void stop(BundleContext context) throws Exception {
-        tracker.close();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/ed9f0785/shell/pom.xml
----------------------------------------------------------------------
diff --git a/shell/pom.xml b/shell/pom.xml
index 1ab6361..482021b 100644
--- a/shell/pom.xml
+++ b/shell/pom.xml
@@ -40,7 +40,6 @@
         <module>ssh</module>
         <module>help</module>
         <module>table</module>
-        <module>command-exporter</module>
     </modules>
 
 </project>


Mime
View raw message