|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tuscany.sca.host.embedded.SCADomain org.apache.tuscany.sca.host.embedded.impl.HotUpdatableSCADomain
public class HotUpdatableSCADomain
An SCADomain that starts a Tuscany runtime supporting multiple SCA contribution jars. All contribution jars found in a repository directory will be contributed to the SCA domain. Any changes to the contributions in that repository will be automatically detected and the SCADomain updated accordingly. TODO: find how to properly add/remove contributions and start/activate the SCADomain TODO: support contributions that are folders as well as jar's TODO: needs to restart the entire SCADomain when a contribution changes as the domain classpath includes all the contribution jar's, would be nice to find a way to avoid this TODO: hot update requires copying contribution jars to a temp location to avoid the classpath lock preventing updating the contribution jars, would be nice to find a way to avoid that
Field Summary | |
---|---|
protected java.io.File |
contributionRepository
|
protected java.lang.String |
domainURI
|
protected java.util.HashMap<java.net.URL,java.lang.Long> |
existingContributions
|
protected boolean |
hotUpdateActive
|
protected int |
hotUpdateInterval
|
protected java.lang.Thread |
hotUpdateThread
|
protected java.lang.ClassLoader |
originalCCL
|
protected static java.lang.String |
REPOSITORY_FOLDER
|
protected EmbeddedSCADomain |
scaDomain
|
Fields inherited from class org.apache.tuscany.sca.host.embedded.SCADomain |
---|
theDomain |
Constructor Summary | |
---|---|
HotUpdatableSCADomain(java.lang.String domainURI,
java.io.File contributionRepository,
int hotupdateInterval)
|
Method Summary | ||
---|---|---|
protected void |
activateHotUpdate()
|
|
protected boolean |
areContributionsAltered(java.net.URL[] currentContrabutions)
|
|
|
cast(B target)
Cast a type-safe reference to a CallableReference. |
|
protected void |
checkForUpdates()
Checks if any of the contributions have been updated and if so restarts the SCADomain TODO: Ideally just the altered contribution would be restarted but thats not possible as the ClassLoader used by the SCADomain includes the old contribution so need to restart the entire domain to use a new ClassLoader. |
|
void |
close()
Close the SCA domain. |
|
protected java.net.URL[] |
copyContributionsToTemp(java.net.URL[] contributionJars)
Copies Files to a temp location returning the URLs of the new temp files. |
|
protected java.util.List |
getAddedContributions(java.net.URL[] currentContrabutions)
|
|
ComponentManager |
getComponentManager()
|
|
protected java.net.URL[] |
getContributionJarURLs(java.io.File repositoryDir)
|
|
protected java.util.HashMap<java.net.URL,java.lang.Long> |
getLastModified(java.net.URL[] contrabutions)
Returns the last modified times of the files pointed to by the URLs |
|
protected java.util.List |
getRemovedContributions(java.net.URL[] currentContrabutions)
|
|
|
getService(java.lang.Class<B> businessInterface,
java.lang.String serviceName)
Returns a proxy for a service provided by a component in the SCA domain. |
|
|
getServiceReference(java.lang.Class<B> businessInterface,
java.lang.String referenceName)
Returns a ServiceReference for a service provided by a component in the SCA domain. |
|
protected java.util.List<java.net.URL> |
getUpdatedContributions(java.net.URL[] currentContrabutions)
|
|
java.lang.String |
getURI()
Returns the URI of the SCA Domain. |
|
protected void |
initContributions(EmbeddedSCADomain scaDomain,
java.lang.ClassLoader cl,
java.net.URL[] contributionJars)
TODO: No idea what the 'correct' way to add/contribute and activate/start things to an scaDomain is but this seems to work. |
|
protected SCADomain |
initEmbeddedSCADomain()
|
|
protected void |
start()
|
Methods inherited from class org.apache.tuscany.sca.host.embedded.SCADomain |
---|
connect, newInstance, newInstance, newInstance, removeInstance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String domainURI
protected java.io.File contributionRepository
protected EmbeddedSCADomain scaDomain
protected boolean hotUpdateActive
protected java.lang.Thread hotUpdateThread
protected int hotUpdateInterval
protected java.util.HashMap<java.net.URL,java.lang.Long> existingContributions
protected java.lang.ClassLoader originalCCL
protected static final java.lang.String REPOSITORY_FOLDER
Constructor Detail |
---|
public HotUpdatableSCADomain(java.lang.String domainURI, java.io.File contributionRepository, int hotupdateInterval)
Method Detail |
---|
protected void start()
public void close()
SCADomain
close
in class SCADomain
protected SCADomain initEmbeddedSCADomain() throws ActivationException
ActivationException
protected java.net.URL[] getContributionJarURLs(java.io.File repositoryDir)
protected void initContributions(EmbeddedSCADomain scaDomain, java.lang.ClassLoader cl, java.net.URL[] contributionJars)
protected java.net.URL[] copyContributionsToTemp(java.net.URL[] contributionJars)
protected java.util.HashMap<java.net.URL,java.lang.Long> getLastModified(java.net.URL[] contrabutions)
protected void activateHotUpdate()
protected void checkForUpdates()
protected boolean areContributionsAltered(java.net.URL[] currentContrabutions)
protected java.util.List<java.net.URL> getUpdatedContributions(java.net.URL[] currentContrabutions) throws java.net.URISyntaxException
java.net.URISyntaxException
protected java.util.List getRemovedContributions(java.net.URL[] currentContrabutions) throws java.net.URISyntaxException
java.net.URISyntaxException
protected java.util.List getAddedContributions(java.net.URL[] currentContrabutions) throws java.net.URISyntaxException
java.net.URISyntaxException
public <B,R extends org.osoa.sca.CallableReference<B>> R cast(B target) throws java.lang.IllegalArgumentException
SCADomain
cast
in class SCADomain
B
- the Java type of the business interface for the referenceR
- the type of reference to be returnedtarget
- a reference proxy provided by the SCA runtime
java.lang.IllegalArgumentException
- if the supplied instance is not a
reference supplied by the SCA runtimepublic <B> B getService(java.lang.Class<B> businessInterface, java.lang.String serviceName)
SCADomain
getService
in class SCADomain
B
- the Java type of the business interface for the servicebusinessInterface
- the interface that will be used to invoke the
serviceserviceName
- the name of the service
public <B> org.osoa.sca.ServiceReference<B> getServiceReference(java.lang.Class<B> businessInterface, java.lang.String referenceName)
SCADomain
getServiceReference
in class SCADomain
B
- the Java type of the business interface for the servicebusinessInterface
- the interface that will be used to invoke the
servicereferenceName
- the name of the service
public java.lang.String getURI()
SCADomain
getURI
in class SCADomain
public ComponentManager getComponentManager()
getComponentManager
in class SCADomain
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |