Java Properties Note
Java Properties Note
1
Using Properties for Runtime Control, Note 1
Introduction
Java CAPS 5.1 developer may need to determine a runtime value of
one or more system properties to, perhaps, use its vale for runtime
flow control. This is the first in a series of notes on the use of Java
Properties for controlling runtime behaviour of Java CAPS solutions.
Configure server.policy
The following assumes the use of Sun SeeBeyond Integration
Server, bundled with Java CAPS 5.1.3. If you use a different
application server you may not need to change security
configuration or you may need to do it differently.
Modify
<JCAPSRoot>/is/domain/<yourdomaim>/config/server.policy
replacing
with
public void
receive
( com.stc.connectors.jms.Message input
, com.stc.connector.appconn.file.FileApplication W_toFileClient )
throws Throwable
{
// need to configure server.policy for the domain
// permission java.util.PropertyPermission "*", "read,write";
;
java.util.Properties p = System.getProperties();
;
// get system properties list as string
java.io.ByteArrayOutputStream baos
= new java.io.ByteArrayOutputStream();
java.io.PrintStream ps = new java.io.PrintStream( baos );
p.list( ps );
ps.flush();
baos.flush();
String sSystemProperties = baos.toString();
;
// write system properties string
W_toFileClient.setText( sSystemProperties );
W_toFileClient.write();
;
// write classpath property
String javaclasspath = p.getProperty( "java.class.path" );
W_toFileClient.setText( "\njava.class.path\n" + javaclasspath );
W_toFileClient.write();
;
// write boot classpath property
String bootclasspath = p.getProperty( "sun.boot.class.path" );
W_toFileClient.setText( "\nsun.boot.class.path\n" + bootclasspath );
W_toFileClient.write();
;
}
All strings are appended to the same file because, by default, the
File connector in the Connectivity Map, has the property “Multiple
Records per file” set to true. Setting this property to false would
cause each write to create a new file.
Once the JCD and CM, see above, are created, it is time to create a
deployment profile, build and deploy the project.
Enter some string in the dialogue window and click the Submit
button.
If all is well the collaboration will execute and will produce a file in
the output directory. The file will contain something similar to the
following, with some content omitted for brevity.
-- listing properties --
java.vendor=Sun Microsystems Inc.
com.sun.aas.imqBin=C:\jcaps513\logicalhost\is\imq\bin
javax.xml.soap.SOAPFactory=com.sun.xml.messaging.saaj.soap.ver1_...
org.xml.sax.parser=org.xml.sax.helpers.XMLReaderAdapter
catalina.base=C:\JCAPS513\logicalhost\is\domains\props
sun.management.compiler=HotSpot Server Compiler
server.name=server
.
.
.
file.encoding=Cp1252
org.omg.CORBA.ORBClass=com.sun.corba.ee.impl.orb.ORBImpl
com.sun.CORBA.ORBUserConfigurators.com.sun.enterprise.iiop.PEORBConfigurator=
java.specification.version=1.5
javax.net.ssl.trustStore=C:/JCAPS513/logicalhost/is/domains/pr...
javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsl...
javax.net.ssl.keyStorePassword=changeit
java.class.path
C:\JCAPS513\logicalhost\is\lib\commons-
launcher.jar;C:\jcaps513\logicalhost\is\lib\activation.jar;C:\jcaps513\logicalhost\is\
lib\admin-cli.jar;C:\jcaps513\logicalhost\is\lib\appserv-
admin.jar;C:\jcaps513\logicalhost\is\lib\appserv-
cmp.jar;C:\jcaps513\logicalhost\is\lib\appserv-
ext.jar;C:\jcaps513\logicalhost\is\lib\appserv-
jstl.jar;C:\jcaps513\logicalhost\is\lib\appserv-
rt.jar;C:\jcaps513\logicalhost\is\lib\com.stc.icu4j.jar;C:\jcaps513\logicalhost\is\lib
\com.stc.jms.stcjms.jar;C:\jcaps513\logicalhost\is\lib\com.stc.jms.stcqueueviewer.jar;
C:\jcaps513\logicalhost\is\lib\com.stc.jmsjca.core.jar;C:\jcaps513\logicalhost\is\lib\
com.stc.jmsmx.core.jar;C:\jcaps513\logicalhost\is\lib\com.stc.jmsmx.sjsmq.jar;C:\jcaps
513\logicalhost\is\lib\com.stc.jmsmx.stcms.jar;C:\jcaps513\logicalhost\is\lib\com.stc.
jmsmx.wave.jar;C:\jcaps513\logicalhost\is\lib\com.stc.wave.lwmsClient.jar;C:\jcaps513\
logicalhost\is\lib\com.stc.wave.mgmt.jar;C:\jcaps513\logicalhost\is\lib\com.stc.wave.w
ave.jar;C:\jcaps513\logicalhost\is\lib\commons-
logging.jar;C:\jcaps513\logicalhost\is\lib\j2ee-
svc.jar;C:\jcaps513\logicalhost\is\lib\j2ee.jar;C:\jcaps513\logicalhost\is\lib\jax-
qname.jar;C:\jcaps513\logicalhost\is\lib\jaxr-
api.jar;C:\jcaps513\logicalhost\is\lib\jaxr-
impl.jar;C:\jcaps513\logicalhost\is\lib\jaxrpc-
api.jar;C:\jcaps513\logicalhost\is\lib\jaxrpc-
impl.jar;C:\jcaps513\logicalhost\is\lib\mail.jar;C:\jcaps513\logicalhost\is\lib\net.sf
.hulp.meas.impl.jar;C:\jcaps513\logicalhost\is\lib\relaxngDatatype.jar;C:\jcaps513\log
icalhost\is\lib\saaj-api.jar;C:\jcaps513\logicalhost\is\lib\saaj-
impl.jar;C:\jcaps513\logicalhost\is\lib\stcjms_453.jar;C:\jcaps513\logicalhost\is\lib\
xercesImpl.jar;C:\jcaps513\logicalhost\is\lib\xsdlib.jar;C:/JCAPS513/logicalhost/jre/l
ib/tools.jar;C:/jcaps513/logicalhost/is/lib/install/applications/jmsra/imqjmsra.jar;C:
/jcaps513/logicalhost/is/imq/lib/jaxm-
api.jar;C:/jcaps513/logicalhost/is/imq/lib/fscontext.jar;C:/jcaps513/logicalhost/is/li
b/ant/lib/ant.jar;C:/jcaps513/logicalhost/is/lib/ant/lib/ant-
launcher.jar;C:/jcaps513/logicalhost/is/derby/derby.jar
sun.boot.class.path
C:/jcaps513/logicalhost/is/lib/endorsed\dom.jar;C:/jcaps513/logicalhost/is/lib/endorse
d\xalan.jar;C:/jcaps513/logicalhost/is/lib/endorsed\xercesImpl.jar;C:\JCAPS513\logical
host\jre\lib\rt.jar;C:\JCAPS513\logicalhost\jre\lib\i18n.jar;C:\JCAPS513\logicalhost\j
re\lib\sunrsasign.jar;C:\JCAPS513\logicalhost\jre\lib\jsse.jar;C:\JCAPS513\logicalhost
\jre\lib\jce.jar;C:\JCAPS513\logicalhost\jre\lib\charsets.jar;C:\JCAPS513\logicalhost\
jre\classes