-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added uxloader into default build. Solved issues with services not being
available. Will refactor these out into a common module some time soon (at least before I write another component, ;)).
- Loading branch information
1 parent
241bbfe
commit 5aa684e
Showing
10 changed files
with
138 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...uxloader/src/main/java/org/sakaiproject/kernel2/uxloader/ServiceDisappearedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.sakaiproject.kernel2.uxloader; | ||
|
||
public class ServiceDisappearedException extends Exception { | ||
public ServiceDisappearedException() { | ||
super(); | ||
} | ||
|
||
public ServiceDisappearedException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public ServiceDisappearedException(String message) { | ||
super(message); | ||
} | ||
|
||
public ServiceDisappearedException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...nel/bundles/uxloader/src/main/java/org/sakaiproject/kernel2/uxloader/ServiceResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.sakaiproject.kernel2.uxloader; | ||
|
||
import org.osgi.framework.BundleContext; | ||
import org.osgi.framework.ServiceReference; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class ServiceResolver { | ||
protected static final Logger logger = LoggerFactory.getLogger(ServiceResolver.class); | ||
|
||
private BundleContext bc; | ||
|
||
public ServiceResolver(BundleContext bc) { this.bc=bc; } | ||
|
||
public Object getService(Class klass) throws ServiceDisappearedException { | ||
ServiceReference ref=bc.getServiceReference(klass.getName()); | ||
if(ref==null) { | ||
logger.warn("Service disappeared: "+klass.getCanonicalName()); | ||
throw new ServiceDisappearedException("Service disappeared: "+klass.getCanonicalName()); | ||
} | ||
Object out=bc.getService(ref); | ||
logger.info("Got "+out); | ||
return out; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters