Package fish.payara.micro.impl
Class PayaraMicroRuntimeImpl
- java.lang.Object
-
- fish.payara.micro.impl.PayaraMicroRuntimeImpl
-
- All Implemented Interfaces:
PayaraMicroRuntime
public class PayaraMicroRuntimeImpl extends Object implements PayaraMicroRuntime
This class represents a running Payara Micro server and enables you to manipulate a running server. All the methods can throw Illegal State Exception if the Payara Micro Server has been shutdown- Author:
- steve
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addCDIEventListener(CDIEventListener listener)
void
addClusterListener(PayaraClusterListener listener)
boolean
deploy(File war)
Deploys a new archive to a running Payara Micro instanceboolean
deploy(String name, InputStream is)
Deploy from an InputStream which can load the Java EE archiveboolean
deploy(String name, String contextRoot, File war)
Deploys a new archive to a running Payara Micro instanceboolean
deploy(String name, String contextRoot, InputStream is)
Deploy from an InputStream which can load the Java EE archiveCollection<InstanceDescriptor>
getClusteredPayaras()
Returns a collection if instance descriptors for all the Payara Micros in the clusterCollection<String>
getDeployedApplicationNames()
Returns the names of the deployed applicationsString
getInstanceName()
Returns the instance nameInstanceDescriptor
getLocalDescriptor()
void
publishCDIEvent(PayaraClusteredCDIEvent event)
void
removeCDIEventListener(CDIEventListener listener)
void
removeClusterListener(PayaraClusterListener listener)
Map<InstanceDescriptor,Future<? extends ClusterCommandResult>>
run(String command, String... args)
Runs an asadmin command on all members of the Payara Micro Cluster Functionally equivalent to the run method of the ClusterCommandRunner passing in all cluster members obtained from getClusteredPayaras()Map<InstanceDescriptor,Future<? extends ClusterCommandResult>>
run(Collection<InstanceDescriptor> members, String command, String... args)
Runs an asadmin command on specified members of the Payara Micro Cluster Functionally equivalent to the run method of the ClusterCommandRunner passing in all cluster members obtained from getClusteredPayaras()<T extends Serializable>
Map<InstanceDescriptor,Future<T>>run(Collection<InstanceDescriptor> members, Callable<T> callable)
Deprecated.This method has an undefined ClassLoader and is unusable by a user, as it only operates on server ClassLoader rather than on application ClassLoader
{It will be removed in the upcoming releases}.<T extends Serializable>
Map<InstanceDescriptor,Future<T>>run(Callable<T> callable)
Deprecated.This method has an undefined ClassLoader and is unusable by a user, as it only operates on server ClassLoader rather than on application ClassLoader
{It will be removed in the upcoming releases}.void
shutdown()
Stops and then shuts down the Payara Micro Servervoid
undeploy(String name)
Undeploys the named application
-
-
-
Method Detail
-
getInstanceName
public String getInstanceName()
Returns the instance name- Specified by:
getInstanceName
in interfacePayaraMicroRuntime
- Returns:
-
shutdown
public void shutdown() throws BootstrapException
Stops and then shuts down the Payara Micro Server- Specified by:
shutdown
in interfacePayaraMicroRuntime
- Throws:
BootstrapException
-
getClusteredPayaras
public Collection<InstanceDescriptor> getClusteredPayaras()
Returns a collection if instance descriptors for all the Payara Micros in the cluster- Specified by:
getClusteredPayaras
in interfacePayaraMicroRuntime
- Returns:
-
getDeployedApplicationNames
public Collection<String> getDeployedApplicationNames()
Returns the names of the deployed applications- Specified by:
getDeployedApplicationNames
in interfacePayaraMicroRuntime
- Returns:
- a collection of names or null if there was a problem
-
run
public Map<InstanceDescriptor,Future<? extends ClusterCommandResult>> run(String command, String... args)
Runs an asadmin command on all members of the Payara Micro Cluster Functionally equivalent to the run method of the ClusterCommandRunner passing in all cluster members obtained from getClusteredPayaras()- Specified by:
run
in interfacePayaraMicroRuntime
- Parameters:
command
- The name of the asadmin command to runargs
- The parameters to the command- Returns:
-
run
public Map<InstanceDescriptor,Future<? extends ClusterCommandResult>> run(Collection<InstanceDescriptor> members, String command, String... args)
Runs an asadmin command on specified members of the Payara Micro Cluster Functionally equivalent to the run method of the ClusterCommandRunner passing in all cluster members obtained from getClusteredPayaras()- Specified by:
run
in interfacePayaraMicroRuntime
- Parameters:
command
- The name of the asadmin command to runargs
- The parameters to the command- Returns:
-
run
@Deprecated public <T extends Serializable> Map<InstanceDescriptor,Future<T>> run(Callable<T> callable)
Deprecated.This method has an undefined ClassLoader and is unusable by a user, as it only operates on server ClassLoader rather than on application ClassLoader
{It will be removed in the upcoming releases}.Runs a Callable object on all members of the Payara Micro Cluster Functionally equivalent to the run method on ClusterCommandRunner passing in all cluster members obtained from getClusteredPayaras()- Specified by:
run
in interfacePayaraMicroRuntime
- Type Parameters:
T
- The Type of the Callable- Parameters:
callable
- The Callable object to run- Returns:
-
run
@Deprecated public <T extends Serializable> Map<InstanceDescriptor,Future<T>> run(Collection<InstanceDescriptor> members, Callable<T> callable)
Deprecated.This method has an undefined ClassLoader and is unusable by a user, as it only operates on server ClassLoader rather than on application ClassLoader
{It will be removed in the upcoming releases}.Runs a Callable object on specified members of the Payara Micro Cluster Functionally equivalent to the run method on ClusterCommandRunner passing in all cluster members obtained from getClusteredPayaras()- Specified by:
run
in interfacePayaraMicroRuntime
- Type Parameters:
T
- The Type of the Callable- Parameters:
members
- The collection of members to run the callable oncallable
- The Callable object to run- Returns:
-
deploy
public boolean deploy(String name, String contextRoot, InputStream is)
Deploy from an InputStream which can load the Java EE archive- Specified by:
deploy
in interfacePayaraMicroRuntime
- Parameters:
name
- The name of the deploymentcontextRoot
- The context root to deploy the application tois
- InputStream to load the war through- Returns:
- true if deployment was successful
-
deploy
public boolean deploy(String name, InputStream is)
Deploy from an InputStream which can load the Java EE archive- Specified by:
deploy
in interfacePayaraMicroRuntime
- Parameters:
name
- The name of the deployment and the context root of the deployment if a war fileis
- InputStream to load the war through- Returns:
- true if deployment was successful
-
deploy
public boolean deploy(String name, String contextRoot, File war)
Deploys a new archive to a running Payara Micro instance- Specified by:
deploy
in interfacePayaraMicroRuntime
- Parameters:
name
- The name to give the application once deployedcontextRoot
- The context root to give the applicationwar
- A File object representing the archive to deploy, it can be an exploded directory- Returns:
-
deploy
public boolean deploy(File war)
Deploys a new archive to a running Payara Micro instance- Specified by:
deploy
in interfacePayaraMicroRuntime
- Parameters:
war
- A File object representing the archive to deploy, it can be an exploded directory- Returns:
- true if the file deployed successfully
-
undeploy
public void undeploy(String name)
Undeploys the named application- Specified by:
undeploy
in interfacePayaraMicroRuntime
- Parameters:
name
- Name of the application to undeploy
-
removeClusterListener
public void removeClusterListener(PayaraClusterListener listener)
- Specified by:
removeClusterListener
in interfacePayaraMicroRuntime
-
addClusterListener
public void addClusterListener(PayaraClusterListener listener)
- Specified by:
addClusterListener
in interfacePayaraMicroRuntime
-
publishCDIEvent
public void publishCDIEvent(PayaraClusteredCDIEvent event)
- Specified by:
publishCDIEvent
in interfacePayaraMicroRuntime
-
addCDIEventListener
public void addCDIEventListener(CDIEventListener listener)
- Specified by:
addCDIEventListener
in interfacePayaraMicroRuntime
-
getLocalDescriptor
public InstanceDescriptor getLocalDescriptor()
- Specified by:
getLocalDescriptor
in interfacePayaraMicroRuntime
-
removeCDIEventListener
public void removeCDIEventListener(CDIEventListener listener)
- Specified by:
removeCDIEventListener
in interfacePayaraMicroRuntime
-
-