Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply project settings to o.e.equinox.device #363

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/org.eclipse.equinox.device/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-Version: 1.1.400.qualifier
Bundle-Version: 1.1.500.qualifier
Bundle-Activator: org.eclipse.equinox.device.Activator
Bundle-SymbolicName: org.eclipse.equinox.device
Bundle-Vendor: %bundleVendor
Expand Down
2 changes: 1 addition & 1 deletion bundles/org.eclipse.equinox.device/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ <h3>License</h3>
</p>

</body>
</html>
</html>
2 changes: 1 addition & 1 deletion bundles/org.eclipse.equinox.device/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ output.. = bin/
pom.model.property.code.ignoredWarnings = -warn:-deprecation,raw,unchecked,discouraged,warningToken

## Configuration for TCK tests to execute for this project
pom.model.property.tck.artifact = org.osgi.test.cases.device
pom.model.property.tck.artifact = org.osgi.test.cases.device
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
* DeviceManager bundle. This bundle implements the OSGi Device Access 1.1
* specification.
*
* This implementation does not include the optimizations in section
* 8.7.4 of the OSGi SP R2 spec.
* This implementation does not include the optimizations in section 8.7.4 of
* the OSGi SP R2 spec.
*
*/
public class Activator implements BundleActivator, ServiceTrackerCustomizer, FrameworkListener, Runnable {
Expand Down Expand Up @@ -113,12 +113,17 @@ public void start(BundleContext contxt) throws Exception {
log = new LogTracker(context, System.err);

try {
deviceFilter = context.createFilter("(|(" + org.osgi.framework.Constants.OBJECTCLASS + "=" + DeviceTracker.clazz + ////-1$ ////-2$ //$NON-NLS-1$ //$NON-NLS-2$
")(" + org.osgi.service.device.Constants.DEVICE_CATEGORY + "=*))"); //$NON-NLS-1$ //$NON-NLS-2$

driverFilter = context.createFilter("(" + org.osgi.framework.Constants.OBJECTCLASS + "=" + DriverTracker.clazz + ")"); ////-1$ ////-2$ ////-3$ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
deviceFilter = context
.createFilter("(|(" + org.osgi.framework.Constants.OBJECTCLASS + "=" + DeviceTracker.clazz + //// -1$ //$NON-NLS-1$ //$NON-NLS-2$
//// ////-2$
")(" + org.osgi.service.device.Constants.DEVICE_CATEGORY + "=*))"); //$NON-NLS-1$ //$NON-NLS-2$

driverFilter = context
.createFilter("(" + org.osgi.framework.Constants.OBJECTCLASS + "=" + DriverTracker.clazz + ")"); //// -1$ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//// ////-2$
//// ////-3$
} catch (InvalidSyntaxException e) {
log.log(LogService.LOG_ERROR, NLS.bind(DeviceMsg.Unable_to_create_Filter_for_DeviceManager, e)); ////-1$
log.log(LogService.LOG_ERROR, NLS.bind(DeviceMsg.Unable_to_create_Filter_for_DeviceManager, e)); //// -1$
throw e;
}

Expand All @@ -130,13 +135,14 @@ public void start(BundleContext contxt) throws Exception {
try {
updatewait = Long.parseLong(prop) * 1000L;
} catch (NumberFormatException e) {
//do nothing
// do nothing
}
}

Bundle systemBundle = context.getBundle(0);

if ((systemBundle != null) && ((systemBundle.getState() & Bundle.STARTING) != 0)) { /* if the system bundle is starting */
if ((systemBundle != null)
&& ((systemBundle.getState() & Bundle.STARTING) != 0)) { /* if the system bundle is starting */
context.addFrameworkListener(this);
} else {
startDeviceManager();
Expand All @@ -152,17 +158,17 @@ public void start(BundleContext contxt) throws Exception {
*/
public void frameworkEvent(FrameworkEvent event) {
switch (event.getType()) {
case FrameworkEvent.STARTED : {
context.removeFrameworkListener(this);

try {
startDeviceManager();
} catch (Throwable t) {
log.log(LogService.LOG_ERROR, NLS.bind(DeviceMsg.DeviceManager_has_thrown_an_error, t)); ////-1$
}
case FrameworkEvent.STARTED: {
context.removeFrameworkListener(this);

break;
try {
startDeviceManager();
} catch (Throwable t) {
log.log(LogService.LOG_ERROR, NLS.bind(DeviceMsg.DeviceManager_has_thrown_an_error, t)); //// -1$
}

break;
}
}
}

Expand Down Expand Up @@ -215,7 +221,7 @@ public void stop(BundleContext contxt) throws Exception {
try {
t.wait(0);
} catch (InterruptedException e) {
// do nothing
// do nothing
}
}
}
Expand Down Expand Up @@ -253,18 +259,16 @@ public void stop(BundleContext contxt) throws Exception {
/**
* A service is being added to the ServiceTracker.
*
* <p>This method is called before a service which matched
* the search parameters of the ServiceTracker is
* added to the ServiceTracker. This method should return the
* service object to be tracked for this ServiceReference.
* The returned service object is stored in the ServiceTracker
* and is available from the getService and getServices
* methods.
* <p>
* This method is called before a service which matched the search parameters of
* the ServiceTracker is added to the ServiceTracker. This method should return
* the service object to be tracked for this ServiceReference. The returned
* service object is stored in the ServiceTracker and is available from the
* getService and getServices methods.
*
* @param reference Reference to service being added to the ServiceTracker.
* @return The service object to be tracked for the
* ServiceReference or <tt>null</tt> if the ServiceReference should not
* be tracked.
* @return The service object to be tracked for the ServiceReference or
* <tt>null</tt> if the ServiceReference should not be tracked.
*/
public Object addingService(ServiceReference reference) {
if (Activator.DEBUG) {
Expand All @@ -279,11 +283,12 @@ public Object addingService(ServiceReference reference) {
/**
* A service tracked by the ServiceTracker has been modified.
*
* <p>This method is called when a service being tracked
* by the ServiceTracker has had it properties modified.
* <p>
* This method is called when a service being tracked by the ServiceTracker has
* had it properties modified.
*
* @param reference Reference to service that has been modified.
* @param service The service object for the modified service.
* @param service The service object for the modified service.
*/
public void modifiedService(ServiceReference reference, Object service) {
// do nothing
Expand All @@ -292,19 +297,21 @@ public void modifiedService(ServiceReference reference, Object service) {
/**
* A service tracked by the ServiceTracker is being removed.
*
* <p>This method is called after a service is no longer being tracked
* by the ServiceTracker.
* <p>
* This method is called after a service is no longer being tracked by the
* ServiceTracker.
*
* @param reference Reference to service that has been removed.
* @param object The service object for the removed service.
* @param object The service object for the removed service.
*/
public void removedService(ServiceReference reference, Object object) {
if (Activator.DEBUG) {
log.log(reference, LogService.LOG_DEBUG, "DeviceManager device service unregistered"); //$NON-NLS-1$
}

/* We do not implement optional driver reclamation.
* Thus we take no specific action upon Device service unregistration .
/*
* We do not implement optional driver reclamation. Thus we take no specific
* action upon Device service unregistration .
*/
}

Expand All @@ -329,8 +336,7 @@ public void refineIdleDevices() {
/**
* Main thread for DeviceManager.
*
* Attempt to refine all Device services that are not in use
* by a driver bundle.
* Attempt to refine all Device services that are not in use by a driver bundle.
*/
public void run() {
while (running) {
Expand All @@ -345,14 +351,13 @@ public void run() {
try {
device.refine();
} catch (Throwable t) {
log.log(LogService.LOG_ERROR, NLS.bind(DeviceMsg.DeviceManager_has_thrown_an_error, t)); ////-1$
log.log(LogService.LOG_ERROR, NLS.bind(DeviceMsg.DeviceManager_has_thrown_an_error, t)); //// -1$
}
}
}

/**
* Queue the object to be processed on the work thread.
* The thread is notified.
* Queue the object to be processed on the work thread. The thread is notified.
*
* @param device Work item.
*/
Expand All @@ -379,26 +384,26 @@ public synchronized void enqueue(DeviceTracker device) {
}

/**
* Dequeue an object from the work thread.
* If the queue is empty, this method blocks.
* Dequeue an object from the work thread. If the queue is empty, this method
* blocks.
*
* @return Dequeue object from the work thread.
* @throws InterruptedException If the queue has been stopped.
*/
private synchronized DeviceTracker dequeue() throws InterruptedException {
while (running && (head == null)) {
// TODO need to determine if this code is needed (bug 261197)
/* This should be included per Section 8.7.7 of the OSGi SP R2
* spec, but it causes the OSGi SP R2 Test Suite to fail.
* We should turn this on for R3.

if (driverServiceRegistered)
/*
* This should be included per Section 8.7.7 of the OSGi SP R2 spec, but it
* causes the OSGi SP R2 Test Suite to fail. We should turn this on for R3.
*
* if (driverServiceRegistered)
*/
// if (false) {
// driverServiceRegistered = false;
// if (false) {
// driverServiceRegistered = false;
//
// refineIdleDevices();
// } else {
// refineIdleDevices();
// } else {
locators.uninstallDriverBundles();

try {
Expand All @@ -410,7 +415,7 @@ private synchronized DeviceTracker dequeue() throws InterruptedException {
} catch (InterruptedException e) {
// do nothing
}
// }
// }
}

if (!running) /* if we are stopping */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ public class DeviceMsg extends NLS {
// initialize resource bundles
NLS.initializeMessages(BUNDLE_NAME, DeviceMsg.class);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
import org.osgi.util.tracker.ServiceTracker;

/**
* DeviceTracker class. This class has the logic for refining a
* Device service.
* DeviceTracker class. This class has the logic for refining a Device service.
*
*/
public class DeviceTracker extends ServiceTracker {
Expand All @@ -48,7 +47,7 @@ public class DeviceTracker extends ServiceTracker {
* Create a DeviceTracker from a ServiceReference.
*
* @param manager DeviceManager object
* @param device ServiceReference to the Device service.
* @param device ServiceReference to the Device service.
*/
public DeviceTracker(Activator manager, ServiceReference device) {
super(manager.context, device, null);
Expand Down Expand Up @@ -84,18 +83,16 @@ public void close() {
/**
* A service is being added to the ServiceTracker.
*
* <p>This method is called before a service which matched
* the search parameters of the ServiceTracker is
* added to the ServiceTracker. This method should return the
* service object to be tracked for this ServiceReference.
* The returned service object is stored in the ServiceTracker
* and is available from the getService and getServices
* methods.
* <p>
* This method is called before a service which matched the search parameters of
* the ServiceTracker is added to the ServiceTracker. This method should return
* the service object to be tracked for this ServiceReference. The returned
* service object is stored in the ServiceTracker and is available from the
* getService and getServices methods.
*
* @param reference Reference to service being added to the ServiceTracker.
* @return The service object to be tracked for the
* ServiceReference or <tt>null</tt> if the ServiceReference should not
* be tracked.
* @return The service object to be tracked for the ServiceReference or
* <tt>null</tt> if the ServiceReference should not be tracked.
*/
public Object addingService(ServiceReference reference) {
if (Activator.DEBUG) {
Expand All @@ -114,11 +111,12 @@ public Object addingService(ServiceReference reference) {
/**
* A service tracked by the ServiceTracker has been modified.
*
* <p>This method is called when a service being tracked
* by the ServiceTracker has had it properties modified.
* <p>
* This method is called when a service being tracked by the ServiceTracker has
* had it properties modified.
*
* @param reference Reference to service that has been modified.
* @param service The service object for the modified service.
* @param service The service object for the modified service.
*/
public void modifiedService(ServiceReference reference, Object service) {
properties = new Properties(reference);
Expand All @@ -127,11 +125,12 @@ public void modifiedService(ServiceReference reference, Object service) {
/**
* A service tracked by the ServiceTracker is being removed.
*
* <p>This method is called after a service is no longer being tracked
* by the ServiceTracker.
* <p>
* This method is called after a service is no longer being tracked by the
* ServiceTracker.
*
* @param reference Reference to service that has been removed.
* @param service The service object for the removed service.
* @param service The service object for the removed service.
*/
public void removedService(ServiceReference reference, Object service) {
if (running) {
Expand Down Expand Up @@ -182,13 +181,12 @@ public void refine() {
/**
* Determine if the device service tracked by this object is idle.
*
* OSGi SP R2 Section 8.2.2 defines in idle device service as:
* "A Device service is not used by any other bundle according to the Framework;
* it is called an idle Device service."
* OSGi SP R2 Section 8.2.2 defines in idle device service as: "A Device service
* is not used by any other bundle according to the Framework; it is called an
* idle Device service."
*
* This method defines it as:
* A Device service is not used by any DRIVER bundle according to the Framework;
* it is called an idle Device service.
* This method defines it as: A Device service is not used by any DRIVER bundle
* according to the Framework; it is called an idle Device service.
*
* Thus if a non-driver bundle uses a device service, it is still considered
* idle by this method.
Expand Down Expand Up @@ -225,12 +223,13 @@ public boolean isIdle() {
}

/**
* Called by the device manager after it has failed to attach
* any driver to the device.
* Called by the device manager after it has failed to attach any driver to the
* device.
* <p>
* If the device can be configured in alternate ways, the driver
* may respond by unregistering the device service and registering
* a different device service instead.</p>
* If the device can be configured in alternate ways, the driver may respond by
* unregistering the device service and registering a different device service
* instead.
* </p>
*/

public void noDriverFound() {
Expand All @@ -239,8 +238,8 @@ public void noDriverFound() {
Object service = contxt.getService(device);

try {
//It is possible that this is a Free Format Device that does not
//implement Device
// It is possible that this is a Free Format Device that does not
// implement Device
if (service instanceof Device) {
log.log(device, LogService.LOG_INFO, DeviceMsg.Device_noDriverFound_called);

Expand Down Expand Up @@ -320,7 +319,7 @@ public Object get(String key) {
/**
* Override put to disable it. This Dictionary is readonly once built.
*
* @param key header name.
* @param key header name.
* @param value header value.
* @throws UnsupportedOperationException
*/
Expand Down
Loading
Loading