Repository: karaf Updated Branches: refs/heads/master ed167f00d -> ab704c6bc
Fix legal and code style issues Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/ab704c6b Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/ab704c6b Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/ab704c6b Branch: refs/heads/master Commit: ab704c6bcb2d01d5e4de76a86ace30ed109d270d Parents: ed167f0 Author: Jean-Baptiste Onofré <[email protected]> Authored: Sat Feb 22 10:55:04 2014 +0100 Committer: Jean-Baptiste Onofré <[email protected]> Committed: Sat Feb 22 10:55:04 2014 +0100 ---------------------------------------------------------------------- .../modules/properties/PropertiesInstaller.java | 28 ++++++-- shell/command-exporter/NOTICE | 71 ++++++++++++++++++++ shell/command-exporter/pom.xml | 46 ++++++++++--- .../karaf/shell/exporter/ActionCommand.java | 15 +++-- .../karaf/shell/exporter/ActionTracker.java | 35 +++++++--- .../apache/karaf/shell/exporter/Activator.java | 26 ++++--- tooling/karaf-scr-maven-plugin/NOTICE | 71 ++++++++++++++++++++ .../karaf/tooling/scr/ScrCommandMojo.java | 38 ++++++++--- .../karaf/tooling/scr/ScrCommandSupport.java | 28 ++++---- 9 files changed, 292 insertions(+), 66 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/ab704c6b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesInstaller.java ---------------------------------------------------------------------- diff --git a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesInstaller.java b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesInstaller.java index 730e97e..461b038 100644 --- a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesInstaller.java +++ b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesInstaller.java @@ -1,3 +1,21 @@ +/* + * 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.jaas.modules.properties; import java.io.File; @@ -8,17 +26,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class PropertiesInstaller implements ArtifactInstaller { - + private final Logger LOGGER = LoggerFactory.getLogger(PropertiesInstaller.class); - + private String usersFileName; - + private File usersFile; - - + PropertiesLoginModule propertiesLoginModule; - public PropertiesInstaller(PropertiesLoginModule propertiesLoginModule, String usersFile) { this.propertiesLoginModule = propertiesLoginModule; this.usersFileName = usersFile; http://git-wip-us.apache.org/repos/asf/karaf/blob/ab704c6b/shell/command-exporter/NOTICE ---------------------------------------------------------------------- diff --git a/shell/command-exporter/NOTICE b/shell/command-exporter/NOTICE new file mode 100644 index 0000000..de8d101 --- /dev/null +++ b/shell/command-exporter/NOTICE @@ -0,0 +1,71 @@ +Apache Karaf +Copyright 2010-2013 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/ab704c6b/shell/command-exporter/pom.xml ---------------------------------------------------------------------- diff --git a/shell/command-exporter/pom.xml b/shell/command-exporter/pom.xml index 4678944..cf4bca9 100644 --- a/shell/command-exporter/pom.xml +++ b/shell/command-exporter/pom.xml @@ -1,14 +1,37 @@ +<?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"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.karaf.shell</groupId> - <artifactId>shell</artifactId> - <version>3.1.0-SNAPSHOT</version> - </parent> - <artifactId>command-exporter</artifactId> - <packaging>bundle</packaging> - - <properties> + + <!-- + + 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> @@ -76,11 +99,12 @@ <artifactId>maven-bundle-plugin</artifactId> <configuration> <instructions> - <Bundle-Activator>org.apache.karaf.shell.exporter.Activator</Bundle-Activator> + <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/ab704c6b/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 index 946d120..8779249 100644 --- 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 @@ -42,6 +42,7 @@ import org.slf4j.LoggerFactory; */ @SuppressWarnings("deprecation") public class ActionCommand extends AbstractCommand implements CompletableFunction { + private static Logger logger = LoggerFactory.getLogger(ActionCommand.class); private Action actionTemplate; @@ -51,18 +52,18 @@ public class ActionCommand extends AbstractCommand implements CompletableFunctio 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"); + + " is not annotated with @Command"); } - String[] interfaces = new String[] { - Function.class.getName(), - CommandWithAction.class.getName(), - AbstractCommand.class.getName() + 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()); @@ -121,7 +122,7 @@ public class ActionCommand extends AbstractCommand implements CompletableFunctio if (!field.isAccessible()) { field.setAccessible(true); } - this.completers.add((Completer)field.get(actionTemplate)); + 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/ab704c6b/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 index 55cd06e..5065759 100644 --- 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 @@ -1,3 +1,21 @@ +/* + * 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; @@ -14,20 +32,21 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Tracks services that implement {@link org.apache.felix.gogo.commands.Action}, - * wraps each into an ActionCommand + * 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>(); + private Map<ServiceReference, ServiceRegistration> registrations = + new ConcurrentHashMap<ServiceReference, ServiceRegistration>(); ActionTracker(BundleContext context, Class<Action> clazz, - ServiceTrackerCustomizer<Action, Action> customizer) { + ServiceTrackerCustomizer<Action, Action> customizer) { super(context, clazz, customizer); } @@ -40,9 +59,9 @@ final class ActionTracker extends ServiceTracker<Action, Action> { 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); + logger.warn("Error exporting action as command from service of bundle " + + userBundle.getSymbolicName() + + "[" + userBundle.getBundleId() + "]", e); } } return super.addingService(reference); http://git-wip-us.apache.org/repos/asf/karaf/blob/ab704c6b/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 index 34eb761..2bf000c 100644 --- 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 @@ -1,15 +1,20 @@ /* - * Licensed 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 + * 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 + * 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. + * 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; @@ -20,8 +25,9 @@ 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); http://git-wip-us.apache.org/repos/asf/karaf/blob/ab704c6b/tooling/karaf-scr-maven-plugin/NOTICE ---------------------------------------------------------------------- diff --git a/tooling/karaf-scr-maven-plugin/NOTICE b/tooling/karaf-scr-maven-plugin/NOTICE new file mode 100644 index 0000000..89a72a2 --- /dev/null +++ b/tooling/karaf-scr-maven-plugin/NOTICE @@ -0,0 +1,71 @@ +Apache Karaf +Copyright 2010-2013 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/ab704c6b/tooling/karaf-scr-maven-plugin/src/main/java/org/apache/karaf/tooling/scr/ScrCommandMojo.java ---------------------------------------------------------------------- diff --git a/tooling/karaf-scr-maven-plugin/src/main/java/org/apache/karaf/tooling/scr/ScrCommandMojo.java b/tooling/karaf-scr-maven-plugin/src/main/java/org/apache/karaf/tooling/scr/ScrCommandMojo.java index 046554c..413bc6c 100644 --- a/tooling/karaf-scr-maven-plugin/src/main/java/org/apache/karaf/tooling/scr/ScrCommandMojo.java +++ b/tooling/karaf-scr-maven-plugin/src/main/java/org/apache/karaf/tooling/scr/ScrCommandMojo.java @@ -1,3 +1,21 @@ +/* + * 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.tooling.scr; import java.io.File; @@ -206,7 +224,7 @@ public class ScrCommandMojo extends AbstractMojo { } } } - return new String[] { + return new String[]{ activate != null ? activate.getName() : null, deactivate != null ? deactivate.getName() : null }; @@ -230,7 +248,7 @@ public class ScrCommandMojo extends AbstractMojo { } catch (NoSuchMethodException e0) { } } - return new String[] { + return new String[]{ bind != null ? bind.getName() : null, unbind != null ? unbind.getName() : null }; @@ -276,8 +294,8 @@ public class ScrCommandMojo extends AbstractMojo { parentUrls.add(url); } } - ClassLoader classLoader = new URLClassLoader(childUrls.toArray(new URL[] {}), - new URLClassLoader(parentUrls.toArray(new URL[] {}), getClass().getClassLoader())); + ClassLoader classLoader = new URLClassLoader(childUrls.toArray(new URL[]{}), + new URLClassLoader(parentUrls.toArray(new URL[]{}), getClass().getClassLoader())); return classLoader; } @@ -296,24 +314,24 @@ public class ScrCommandMojo extends AbstractMojo { * Set the service component header based on the scr files. */ private void setServiceComponentHeader(final List<String> files) { - if ( files != null && files.size() > 0 ) { + if (files != null && files.size() > 0) { final String svcHeader = project.getProperties().getProperty("Service-Component"); final Set<String> xmlFiles = new HashSet<String>(); - if ( svcHeader != null ) { + if (svcHeader != null) { final StringTokenizer st = new StringTokenizer(svcHeader, ","); - while ( st.hasMoreTokens() ) { + while (st.hasMoreTokens()) { final String token = st.nextToken(); xmlFiles.add(token.trim()); } } - for(final String path : files) { + for (final String path : files) { xmlFiles.add(path); } final StringBuilder sb = new StringBuilder(); boolean first = true; - for(final String entry : xmlFiles) { - if ( !first ) { + for (final String entry : xmlFiles) { + if (!first) { sb.append(", "); } else { first = false; http://git-wip-us.apache.org/repos/asf/karaf/blob/ab704c6b/tooling/karaf-scr-maven-plugin/src/main/java/org/apache/karaf/tooling/scr/ScrCommandSupport.java ---------------------------------------------------------------------- diff --git a/tooling/karaf-scr-maven-plugin/src/main/java/org/apache/karaf/tooling/scr/ScrCommandSupport.java b/tooling/karaf-scr-maven-plugin/src/main/java/org/apache/karaf/tooling/scr/ScrCommandSupport.java index c6c52ef..2a16ebb 100644 --- a/tooling/karaf-scr-maven-plugin/src/main/java/org/apache/karaf/tooling/scr/ScrCommandSupport.java +++ b/tooling/karaf-scr-maven-plugin/src/main/java/org/apache/karaf/tooling/scr/ScrCommandSupport.java @@ -1,18 +1,20 @@ /* - * 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 + * 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 + * 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. + * 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.tooling.scr; @@ -33,8 +35,6 @@ import org.osgi.service.component.ComponentContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - */ public class ScrCommandSupport extends AbstractCommand implements CompletableFunction { private static final Logger LOGGER = LoggerFactory.getLogger(ScrCommandSupport.class);
