Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 12, 2016
0 parents commit 58f7ba3
Show file tree
Hide file tree
Showing 770 changed files with 21,324 additions and 0 deletions.
Binary file added 4137.pdf
Binary file not shown.
Binary file added 4138.pdf
Binary file not shown.
Binary file added 9781430210573.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions Administration/.classpath
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/BEAHome/alsb30/alsb_3.0/lib/sb-kernel-api.jar"/>
<classpathentry kind="lib" path="C:/BEAHome/alsb30/wlserver_10.0/server/lib/weblogic.jar"/>
<classpathentry kind="lib" path="C:/BEAHome/alsb30/modules/com.bea.common.configfwk_1.1.0.0.jar"/>
<classpathentry kind="lib" path="C:/BEAHome/alsb30/alsb_3.0/lib/sb-kernel-resources.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
23 changes: 23 additions & 0 deletions Administration/.project
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Administration</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.bea.al.common.extractionMonitorBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.bea.al.common.flashlineNature</nature>
</natures>
</projectDescription>
5 changes: 5 additions & 0 deletions Administration/.settings/com.bea.wlw.xmlbeans.prefs
@@ -0,0 +1,5 @@
#Sun May 18 10:31:51 PDT 2008
default_output=.xbean_bin
eclipse.preferences.version=1
gen_root=.xbean_src
schema-type-name=AdministrationTypeSystem
6 changes: 6 additions & 0 deletions Administration/.settings/org.eclipse.wst.validation.prefs
@@ -0,0 +1,6 @@
#Sun May 18 10:31:51 PDT 2008
DELEGATES_PREFERENCE=delegateValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator\=org.eclipse.wst.wsdl.validation.internal.eclipse.Validator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator\=org.eclipse.wst.xsd.core.internal.validation.eclipse.Validator;
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;com.m7.wide.eclipse.project.JSPValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;com.m7.wide.eclipse.project.JSPELValidator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;com.m7.wide.eclipse.project.XMLValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;
USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator;com.m7.wide.eclipse.project.JSPValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;com.m7.wide.eclipse.project.JSPELValidator;org.eclipse.wst.dtd.core.internal.validation.eclipse.Validator;com.m7.wide.eclipse.project.XMLValidator;org.eclipse.wst.xsd.core.internal.validation.eclipse.XSDDelegatingValidator;
USER_PREFERENCE=overrideGlobalPreferencesfalse
eclipse.preferences.version=1
Binary file not shown.
54 changes: 54 additions & 0 deletions Administration/DeployCluster/build.xml
@@ -0,0 +1,54 @@
<project default="export">
<!-- ALSB domain creation project -->
<property environment="env" />
<property name="domain.export.script" value="export.py" />
<property name="domain.import.script" value="import.py" />
<property name="export.config.file" value="export.properties" />
<property name="import.config.file" value="import.properties" />
<property name="build" value="build" />
<property name="dist" value="dist" />
<!-- The bea.home property hold that name of the directory where you installed ALSB 3.0.
you need to change this value so that it matches your installation directory.
-->
<property name="bea.home" value="C:/BEAHome/alsb30" />

<property name="weblogic.home" value="${bea.home}/wlserver_10.0" />

<path id="wlst.class.path">
<fileset dir="${bea.home}/alsb_3.0/lib">
<include name="sb-kernel-api.jar" />
</fileset>
<fileset dir="${bea.home}/modules">
<include name="com.bea.common.configfwk_1.1.0.0.jar" />
</fileset>
<fileset dir="${weblogic.home}/server/lib">
<include name="weblogic.jar" />
<include name="webserviceclient.jar" />
</fileset>
</path>

<taskdef name="wlst" classname="weblogic.ant.taskdefs.management.WLSTTask" classpathref="wlst.class.path" />

<target name="export">
<echo message="exportscript: ${domain.export.script}" />
<java classname="weblogic.WLST" fork="true">
<classpath refid="wlst.class.path" />
<arg line="${domain.export.script} ${export.config.file}" />
</java>
</target>

<target name="import">
<echo message="Running the ImportProject.java file" />
<java classname="com.alsb.admin.ImportPproject" fork="true">
<classpath refid="wlst.class.path" />
</java>
</target>

<target name="clean">
<delete dir="${dist}" />
<delete dir="${build}" />
<mkdir dir="${dist}" />
<mkdir dir="${build}" />
</target>

</project>
17 changes: 17 additions & 0 deletions Administration/DeployCluster/export.properties
@@ -0,0 +1,17 @@
##################################################################
# ALSB Admin Security Configuration #
##################################################################
adminUrl=t3://localhost:7001
exportUser=weblogic
exportPassword=weblogic

##################################################################
# ALSB Jar to be exported #
##################################################################
exportJar=HelloWorld_SB_sbconfig.jar

##################################################################
# Optional passphrase and project name #
##################################################################
passphrase=aqualogic
project=HelloWorld_SB
104 changes: 104 additions & 0 deletions Administration/DeployCluster/export.py
@@ -0,0 +1,104 @@
from java.io import FileInputStream
from java.io import FileOutputStream
from java.util import ArrayList
from java.util import Collections

from com.bea.wli.sb.util import EnvValueTypes
from com.bea.wli.config.env import EnvValueQuery;
from com.bea.wli.config import Ref
from com.bea.wli.config.customization import Customization
from com.bea.wli.config.customization import FindAndReplaceCustomization

import sys

#=======================================================================================
# Utility function to load properties from a config file
#=======================================================================================
def exportAll(exportConfigFile):
try:
print "Loading export config from :", exportConfigFile
exportConfigProp = loadProps(exportConfigFile)
adminUrl = exportConfigProp.get("adminUrl")
exportUser = exportConfigProp.get("exportUser")
exportPasswd = exportConfigProp.get("exportPassword")

exportJar = exportConfigProp.get("exportJar")
customFile = exportConfigProp.get("customizationFile")

passphrase = exportConfigProp.get("passphrase")
project = exportConfigProp.get("project")

connectToServer(exportUser, exportPasswd, adminUrl)

ALSBConfigurationMBean = findService("ALSBConfiguration", "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
print "ALSBConfiguration MBean found"

print project
if project == None :
ref = Ref.DOMAIN
collection = Collections.singleton(ref)
if passphrase == None :
print "Export the config"
theBytes = ALSBConfigurationMBean.export(collection, true, None)
else :
print "Export and encrypt the config"
theBytes = ALSBConfigurationMBean.export(collection, true, passphrase)
else :
ref = Ref.makeProjectRef(project);
print "Export the project", project
collection = Collections.singleton(ref)
theBytes = ALSBConfigurationMBean.exportProjects(collection, passphrase)

aFile = File(exportJar)
out = FileOutputStream(aFile)
out.write(theBytes)
out.close()
print "ALSB Configuration file: "+ exportJar + " has been exported"

if customFile != None:
print collection
customList = ArrayList()
query = EnvValueQuery(None, Collections.singleton(EnvValueTypes.WORK_MANAGER), collection, false, None, false)
customEnv = FindAndReplaceCustomization('Set the right Work Manager', query, 'Production System Work Manager')
customList.add(customEnv)

# Add a second endpoint
envValuesToChange = ArrayList()

print 'EnvValueCustomization created'
print customList
aFile = File(customFile)
out = FileOutputStream(aFile)
Customization.toXML(customList, out)
out.close()

except:
raise

#=======================================================================================
# Utility function to load properties from a config file
#=======================================================================================

def loadProps(configPropFile):
propInputStream = FileInputStream(configPropFile)
configProps = Properties()
configProps.load(propInputStream)
return configProps

#=======================================================================================
# Connect to the Admin Server
#=======================================================================================

def connectToServer(username, password, url):
connect(username, password, url)
domainRuntime()


# EXPORT script init
try:
exportAll(sys.argv[1])

except:
print "Unexpected error: ", sys.exc_info()[0]
dumpStack()
raise
17 changes: 17 additions & 0 deletions Administration/DeployCluster/import.properties
@@ -0,0 +1,17 @@
##################################################################
# ALSB Admin Security Configuration #
##################################################################
adminUrl=t3://localhost:7001
importUser=weblogic
importPassword=weblogic

##################################################################
# ALSB Jar to be exported, optional customization file #
##################################################################
importJar=DeployCluster/HelloWorld_SB_sbconfig.jar
customizationFile=customize.xml

##################################################################
# Optional passphrase and project name #
##################################################################
project=HelloWorld_SB
41 changes: 41 additions & 0 deletions Administration/DeployCluster/readme.txt
@@ -0,0 +1,41 @@
This sample expose the export and import capabilities in ALSB 3.0
If you have any questions or comments, contact the author Gregory Haardt: ghaardt@bea.com


This sample expose the export and import capabilities in ALSB 3.0. It shows the use of WLST
to write powerful scripts controlling import and export of ALSB configurations. It also
illustrates the use of Customization Files.

############# before starting ##############
The properties file export.properties and import.properties control the behavior of the scripts

export.properties:
set the ALSB domain config properly: adminUrl, exportUser, exportPassword
-if a project is specified, will export all the resources contained in the project
-if no project is specified the whole config is exported
exportJar is the name of the file created by the export
customizationFile is the optional name of a created customization file with a findAndReplace action

import.properties:
set the ALSB domain config properly: adminUrl, exportUser, exportPassword
-if a project is specified, the project will be overlaid by the new config (resources updated, created or deleted)
-if no project is specified an additive deployment will be performed (resources updated or created)

exportJar is the name of the config file to import
customizationFile is the optional name of a customization file. If a project is specified the customization will be only applied to created resources.

############# running the samples ############
To run the sample make sure your path and classpath are setup correctly with java, ant, weblogic/alsb librairies and python
Easiest way is to run setDomainEnv from your favorite shell

edit the import and export properties file as described above

run "ant export" to export a config
It will launch WLST, execute export.py and create a file with the exported config (optionally a customization file)

run "ant import" to import a config
It will launch WLST, execute import.py and import the configuration on your target server

Feel free to edit the scripts to personalize them to your needs


60 changes: 60 additions & 0 deletions Administration/ExportImport/build.xml
@@ -0,0 +1,60 @@
<project default="export">
<!-- ALSB domain creation project -->
<property environment="env" />

<!-- set global properties for this build -->
<!-- The bea.home property hold that name of the directory where you installed ALSB 3.0.
you need to change this value so that it matches your installation directory.
-->
<property name="bea.home" value="C:/BEAHome/alsb30" />

<!-- The workspace.dir is the directory of the workspace that you created to contain the sample
projects from this book. By default, the namespace is "alsb30_book"
-->
<property name="workspace.dir" value="c:/_workspaces/alsb30_book" />

<property name="weblogic.home" value="${bea.home}/wlserver_10.0" />
<property name="domain.export.script" value="export.py" />
<property name="domain.import.script" value="import.py" />
<property name="export.config.file" value="export.properties" />
<property name="import.config.file" value="import.properties" />
<property name="build" value="build" />
<property name="dist" value="dist" />

<path id="wlst.class.path">
<fileset dir="${bea.home}/alsb_3.0/lib">
<include name="sb-kernel-api.jar" />
</fileset>
<fileset dir="${bea.home}/modules">
<include name="com.bea.common.configfwk_1.1.0.0.jar" />
</fileset>
<fileset dir="${weblogic.home}/server/lib">
<include name="weblogic.jar" />
<include name="webserviceclient.jar" />
</fileset>
</path>

<taskdef name="wlst" classname="weblogic.ant.taskdefs.management.WLSTTask" classpathref="wlst.class.path" />

<target name="export">
<echo message="exportscript: ${domain.export.script}" />
<java classname="weblogic.WLST" fork="true" classpathref="wlst.class.path">
<arg line="${domain.export.script} ${export.config.file}" />
</java>
</target>

<target name="import">
<echo message="importscript: ${domain.import.script}" />
<java classname="weblogic.WLST" fork="true" classpathref="wlst.class.path">
<arg line="${domain.import.script} ${import.config.file}" />
</java>
</target>

<target name="clean">
<delete dir="${dist}" />
<delete dir="${build}" />
<mkdir dir="${dist}" />
<mkdir dir="${build}" />
</target>

</project>
31 changes: 31 additions & 0 deletions Administration/ExportImport/customize.xml
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<cus:Customizations xmlns:cus="http://www.bea.com/wli/config/customizations" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.bea.com/wli/config/xmltypes">
<cus:customization xsi:type="cus:FindAndReplaceCustomizationType">
<cus:description>Set the right Work Manager</cus:description>
<cus:query>
<xt:envValueTypes>Work Manager</xt:envValueTypes>
<xt:refsToSearch xsi:type="xt:LocationRefType">
<xt:type>Project</xt:type>
<xt:path>HelloWorld_SB</xt:path>
</xt:refsToSearch>
<xt:includeOnlyModifiedResources>false</xt:includeOnlyModifiedResources>
<xt:searchString xsi:nil="true"/>
<xt:isCompleteMatch>false</xt:isCompleteMatch>
</cus:query>
<cus:replacement>Production System Work Manager</cus:replacement>
</cus:customization>
<cus:customization xsi:type="cus:FindAndReplaceCustomizationType">
<cus:description>Update to the correct server and port number</cus:description>
<cus:query>
<xt:envValueTypes>Service URI</xt:envValueTypes>
<xt:refsToSearch xsi:type="xt:LocationRefType">
<xt:type>Project</xt:type>
<xt:path>HelloWorld_SB</xt:path>
</xt:refsToSearch>
<xt:includeOnlyModifiedResources>false</xt:includeOnlyModifiedResources>
<xt:searchString>localhost:7001</xt:searchString>
<xt:isCompleteMatch>false</xt:isCompleteMatch>
</cus:query>
<cus:replacement>localhost:7101</cus:replacement>
</cus:customization>
</cus:Customizations>
Binary file added Administration/ExportImport/export.jar
Binary file not shown.

0 comments on commit 58f7ba3

Please sign in to comment.