|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DeploymentMBean
This MBean allows clients to obtain/deploy Service Bus configuration information from/to a Service Bus domain. Service Bus configuration is packaged as a simple jar file. The jar file contains Service Bus artifacts, such as proxy services, WSDLs, Business Services etc. The configuration jar file can span multiple projects, and may contain partial configuration information. For example, the user can export just a subset of a project, a whole project, or subsets of resources from many projects. There is no restriction on what the configuration jar file may contain. An end-to-end deployment scenario typically proceeds as follows:
import weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean; import weblogic.management.jmx.MBeanServerInvocationHandler; import javax.management.MBeanServerConnection; // obtain mbean server connection MBeanServerConnection mbconn = ... // first obtain the WLS DomainRuntimeServiceMBean DomainRuntimeServiceMBean serviceMBean = (DomainRuntimeServiceMBean) MBeanServerInvocationHandler. newProxyInstance(mbconn, new ObjectName(DomainRuntimeServiceMBean.OBJECT_NAME)); // then obtain Service Bus DeploymentMBean DeploymentMBean mbean = (DeploymentMBean) serviceMBean.findService(DeploymentMBean.NAME, DeploymentMBean.TYPE, null);
One version returns a byte array that make up the contents of the exported jar file
(See export(String[], Ref[], boolean)
and exportAll()
).
The caller of these methods can simply save the byte array in any file, or simply pass
it as import data to another Service Bus domain.
The second version (export(File, String[], Ref[], boolean)
and
exportAll(File)
) simply passes a File
object as an argument to
these methods, so that the contents of the exported jar is saved into the given file.
You can use this version only when the client invoking the mbean and the Admin server
are on the same physical machine.
Export api always exports the definitions from the core state as opposed to a session. This is the state which the server runs on.
The following example uses the first version to export all the resources in project A, and one addition service outside project A.
Ref myServiceRef = Ref.makeServiceRef(myProject, "myService"); byte[] bytes = mbean.export(new String[] {"A"}, new Ref[] {myServiceRef}, true);
// first obtain a session String session = mbean.openImportSession(); // then import into session only the resources that are in project A mbean.importIntoSession(session, bytes, new String[] {"A"}, null); // then replace the substring 'localhost' in the // service URIs with string 'productionhost' int numReplaced = mbean.findAndReplaceEnvValues(session, TypeIds.URI_ENV_VALUE_TYPE, "localhost", "productionhost"); // finally submit if (mbean.isSessionReadyForCommit(session)) { mbean.commitImportSession(session); } else { // notify the user. When this happens the user has to log in to the // Service Bus console and see what errors exist with the session System.out.println("There are problems with the imported file."); System.out.pritln("Session " + session + "cannot be committed."); }
Field Summary | |
---|---|
static String |
NAME
|
static String |
TYPE
|
Method Summary | |
---|---|
void |
commitImportSession(String session)
Commits the given session, effectively saving the contents of the session to the core state. |
void |
discardImportSession(String session)
Discards the given session. |
void |
export(File jarfile,
String[] projects,
Ref[] resources,
boolean includeDependencies)
Convenience method for exporting resources to the given jar file. |
byte[] |
export(String[] projects,
Ref[] resources,
boolean includeDependencies)
Exports resources and returns the contents of the jar file. |
byte[] |
exportAll()
Exports all resources in the domain the jar file. |
void |
exportAll(File jarfile)
Convenience method for exporting all resources in the domain to the given jar file. |
int |
findAndReplaceEnvValues(String session,
String envValueType,
String stringToReplace,
String replacement)
changes environment values by finding strings within them and replacing the substrings with the given replacement. |
void |
importIntoSession(String session,
byte[] contentsOfJarFile)
Imports all resources that are contained in the given jar file into a session |
void |
importIntoSession(String session,
byte[] contentsOfJarFile,
String[] projects,
Ref[] resources)
Imports selected resources from the given jar file into a session. |
void |
importIntoSession(String session,
File jarfile)
Convenience method for importing selected resources that are contained in the given jar file into a session |
void |
importIntoSession(String session,
File jarfile,
String[] projects,
Ref[] resources)
Convenience method for importing selected resources from the given jar file into a session. |
boolean |
isSessionReadyForCommit(String session)
Returns true if the session has no conflicts and can be committed successfully. |
String |
openImportSession()
Opens a session for staging one or more configuration jar files. |
Methods inherited from interface weblogic.management.mbeanservers.Service |
---|
getName, getParentService, getType |
Field Detail |
---|
static final String NAME
static final String TYPE
Method Detail |
---|
byte[] export(String[] projects, Ref[] resources, boolean includeDependencies) throws Exception
projects
- projects to export. This is a convenience parameter for exporting all resources
in a particular project without having to enumerate the resources. This argument can be
null or empty array.resources
- resources to export along with any resources that are exported as
a result of exporting projects. This argument can be used to export resources selectively
without having to export a whole projectincludeDependencies
- if true, all resources that are required by the resources explicitly given
are also exported.
Exception
byte[] exportAll() throws Exception
Exception
void exportAll(File jarfile) throws Exception
jarfile
- the jar file where the exported data will be stored
Exception
void export(File jarfile, String[] projects, Ref[] resources, boolean includeDependencies) throws Exception
Exception
export(String[], com.bea.wli.config.Ref[], boolean)
String openImportSession() throws Exception
Exception
boolean isSessionReadyForCommit(String session) throws Exception
session
- name of the session
Exception
void commitImportSession(String session) throws Exception
session
- name of the session.
Exception
- if the commit fails.void discardImportSession(String session) throws Exception
session
- name of the session
Exception
void importIntoSession(String session, File jarfile, String[] projects, Ref[] resources) throws Exception
session
- the name of the session to import intojarfile
- the jar file to importprojects
- projects whose resources will be imported into session. This is a convenience argument for
importing all the resources in a project.resources
- resources that will be imported into the session, in addition to any resources that are
already imported via the projects
argument.
Exception
- if the given projects or resources are not found, or if the import fails due to another reason.void importIntoSession(String session, File jarfile) throws Exception
session
- the name of the session to import into.jarfile
- the name of the jar file
Exception
- if the import fails.void importIntoSession(String session, byte[] contentsOfJarFile, String[] projects, Ref[] resources) throws Exception
session
- the name of the session to import intocontentsOfJarFile
- byte contents of the jar file that is being importedprojects
- projects whose resources will be imported into session. This is a convenience argument for
importing all the resources in a project.resources
- resources that will be imported into the session, in addition to any resources that are
already imported via the projects
argument.
Exception
- if the given projects or resources are not found, or if the import fails due to another reason.void importIntoSession(String session, byte[] contentsOfJarFile) throws Exception
session
- the name of the session to import into.contentsOfJarFile
- byte contents of the jar file that is being imported
Exception
- if the import fails.int findAndReplaceEnvValues(String session, String envValueType, String stringToReplace, String replacement) throws Exception
session
- the name of the session in which to perform substitutionsenvValueType
- the type of environment values to change.stringToReplace
- substring to replacereplacement
- the replacement string.
Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |