You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2007/10/05 02:11:36 UTC
svn commit: r582040 -
/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/
Author: jdillon
Date: Thu Oct 4 17:11:36 2007
New Revision: 582040
URL: http://svn.apache.org/viewvc?rev=582040&view=rev
Log:
Plexus descriptor adapters
Added:
geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/
geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java (with props)
geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentRequirementAdapter.java (with props)
geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentSetDescriptorAdapter.java (with props)
geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java (with props)
Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java?rev=582040&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java Thu Oct 4 17:11:36 2007
@@ -0,0 +1,105 @@
+/*
+ * 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.geronimo.gshell.plugin.adapter;
+
+import java.net.URI;
+
+import org.apache.geronimo.gshell.command.Command;
+import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+import org.apache.geronimo.gshell.descriptor.CommandConfiguration;
+import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
+import org.apache.geronimo.gshell.descriptor.CommandRequirement;
+import org.codehaus.plexus.component.repository.ComponentDescriptor;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentDescriptorAdapter
+ extends ComponentDescriptor
+{
+ private final CommandDescriptor command;
+
+ public ComponentDescriptorAdapter(final CommandDescriptor command) {
+ assert command != null;
+
+ this.command = command;
+
+ URI source = command.getSource();
+
+ if (source != null) {
+ setSource(source.toString());
+ }
+
+ setDescription(command.getDescription());
+
+ setAlias(null);
+
+ setRole(Command.class.getName());
+
+ setRoleHint(command.getId());
+
+ setImplementation(command.getImplementation());
+
+ setVersion(command.getVersion());
+
+ setComponentType(null);
+
+ setLifecycleHandler(null);
+
+ setComponentProfile(null);
+
+ setComponentFactory(null);
+
+ setComponentComposer(null);
+
+ setComponentConfigurator(null);
+
+ setRealmId(null);
+
+ setIsolatedRealm(false);
+
+ setInstantiationStrategy("per-lookup");
+
+ if (command.hasConfiguration()) {
+ setConfiguration(new PlexusConfigurationAdapter(command.getConfiguration()));
+ }
+
+ if (command.hasRequirements()) {
+ for (CommandRequirement requirement : command.getRequirements()) {
+ this.addRequirement(new ComponentRequirementAdapter(requirement));
+ }
+ }
+
+ //
+ // TODO: What to do about depencencies? Or are they just on the set level?
+ //
+ }
+
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+ public CommandDescriptor getCommand() {
+ return command;
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentDescriptorAdapter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentRequirementAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentRequirementAdapter.java?rev=582040&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentRequirementAdapter.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentRequirementAdapter.java Thu Oct 4 17:11:36 2007
@@ -0,0 +1,61 @@
+/*
+ * 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.geronimo.gshell.plugin.adapter;
+
+import org.codehaus.plexus.component.repository.ComponentRequirement;
+import org.apache.geronimo.gshell.descriptor.CommandRequirement;
+import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentRequirementAdapter
+ extends ComponentRequirement
+{
+ private final CommandRequirement requirement;
+
+ public ComponentRequirementAdapter(final CommandRequirement requirement) {
+ assert requirement != null;
+
+ this.requirement = requirement;
+
+ setRole(requirement.getType());
+
+ setRoleHint(requirement.getId());
+
+ setFieldName(requirement.getName());
+
+ //
+ // TODO: Figure out what this is actually used for...
+ //
+ // setFieldMappingType(null);
+ }
+
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+ public CommandRequirement getRequirement() {
+ return requirement;
+ }
+}
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentRequirementAdapter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentRequirementAdapter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentRequirementAdapter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentSetDescriptorAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentSetDescriptorAdapter.java?rev=582040&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentSetDescriptorAdapter.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentSetDescriptorAdapter.java Thu Oct 4 17:11:36 2007
@@ -0,0 +1,75 @@
+/*
+ * 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.geronimo.gshell.plugin.adapter;
+
+import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+import org.apache.geronimo.gshell.descriptor.CommandDescriptor;
+import org.apache.geronimo.gshell.descriptor.CommandSetDescriptor;
+import org.codehaus.plexus.component.repository.ComponentDescriptor;
+import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentSetDescriptorAdapter
+ extends ComponentSetDescriptor
+{
+ private final CommandSetDescriptor commands;
+
+ public ComponentSetDescriptorAdapter(final CommandSetDescriptor commands) {
+ assert commands != null;
+
+ this.commands = commands;
+
+ setId(commands.getId());
+
+ setIsolatedRealm(false);
+
+ if (!commands.isEmpty()) {
+ for (CommandDescriptor command : commands.getCommands()) {
+ ComponentDescriptor component = new ComponentDescriptorAdapter(command);
+
+ addComponentDescriptor(component);
+
+ //
+ // TODO: Should we attach our selves?
+ //
+ // component.setComponentSetDescriptor(this);
+ }
+ }
+
+ //
+ // FIXME: Need to figure out dependencies
+ //
+
+ setDependencies(null);
+ }
+
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+ public CommandSetDescriptor getCommands() {
+ return commands;
+ }
+}
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentSetDescriptorAdapter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentSetDescriptorAdapter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/ComponentSetDescriptorAdapter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java?rev=582040&view=auto
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java (added)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java Thu Oct 4 17:11:36 2007
@@ -0,0 +1,117 @@
+/*
+ * 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.geronimo.gshell.plugin.adapter;
+
+import org.apache.geronimo.gshell.common.tostring.ReflectionToStringBuilder;
+import org.apache.geronimo.gshell.common.tostring.ToStringStyle;
+import org.apache.geronimo.gshell.descriptor.CommandConfiguration;
+import org.apache.geronimo.gshell.descriptor.CommandConfigurationException;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.configuration.PlexusConfigurationException;
+
+/**
+ * ???
+ *
+ * @version $Rev$ $Date$
+ */
+public class PlexusConfigurationAdapter
+ implements PlexusConfiguration
+{
+ private final CommandConfiguration configuration;
+
+ public PlexusConfigurationAdapter(final CommandConfiguration configuration) {
+ assert configuration != null;
+
+ this.configuration = configuration;
+ }
+
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ }
+
+ public CommandConfiguration getConfiguration() {
+ return configuration;
+ }
+
+ //
+ // PlexusConfiguration
+ //
+
+ public String getName() {
+ return configuration.getName();
+ }
+
+ public String getValue() throws PlexusConfigurationException {
+ try {
+ return configuration.getValue();
+ }
+ catch (CommandConfigurationException e) {
+ throw new PlexusConfigurationException(e.getMessage(), e);
+ }
+ }
+
+ public String getValue(final String defaultValue) {
+ return configuration.getValue(defaultValue);
+ }
+
+ //
+ // FIXME: Finish...
+ //
+
+ public String[] getAttributeNames() {
+ return new String[0];
+ }
+
+ public String getAttribute(final String name) throws PlexusConfigurationException {
+ return null;
+ }
+
+ public String getAttribute(final String name, final String defaultValue) {
+ return null;
+ }
+
+ public PlexusConfiguration getChild(final String name) {
+ return null;
+ }
+
+ public PlexusConfiguration getChild(final int i) {
+ return null;
+ }
+
+ public PlexusConfiguration getChild(final String name, final boolean create) {
+ return null;
+ }
+
+ public PlexusConfiguration[] getChildren() {
+ return new PlexusConfiguration[0];
+ }
+
+ public PlexusConfiguration[] getChildren(final String name) {
+ return new PlexusConfiguration[0];
+ }
+
+ public void addChild(final PlexusConfiguration child) {
+ return;
+ }
+
+ public int getChildCount() {
+ return 0;
+ }
+}
\ No newline at end of file
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/plugin/adapter/PlexusConfigurationAdapter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain