You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by dj...@apache.org on 2014/06/15 03:10:15 UTC
svn commit: r1602645 - in /felix/trunk/scr/src:
main/java/org/apache/felix/scr/ main/java/org/apache/felix/scr/impl/
main/java/org/apache/felix/scr/impl/config/
main/java/org/apache/felix/scr/impl/manager/
main/java/org/apache/felix/scr/impl/runtime/ t...
Author: djencks
Date: Sun Jun 15 01:10:14 2014
New Revision: 1602645
URL: http://svn.apache.org/r1602645
Log:
FELIX-4401, FELIX-4402 Remove obsolete proprietary admin classes and split ComponentHolder interface into inward and outward facing pieces
Added:
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentContainer.java (with props)
Removed:
felix/trunk/scr/src/main/java/org/apache/felix/scr/Component.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/Reference.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/ScrService.java
Modified:
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentManager.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ReferenceManager.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/runtime/ServiceComponentRuntimeImpl.java
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/CircularFactoryTest.java
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/CircularReferenceTest.java
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/MutablePropertiesTest.java
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindTest.java
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680_2/Main.java
felix/trunk/scr/src/test/resources/integration_test_FELIX_3880_2.xml
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java Sun Jun 15 01:10:14 2014
@@ -20,26 +20,17 @@ package org.apache.felix.scr.impl;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
-import java.util.Dictionary;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.felix.scr.Component;
-import org.apache.felix.scr.ScrService;
-import org.apache.felix.scr.impl.config.ComponentContainer;
import org.apache.felix.scr.impl.config.ComponentHolder;
import org.apache.felix.scr.impl.config.ConfigurationSupport;
import org.apache.felix.scr.impl.config.ConfigurableComponentHolder;
import org.apache.felix.scr.impl.manager.AbstractComponentManager;
-import org.apache.felix.scr.impl.manager.ComponentFactoryImpl;
-import org.apache.felix.scr.impl.manager.ConfigurationComponentFactoryImpl;
import org.apache.felix.scr.impl.manager.DependencyManager;
import org.apache.felix.scr.impl.metadata.ComponentMetadata;
import org.osgi.framework.Bundle;
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ScrCommand.java Sun Jun 15 01:10:14 2014
@@ -23,24 +23,25 @@ import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
import java.util.TreeSet;
import java.util.regex.Pattern;
-import org.apache.felix.scr.Component;
-import org.apache.felix.scr.Reference;
import org.apache.felix.scr.ScrInfo;
-import org.apache.felix.scr.ScrService;
import org.apache.felix.scr.impl.config.ScrConfiguration;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.runtime.ServiceComponentRuntime;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
/**
* The <code>ScrCommand</code> class provides the implementations for the
@@ -52,12 +53,12 @@ public class ScrCommand implements ScrIn
{
private final BundleContext bundleContext;
- private final ScrService scrService;
+ private final ServiceComponentRuntime scrService;
private final ScrConfiguration scrConfiguration;
private ServiceRegistration reg;
- static ScrCommand register(BundleContext bundleContext, ScrService scrService, ScrConfiguration scrConfiguration)
+ static ScrCommand register(BundleContext bundleContext, ServiceComponentRuntime scrService, ScrConfiguration scrConfiguration)
{
final ScrCommand cmd = new ScrCommand(bundleContext, scrService, scrConfiguration);
@@ -110,7 +111,7 @@ public class ScrCommand implements ScrIn
return cmd;
}
- private ScrCommand(BundleContext bundleContext, ScrService scrService, ScrConfiguration scrConfiguration)
+ private ScrCommand(BundleContext bundleContext, ServiceComponentRuntime scrService, ScrConfiguration scrConfiguration)
{
this.bundleContext = bundleContext;
this.scrService = scrService;
@@ -147,7 +148,7 @@ public class ScrCommand implements ScrIn
*/
public void list(final String bundleIdentifier, final PrintWriter out)
{
- Component[] components;
+ List<ComponentDescriptionDTO> components;
if (bundleIdentifier != null)
{
@@ -177,7 +178,7 @@ public class ScrCommand implements ScrIn
}
if (ComponentRegistry.isBundleActive(bundle))
{
- components = scrService.getComponents(bundle);
+ components = new ArrayList<ComponentDescriptionDTO>(scrService.getComponentDescriptionDTOs(bundle));
if (components == null)
{
out.println("Bundle " + bundleIdentifier + " declares no components");
@@ -192,7 +193,7 @@ public class ScrCommand implements ScrIn
}
else
{
- components = scrService.getComponents();
+ components = new ArrayList<ComponentDescriptionDTO>(scrService.getComponentDescriptionDTOs());
if (components == null)
{
out.println("No components registered");
@@ -200,20 +201,20 @@ public class ScrCommand implements ScrIn
}
}
- Arrays.sort( components, new Comparator<Component>()
+ Collections.sort( components, new Comparator<ComponentDescriptionDTO>()
{
- public int compare(Component c1, Component c2)
+ public int compare(ComponentDescriptionDTO c1, ComponentDescriptionDTO c2)
{
- return Long.signum(c1.getId() - c2.getId());
+ return c1.name.compareTo(c2.name);
}
});
out.println(" Id State BundleId Name");
- for ( Component component : components )
+ for ( ComponentDescriptionDTO component : components )
{
- out.println( String.format( "[%1$4d] [%2$s] [%3$4d] %4$s", component.getId(), toStateString( component.getState() ), component.getBundle().getBundleId(), component.getName() ) );
+ out.println( String.format( "[%4$s] [%4$s] [%3$4d]", component.name, component.defaultEnabled , component.bundle.id ) );
}
out.flush();
}
@@ -223,7 +224,7 @@ public class ScrCommand implements ScrIn
*/
public void info(final String componentId, PrintWriter out)
{
- Component[] components = getComponentFromArg(componentId);
+/* Component[] components = getComponentFromArg(componentId);
if (components == null)
{
return;
@@ -396,10 +397,12 @@ public class ScrCommand implements ScrIn
}
}
out.flush();
+ */
}
void change(final String componentIdentifier, PrintWriter out, boolean enable)
{
+ /*
Component[] components = getComponentFromArg(componentIdentifier);
ArrayList<String> disposed = new ArrayList<String>();
if (components == null)
@@ -444,6 +447,7 @@ public class ScrCommand implements ScrIn
throw new IllegalArgumentException( "Components " + disposed + " already disposed, cannot change state" );
}
+ */
}
/* (non-Javadoc)
@@ -462,7 +466,7 @@ public class ScrCommand implements ScrIn
out.print("Info Service registered: ");
out.println(scrConfiguration.infoAsService() ? "Supported" : "Unsupported");
}
-
+/*
private String toStateString(int state)
{
switch (state) {
@@ -546,5 +550,5 @@ public class ScrCommand implements ScrIn
return components;
}
-
+*/
}
Added: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentContainer.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentContainer.java?rev=1602645&view=auto
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentContainer.java (added)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentContainer.java Sun Jun 15 01:10:14 2014
@@ -0,0 +1,46 @@
+/*
+ * 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.felix.scr.impl.config;
+
+import org.apache.felix.scr.impl.BundleComponentActivator;
+import org.apache.felix.scr.impl.manager.SingleComponentManager;
+import org.apache.felix.scr.impl.metadata.ComponentMetadata;
+
+public interface ComponentContainer<S>
+{
+
+ /**
+ * Returns the {@link BundleComponentActivator} owning this component
+ * holder. (overlaps ComponentHolder)
+ */
+ BundleComponentActivator getActivator();
+
+ /**
+ * Returns the {@link ComponentMetadata} describing and declaring this
+ * component. (overlaps ComponentHolder)
+ */
+ ComponentMetadata getComponentMetadata();
+
+ /**
+ * Informs the holder that the component has been disposed as a result of
+ * calling the dispose method.
+ */
+ void disposed(SingleComponentManager<S> component);
+
+}
\ No newline at end of file
Propchange: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentContainer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentContainer.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentContainer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentManager.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentManager.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ComponentManager.java Sun Jun 15 01:10:14 2014
@@ -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.felix.scr.impl.config;
import java.util.List;
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ReferenceManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ReferenceManager.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ReferenceManager.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/config/ReferenceManager.java Sun Jun 15 01:10:14 2014
@@ -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.felix.scr.impl.config;
import java.util.List;
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ComponentFactoryImpl.java Sun Jun 15 01:10:14 2014
@@ -19,7 +19,6 @@
package org.apache.felix.scr.impl.manager;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
@@ -27,7 +26,6 @@ import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
-import org.apache.felix.scr.Component;
import org.apache.felix.scr.component.ExtFactoryComponentInstance;
import org.apache.felix.scr.impl.BundleComponentActivator;
import org.apache.felix.scr.impl.TargetedPID;
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/ConfigurationComponentFactoryImpl.java Sun Jun 15 01:10:14 2014
@@ -25,7 +25,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.felix.scr.Component;
import org.apache.felix.scr.impl.TargetedPID;
import org.apache.felix.scr.impl.config.ComponentContainer;
import org.apache.felix.scr.impl.config.ComponentManager;
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java Sun Jun 15 01:10:14 2014
@@ -23,21 +23,14 @@ import java.security.Permission;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
-import org.apache.felix.scr.Component;
-import org.apache.felix.scr.Reference;
import org.apache.felix.scr.impl.BundleComponentActivator;
import org.apache.felix.scr.impl.config.ReferenceManager;
import org.apache.felix.scr.impl.helper.BindMethod;
@@ -63,9 +56,6 @@ import org.osgi.service.log.LogService;
*/
public class DependencyManager<S, T> implements ReferenceManager<S, T>
{
- // mask of states ok to send events
- private static final int STATE_MASK =
- Component.STATE_ACTIVE | Component.STATE_REGISTERED | Component.STATE_FACTORY;
// the component to which this dependency belongs
private final AbstractComponentManager<S> m_componentManager;
@@ -1116,19 +1106,17 @@ public class DependencyManager<S, T> imp
}
}
- //---------- Reference interface ------------------------------------------
-
- public String getServiceName()
+ private String getServiceName()
{
return m_dependencyMetadata.getInterface();
}
- public boolean isOptional()
+ boolean isOptional()
{
return m_dependencyMetadata.isOptional();
}
- public boolean isEffectivelyOptional()
+ private boolean isEffectivelyOptional()
{
return m_minCardinality == 0;
}
@@ -1143,40 +1131,22 @@ public class DependencyManager<S, T> imp
return m_minCardinality == serviceCount;
}
- public boolean isMultiple()
+ private boolean isMultiple()
{
return m_dependencyMetadata.isMultiple();
}
- public boolean isStatic()
+ private boolean isStatic()
{
return m_dependencyMetadata.isStatic();
}
- public boolean isReluctant()
+ private boolean isReluctant()
{
return m_dependencyMetadata.isReluctant();
}
- public String getBindMethodName()
- {
- return m_dependencyMetadata.getBind();
- }
-
-
- public String getUnbindMethodName()
- {
- return m_dependencyMetadata.getUnbind();
- }
-
-
- public String getUpdatedMethodName()
- {
- return m_dependencyMetadata.getUpdated();
- }
-
-
//---------- Service tracking support -------------------------------------
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/runtime/ServiceComponentRuntimeImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/runtime/ServiceComponentRuntimeImpl.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/runtime/ServiceComponentRuntimeImpl.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/runtime/ServiceComponentRuntimeImpl.java Sun Jun 15 01:10:14 2014
@@ -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.felix.scr.impl.runtime;
import java.util.ArrayList;
Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/CircularFactoryTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/CircularFactoryTest.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/CircularFactoryTest.java (original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/CircularFactoryTest.java Sun Jun 15 01:10:14 2014
@@ -22,7 +22,6 @@ import java.util.Iterator;
import junit.framework.TestCase;
-import org.apache.felix.scr.Component;
import org.apache.felix.scr.integration.components.circularFactory.FactoryClient;
import org.junit.Test;
import org.junit.runner.RunWith;
Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/CircularReferenceTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/CircularReferenceTest.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/CircularReferenceTest.java (original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/CircularReferenceTest.java Sun Jun 15 01:10:14 2014
@@ -21,7 +21,6 @@
package org.apache.felix.scr.integration;
import junit.framework.TestCase;
-import org.apache.felix.scr.Component;
import org.apache.felix.scr.integration.components.circular.A;
import org.apache.felix.scr.integration.components.circular.B;
import org.junit.Test;
Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java (original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentConfigurationTest.java Sun Jun 15 01:10:14 2014
@@ -24,7 +24,6 @@ import java.util.Collection;
import junit.framework.Assert;
import junit.framework.TestCase;
-import org.apache.felix.scr.Component;
import org.apache.felix.scr.integration.components.SimpleComponent;
import org.apache.felix.scr.integration.components.SimpleServiceImpl;
import org.junit.Test;
Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java (original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java Sun Jun 15 01:10:14 2014
@@ -60,9 +60,6 @@ import javax.inject.Inject;
import junit.framework.Assert;
import junit.framework.TestCase;
-import org.apache.felix.scr.Component;
-import org.apache.felix.scr.Reference;
-import org.apache.felix.scr.ScrService;
import org.junit.After;
import org.junit.Before;
import org.ops4j.pax.exam.CoreOptions;
@@ -780,40 +777,6 @@ public abstract class ComponentTestBase
}
}
- private String toStateString( int state )
- {
- switch ( state )
- {
- case Component.STATE_DISABLED:
- return "disabled";
- case Component.STATE_UNSATISFIED:
- return "unsatisfied";
- case Component.STATE_ACTIVE:
- return "active";
- case Component.STATE_REGISTERED:
- return "registered";
- case Component.STATE_FACTORY:
- return "factory";
- case Component.STATE_DISPOSED:
- return "disposed";
-
- case Component.STATE_ENABLING:
- return "enabling";
- case Component.STATE_ENABLED:
- return "enabled";
- case Component.STATE_ACTIVATING:
- return "activating";
- case Component.STATE_DEACTIVATING:
- return "deactivating";
- case Component.STATE_DISABLING:
- return "disabling";
- case Component.STATE_DISPOSING:
- return "disposing";
- default:
- return String.valueOf( state );
- }
- }
-
// Used to ignore logs displayed by the framework from stdout.
// (the log service will log it because it listen to fwk error
// events ...).
Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/MutablePropertiesTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/MutablePropertiesTest.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/MutablePropertiesTest.java (original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/MutablePropertiesTest.java Sun Jun 15 01:10:14 2014
@@ -25,7 +25,6 @@ import java.util.Hashtable;
import junit.framework.Assert;
import junit.framework.TestCase;
-import org.apache.felix.scr.Component;
import org.apache.felix.scr.integration.components.MutatingService;
import org.apache.felix.scr.integration.components.SimpleServiceImpl;
import org.junit.Test;
Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindTest.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindTest.java (original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/ServiceBindTest.java Sun Jun 15 01:10:14 2014
@@ -22,7 +22,6 @@ package org.apache.felix.scr.integration
import java.util.Hashtable;
import junit.framework.TestCase;
-import org.apache.felix.scr.Component;
import org.apache.felix.scr.integration.components.SimpleComponent;
import org.apache.felix.scr.integration.components.SimpleComponent2;
import org.apache.felix.scr.integration.components.SimpleService2Impl;
Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java (original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680/Main.java Sun Jun 15 01:10:14 2014
@@ -28,10 +28,10 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.felix.scr.Component;
-import org.apache.felix.scr.ScrService;
import org.osgi.framework.ServiceReference;
import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.runtime.ServiceComponentRuntime;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
import org.osgi.service.log.LogService;
public class Main implements Runnable
@@ -46,9 +46,9 @@ public class Main implements Runnable
private volatile AtomicInteger _counter = new AtomicInteger();
private volatile Random _rnd = new Random();
private volatile LogService _logService;
- private ScrService _scr;
private volatile Thread _thread;
private volatile boolean _running;
+ private ServiceComponentRuntime _scr;
/**
* Helper used to randomly enable or disable a list of components.
@@ -120,7 +120,7 @@ public class Main implements Runnable
}
}
- void bindSCR(ScrService scr)
+ void bindSCR(ServiceComponentRuntime scr)
{
_scr = scr;
}
@@ -246,48 +246,11 @@ public class Main implements Runnable
private void dumpState(StringWriter sw, String name)
{
- org.apache.felix.scr.Component[] comps = _scr.getComponents(name);
- if (comps == null || comps.length == 0)
- {
- _logService.log(LogService.LOG_ERROR, "could not find component state " + name, null);
- return;
- }
- org.apache.felix.scr.Component c = comps[0];
+ ComponentDescriptionDTO c = _scr.getComponentDescriptionDTO(_ctx.getBundleContext().getBundle(), name);
if ( c != null )
{
- sw.append( name ).append( "[" ).append( getState( c ) ).append( "] " );
+ sw.append( name ).append( "[" ).append( _scr.isComponentEnabled(c)? "enabled":"disabled" ).append( "] " );
}
}
- private CharSequence getState(org.apache.felix.scr.Component c)
- {
- switch (c.getState()) {
- case org.apache.felix.scr.Component.STATE_ACTIVATING:
- return "activating";
- case org.apache.felix.scr.Component.STATE_ACTIVE:
- return "active";
- case org.apache.felix.scr.Component.STATE_DEACTIVATING:
- return "deactivating";
- case org.apache.felix.scr.Component.STATE_DISABLED:
- return "disabled";
- case org.apache.felix.scr.Component.STATE_DISABLING:
- return "disabling";
- case org.apache.felix.scr.Component.STATE_DISPOSED:
- return "disposed";
- case org.apache.felix.scr.Component.STATE_DISPOSING:
- return "disposing";
- case org.apache.felix.scr.Component.STATE_ENABLED:
- return "enabled";
- case org.apache.felix.scr.Component.STATE_ENABLING:
- return "enabling";
- case org.apache.felix.scr.Component.STATE_FACTORY:
- return "factory";
- case org.apache.felix.scr.Component.STATE_REGISTERED:
- return "registered";
- case org.apache.felix.scr.Component.STATE_UNSATISFIED:
- return "unsatisfied";
- default:
- return "?";
- }
- }
}
Modified: felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680_2/Main.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680_2/Main.java?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680_2/Main.java (original)
+++ felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680_2/Main.java Sun Jun 15 01:10:14 2014
@@ -29,12 +29,13 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.felix.scr.ScrService;
import org.apache.felix.scr.impl.manager.ThreadDump;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.runtime.ServiceComponentRuntime;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
import org.osgi.service.log.LogService;
@@ -46,7 +47,7 @@ public class Main implements Runnable
private volatile CountDownLatch m_enabledLatch;
private volatile CountDownLatch m_disabledLatch;
private volatile LogService m_logService;
- private ScrService m_scr;
+ private ServiceComponentRuntime m_scr;
private final Executor m_exec = Executors.newFixedThreadPool( 12 );
private volatile BundleContext m_bctx;
volatile ConcurrentHashMap<Class, ServiceRegistration> m_registrations = new ConcurrentHashMap<Class, ServiceRegistration>();
@@ -146,7 +147,7 @@ public class Main implements Runnable
}
- void bindSCR( ScrService scr )
+ void bindSCR( ServiceComponentRuntime scr )
{
m_scr = scr;
}
@@ -300,42 +301,10 @@ public class Main implements Runnable
private void dumpA()
{
- org.apache.felix.scr.Component c = m_scr
- .getComponents( "org.apache.felix.scr.integration.components.felix3680_2.A" )[0];
- m_logService.log( LogService.LOG_WARNING, "State of " + c + ":" + getState( c ) + "\n" );
+ ComponentDescriptionDTO c = m_scr
+ .getComponentDescriptionDTO(m_bctx.getBundle(), "org.apache.felix.scr.integration.components.felix3680_2.A" );
+ m_logService.log( LogService.LOG_WARNING, "State of " + c.name + " enabled:" + m_scr.isComponentEnabled(c) + "\n" );
}
- private CharSequence getState( org.apache.felix.scr.Component c )
- {
- switch ( c.getState() )
- {
- case org.apache.felix.scr.Component.STATE_ACTIVATING:
- return "activating";
- case org.apache.felix.scr.Component.STATE_ACTIVE:
- return "active";
- case org.apache.felix.scr.Component.STATE_DEACTIVATING:
- return "deactivating";
- case org.apache.felix.scr.Component.STATE_DISABLED:
- return "disabled";
- case org.apache.felix.scr.Component.STATE_DISABLING:
- return "disabling";
- case org.apache.felix.scr.Component.STATE_DISPOSED:
- return "disposed";
- case org.apache.felix.scr.Component.STATE_DISPOSING:
- return "disposing";
- case org.apache.felix.scr.Component.STATE_ENABLED:
- return "enabled";
- case org.apache.felix.scr.Component.STATE_ENABLING:
- return "enabling";
- case org.apache.felix.scr.Component.STATE_FACTORY:
- return "factory";
- case org.apache.felix.scr.Component.STATE_REGISTERED:
- return "registered";
- case org.apache.felix.scr.Component.STATE_UNSATISFIED:
- return "unsatisfied";
- default:
- return "?";
- }
- }
}
Modified: felix/trunk/scr/src/test/resources/integration_test_FELIX_3880_2.xml
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/test/resources/integration_test_FELIX_3880_2.xml?rev=1602645&r1=1602644&r2=1602645&view=diff
==============================================================================
--- felix/trunk/scr/src/test/resources/integration_test_FELIX_3880_2.xml (original)
+++ felix/trunk/scr/src/test/resources/integration_test_FELIX_3880_2.xml Sun Jun 15 01:10:14 2014
@@ -20,7 +20,7 @@
cardinality='0..1' bind='bindA' unbind='unbindA' policy='dynamic' />
<reference name='logService' interface='org.osgi.service.log.LogService'
bind='bindLogService' />
- <reference name='sCR' interface='org.apache.felix.scr.ScrService'
+ <reference name='sCR' interface='org.osgi.service.component.runtime.ServiceComponentRuntime'
bind='bindSCR' />
</scr:component>