Saturday, June 30, 2007

Skills|The 5 Basic Survival Skills

The 5 Basic Survival Skills

The 5 Basic Survival Skills

Acquiring survival skills is an ongoing process that will last for your entire life. There is always more to learn and experience, which is part of the fun of being a survivor. And as your expertise grows the knowledge and abilities you gain is often useful in other areas. For example survivors prepare ahead of time, and they are experts in the art of ingenuity and inventiveness. Excellent attributes for anyone.

The possible environments and situations you could find yourself in are innumerable. Although each situation has its particular requirements for successfully surviving, in the final analysis it is mastery of five basic survival skills that are essential. Proficiency and preparedness in these 5 basic skills will give you the edge and put you on your way toward becoming a talented survivor.

First Basic Survival Skill - Fire

The fundamental ability to create and maintain a fire is the best survival skill you can have. Fire provides warmth, light, and comfort so you get on with the business of survival. Even if you do not have adequate clothing a good fire can allow you to survive in the coldest of environments.

Fire keeps away the creatures that go bump in the night and so you can have the peace of mind and rest you need. And that is not all. Fire will cook your food and purify your water, both excellent attributes when you want to stay healthy when potential disease causing organisms are lurking about. Fire will dry your clothing and even aid in the making of tools and keeping pesky insects at bay.

But even that is not all. Fire and smoke can be used for signaling very long distances.

Always have at least two, and preferably three, methods of making a fire at you immediate disposal. With waterproof matches, a butane lighter, and a magnesium fire starter you should be able to create a fire anytime anywhere no matter how adverse the condtions.

So the lesson here is to learn the art of fire craft. Practice and become an expert. Your ability to create a fire is perhaps the most visible mark of an experienced survivor.

Second Basic Survival Skill - Shelter

Shelter protects your body from the outside elements. This includes heat, cold, rain, snow, the sun, and wind. It also protects you from insects and other creatures that seek to do you harm.

The survival expert has several layers of shelter to think about. The first layer of shelter is the clothing you choose to wear. Your clothing is of vital importance and must be wisely chosen according to the environment you are likely to find yourself in. Dress in layers in order to maximize your ability to adapt to changing conditions.

The next layer of shelter is the one you may have to build yourself, a lean-to or debris hut perhaps. This is only limited by your inventiveness and ingenuity. If the situation requires, your shelter can be insulated with whatever is at hand for the purpose. Being prepared, you may have a space blanket or tarp with you, in which case creating a shelter should be relatively easy.

Before you are in need of making a survival shelter, be sure to practice and experiment with a variety of materials and survival scenarios on a regular basis. Should the need arise you will be glad you did.

Third Basic Survival Skill - Signaling

Signaling allows you to make contact with people who can rescue you without having to be in actual physical contact with them. There are a variety of ways to signal for help. These include using fire and smoke, flashlights, bright colored clothing and other markers, reflective mirrors, and whistles. Three of anything is considered a signal for help: 3 gunshots, 3 blows on a whistle, three sticks in the shape of a triangle.

In a pinch, your ingenuity in devising a way to signal potential help could very well save your life.

Fourth Basic Survival Skill - Food and Water

Whenever you plan an excursion be sure to always bring extra food and water. Having more on hand than you think you need will give you that extra measure of safety should something happened and you have to stay out longer than anticipated.

It is important that you know how to ration your water and food as well as find more in the environment in which you find yourself. You can go without food for a number of days, but going without water for even a few days will cause your efficiency to drop dramatically.

If at all possible, boil any water you find in order to kill disease organisms that may be in even the cleanest looking water. Filtering or chemically treating water is second best.

Fifth Basic Survival Skill - First Aid

Always bring along your first aid kit and a space blanket. Most injuries you are likely to encounter in the wilderness are relatively minor scrapes, cuts, bruises, and burns. Larger injuries are going to need better facilities than that which you have at your disposal, which means you will need outside help.

Panic is your number one enemy when you are in any emergency situation, be it injured, lost, or stranded. What you need in these situations is first aid for the mind.

Think STOP:
Sit
Think
Observe
Plan

Your best defense in any emergency is your ability to think and make correct decisions. Building a fire is often the beginning first aid for the mind. Doing so will keep you busy and provide an uplift from the warmth, light and protection fire provides.

Practice Survival Skills

The expert survival skills and know-how you have accumulated through practice and experience will serve you well. When the real thing comes along, you will be prepared and adept at staying alive. Where others have perished, as a survivor you will know you can make it. And that is a good feeling to be sure.

职场心灵沟通技巧

职场心灵沟通技巧

职场心灵沟通技巧
送交者: jinkung [☆虎皮蛋糕☆] 于 June 28, 2007 04:53:31 已读 503
天天养生堂
数百种美国名厂保健品,超低价直销全球!
蜜糖交友中心
海外孤身?强大搜索功能,轻松找到意中人!
入门外汇并不难!
免费教材, 免费指导!为门外汉量身订做!

、讲出来

尤其是坦白的讲出来你内心的感受、感情、痛苦、想法和期望,但绝对不是批评、责备、抱怨、攻击。

二、不批评、不责备、不抱怨、不攻击、不说教

批评、责备、抱怨、攻击这些都是沟通的刽子手,只会使事情恶化。

三、互相尊重

只有给予对方尊重才有沟通,若对方不尊重你时,你也要适当的请求对方的尊重,否则很难沟通。

四、绝不口出恶言

恶言伤人,就是所谓的"祸从口出"。

五、不说不该说的话

如果说了不该说的话,往往要花费极大的代价来弥补,正是所谓的"一言既出,驷马难追"、"病从口入,祸从口出"甚至于还可能造成无可弥补的终生遗憾哩!所以沟通不能够信口雌黄、口无遮拦,但是完全不说话,有时后也会变得更恶劣。

六、情绪中不要沟通,尤其是不能够做决定

情绪中的沟通常常无好话,既理不清,也讲不明,尤其在情绪中,很容易冲动而失去理性,如:吵的不可开交的夫妻、反目成仇的父母子女、对峙已久的上司下属……尤其是不能够在情绪中做出情绪性、冲动性的"决定",这很容易让事情不可挽回,令人后悔!

七、理性的沟通,不理性不要沟通

不理性只有争执的份,不会有结果,更不可能有好结果,所以,这种沟通无济于事。

八、觉知

不只是沟通才需要觉知,一切都需要。如果自己说错了话、做错了事,如不想造成无可弥补的伤害时,最好的办法是什么?!"我错了",这就是一种觉知。

九、承认我错了

承认我错了是沟通的消毒剂,可解冻、改善与转化沟通的问题,就一句:我错了!勾销了多少人的新仇旧恨,化解掉多少年打不开的死结,让人豁然开朗,放下武器,重新面对自己,开始重新思考人生,甚至于我是谁??在这浩瀚的宇宙洪流里,人最在意的就是�我�,如果有人不尊重我、打压我、欺负我或侮辱我时,即使是亲如父子,都可能反目成仇,偏泪一点的,离家出走还算什么,死给你看的例子都屡见不鲜哩!

十、说对不起!!

说对不起,不代表我真的做了什么天大的错误或伤天害理的事,而是一种软化剂,使事情终有"转圜"的余地,甚至于还可以创造"天堂"。其实有时候你也真的是大错特错,死不认错就是一件大错特错的事。

十一、让奇迹发生

如今自己愿意互相认错,就是在替自己与家人创造了天堂与奇迹,化不可能为可能。

十二、爱

一切都是爱,爱是最伟大的治疗师。

十三、等待转机

如果没有转机,就要等待,急只会治丝益棼,当然,不要空等待成果就会从天下掉下来,还是要你自己去努力,但是努力并不一定会有结果,或舍本逐末,但若不努力时,你将什么都没有。

十四、耐心

等待唯一不可少的是耐心,有志者事竟成。

十五、智能

智能使人不执着,而且福至心灵。

Friday, June 29, 2007

Jython|Simple and Efficient Jython Object Factories

JythonMonthly/Articles/October2006/3 - JythonWiki

Simple and Efficient Jython Object Factories

Submitted By: CharlieGroves

Writing code in Python that can be easily called by Java code is one of the most attractive features of Jython. In last month's newsletter, Josh wrote [WWW] Accessing Jython from Java Without Using jythonc. It shows how to easily use Jython objects implementing Java interfaces in Java code. He mentions that "using this technique correctly is more effective than using jythonc". I'll go one step further: unless you run in an environment that requires precompiled classes( e.g. in a servlet engine with security restrictions) or have extreme masochistic tendencies you shouldn't use jythonc. It has no speed benefits over regular Jython, requires the added complexity of a compile step and doesn't have basic features like line numbers in stack traces. jythonc does allow Java types to be defined directly in Python code with the @sig comments which requires a separate Java class or interface using this technique. However, the @sig system is incomplete, error prone and requires a Jython programmer to learn a new set of syntax beyond Java and Python. Josh mentions a couple drawbacks of his technique at the end of the article: it requires the creation of a new interpreter for every new object and it reevaluates the Python code in every new interpreter created. This article shows how to avoid those problems raising the bar for jythonc even higher.

We use the same basic types that Josh used in his article. The EmployeeType he defined is unchanged:

package jyinterface.interfaces;

public interface EmployeeType {

public String getEmployeeFirst();
public String getEmployeeLast();
public String getEmployeeId();

}

It just defines a simple bean with first, last and id fields. Then, take his Employee.py and add arguments for the fields to the constructor:

from jyinterface.interfaces import EmployeeType

class Employee(EmployeeType):
def __init__(self, first, last, id):
self.first = first
self.last = last
self.id = id

def getEmployeeFirst(self):
return self.first

def getEmployeeLast(self):
return self.last

def getEmployeeId(self):
return self.id

Finally, create a new factory class that creates these Jython Employees:

package jyinterface.factory;

import jyinterface.interfaces.EmployeeType;
import org.python.core.PyObject;
import org.python.core.PyString;
import org.python.util.PythonInterpreter;

public class EmployeeFactory {

public EmployeeFactory() {
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.exec("from Employee import Employee");
jyEmployeeClass = interpreter.get ("Employee");
}

public EmployeeType create(String first, String last, String id) {
PyObject employeeObj = jyEmployeeClass.__call__(new PyString(first),
new PyString(last),
new PyString(id));
return (EmployeeType)employeeObj.__tojava__(EmployeeType.class);
}

private PyObject jyEmployeeClass;
}

This class is where Java and Python felicitously meet. The constructor first creates an interpreter and imports the Employee class into it. This means that Employee.py must be located on sys.path for the import to work. After a successful import, the constructor stores a reference to the Employee class. This PyObject functions identically to the Employee class in Python code. That means jyEmployeeClass.__call__() in Java is the same as Employee() in Python and jyEmployeeClass.__getattr__("__doc__") in Java is the same as Employee.__doc__ in Python etc. The create method uses this to make instances of Employee. It invokes __call__ on jyEmployeeClass with arguments for first, last and id which translates to Employee(first, last id). It then uses __tojava__ to extract an object implementing EmployeeType from the PyObject wrapper.

This new Main shows the factory in action:

package jyinterface;

import jyinterface.factory.EmployeeFactory;
import jyinterface.interfaces.EmployeeType;

public class Main {

private static void print(EmployeeType employee) {
System.out.println("Name: " + employee.getEmployeeFirst() + " "
+ employee.getEmployeeLast());
System.out.println("Id: " + employee.getEmployeeId());
}

public static void main(String[] args) {
EmployeeFactory factory = new EmployeeFactory();
print(factory.create("Josh", "Juneau", "1"));
print(factory.create ("Charlie", "Groves", "2"));
}
}

Since the factory only creates one interpreter, the cost of creating each employee is reduced to just the work in its constructor.

You could expand this factory to create any Jython object as in Josh's article. Just pass in the class to be imported to the constructor and have create take the generic set of arguments PyObject[] args, String[] keywords (see the javadocs for PyObject.__call__ for details). The type specific factory here has the benefit that the create method has type specific arguments and allows for documentation of the constructor from Java. A user of a generic factory would have to know about the specific constructor of the Jython class and how to turn regular Java objects into the types expected by the Jython system. This factory handles that when it wraps the String arguments in PyString. The balance lies between how much Jython knowledge you want users of the factory to have and how loathe you are to create a third class to support a single type. In either case, this system is simpler and more comprehensible than the complexities introduced by jythonc.

Jython|Accessing Jython from Java Without Using jythonc

JythonMonthly/Articles/September2006/1 - JythonWiki

Accessing Jython from Java Without Using jythonc

Submitted By: Josh Juneau

You may or may not know that it is possible to access Jython code from Java without compiling it using the jythonc utility. This technique is possible using a mixture of Java interfaces and usage of the PythonInterpreter. As a matter of fact, I believe that using this technique correctly is more effective than using jythonc.

To put it simply, to use this technique you must create a "factory" method which uses the PythonInterpreter class to interpret a .py module for use within Java code. Any Java code that uses the Jython code should be coded against an interface which is implemented by the Jython code.

In order to provide a fully functional example, I've created a simple application with hard-coded data. This application shows the potential for using this technique within your Java applications to have the ability for use of dynamic Jython objects.

The application is simply called "jyinterface" and it contains four pieces of code:

We'll start by coding the "EmployeeType.java" interface which is what our Java code will use in order to interact with the Jython object:

package jyinterface.interfaces;

public interface EmployeeType {

public String getEmployeeFirst();
public String getEmployeeLast();
public String getEmployeeId();

}

The Jython bean "Employee.py" is just a simple Jython object which implements the Java interface " EmployeeType.java":

# Jython source file
from jyinterface.interfaces import EmployeeType

class Employee(EmployeeType):
def __init__(self):
self.first = "Josh"
self.last = "Juneau"
self.id = "myempid"

def getEmployeeFirst(self):
return self.first

def getEmployeeLast(self):
return self.last

def getEmployeeId(self):
return self.id

Next, the most powerful code for this technique is the "JythonFactory.java" class. This code defines a method which interprets a Jython module into Java and returns for use within Java code. The best part about creating a factory class such as this one is reuse! The factory can be coded in many different ways, but this way allows for reuse because you can essentially pass any Java interface/Jython module to it.

package jyinterface.factory;

import org.python.util.PythonInterpreter;

public class JythonFactory {
private static JythonFactory instance = null;

public static JythonFactory getInstance(){
if(instance == null){
instance = new JythonFactory();
}

return instance;

}

public static Object getJythonObject(String interfaceName,
String pathToJythonModule){

Object javaInt = null;
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.execfile(pathToJythonModule);
String tempName = pathToJythonModule.substring(pathToJythonModule.lastIndexOf("/")+1);
tempName = tempName.substring(0, tempName.indexOf("."));
System.out.println(tempName);
String instanceName = tempName.toLowerCase();
String javaClassName = tempName.substring(0,1).toUpperCase() +
tempName.substring(1);
String objectDef = "=" + javaClassName + "()";
interpreter.exec(instanceName + objectDef);
try {
Class JavaInterface = Class.forName(interfaceName);
javaInt =
interpreter.get(instanceName).__tojava__(JavaInterface);
} catch (ClassNotFoundException ex) {
ex.printStackTrace(); // Add logging here
}

return javaInt;
}
}

As we stated previously, a Java interface/Jython module combo needs to be passed to the getJythonObject method in order to return the resulting code. In the following piece of code, you can see how this is done. Simply pass in two strings:

  1. Fully qualified name of the Java Interface

  2. Full path to the Jython code module

Here is the "Main.java" code:

package jyinterface;

import jyinterface.interfaces.EmployeeType;
import jyinterface.factory.JythonFactory;
import org.python.util.PythonInterpreter;


public class Main {

EmployeeType et;

/** Creates a new instance of Main */
public Main() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
JythonFactory jf = JythonFactory.getInstance();
EmployeeType eType = (EmployeeType) jf.getJythonObject(
"jyinterface.interfaces.EmployeeType", "<<path to module>>/Employee.py");
System.out.println("Employee Name: " + eType.getEmployeeFirst() + " " +
eType.getEmployeeLast());
System.out.println("Employee ID: " + eType.getEmployeeId ());

}
}

This technique is powerful because it allows an application to use code which can be interchanged or dynamically updated without re-deployment or re-compile. It also follows a great Java practice which is code against Java interfaces !! One downfall to this approach is that the code is interpreted every time it is invoked, so the performance may not be as good as using a jythonc compiled piece of code. It obviously depends upon the requirements of the application, but the usefulness of this technique may outweigh the performance factor in many cases.

Next time you plan to create a Java application that contains some Jython code, give this technique a try...

Tuesday, June 19, 2007

Ant|Build file example

Build.xml

<!--

      Ant script to prepare the build process

-->

<project name="WSG" default="no.target" basedir="." >

    <description>

        Prepares the build

    </description>

 

build_external.properties

 

#############################################################################

#                                                                           #

#  This file contains the properties for the Wholesale Gateway build script #

#  for external releases                                                    #

#                                                                           #

#                                                                           #

#############################################################################

 

 

##################################################

# The following settings relate to JDBC

##################################################

 

#

# Oracle JDBC Settings

#

wsg.jdbc.db.type= WSG Oracle

wsg.jdbc.password=

wsg.jdbc.driver= oracle.jdbc.driver.OracleDriver

wsg.jdbc.testtable.sql =ec_servers

wsg.jdbc.context= oracle

jdbc.data.tablespace =WSG_DATA

jdbc.index.tablespace =WSG_INDEX

 

jdbc.itrust.sqldir =temp/ec_wsg/other/database_schema/wsg/itrust/wsg

 

 

##################################################

# The following settings relate to build

##################################################

 

# Local WebLogic directory

weblogic.home= /bea/weblogic81

 

wsg.managed.server.name =wsgManagedServer

 

wsg.fml.dir= FMLFieldTables

ec.core.dir= ../EC_Core

compile.dir= build

wsg.dist.dir= dist

wsg.src.dir= Java Sources

wsg.lib.dir= lib

wsg.project.name =WSG_Processes

product.name =WholesaleGateway

 

 

dobuild.xml

<!--

Ant build script to build the /dist/WSG.jar file.

This jar file contains all the classes used in the Wholesale Gateway project

-->

<project name="WSG" default="production.package" basedir= ".">

    <description>

        Builds the wsg.jar file

    </description>

  <!-- set global properties for this build -->

  <property file= "build.properties"/>

 

  <target name= "init">

    <!-- Create the build directory structure used by compile -->

    <mkdir dir= "${compile.dir}"/>

  </target>

 

  <!-- classpath for Java libraries -->

  <path id= "path.classpath">

    <fileset dir= "${ec.core.dir}/lib">

      <include name= "**/*.jar"/>

    </fileset>

    <fileset dir= "${wsg.lib.dir}">

      <include name= "**/*.jar"/>

    </fileset>

    <fileset dir= "${weblogic.home}/server/lib" includes= "weblogic.jar"/>

  </path>

 

 

  <target name= "compile" depends= "init"

        description="compile the source " >

      <!-- Compile the java code from ${wsg.src.dir} into ${compile.dir} -->

      <javac destdir= "${compile.dir}" debug= "true" deprecation= "on">

        <classpath refid= "path.classpath"/>

        <src path= "${wsg.src.dir}"/>

        <include name= "**/*.java" />

      </javac>

  </target>

 

 

  <target name= "dist" depends= "compile"

        description="generate the distribution" >

    <!-- Create the distribution directory -->

    <mkdir dir= "${wsg.dist.dir}"/>

 

    <!-- Put everything in ${compile.dir} into the WSG.jar file -->

    <jar destfile= "${wsg.dist.dir}/WSG.jar">

      <fileset dir= "${compile.dir}">

        <include name= "com/**/*.class"/>

        <exclude name= "com/ncs/exchangeconnect/wsg/tuxedo/**/*.class"/>

      </fileset>

    </jar>

 

 

      <!--

            Create the FocusFML.jar

      -->

      <mkdir dir= "${wsg.dist.dir}/fml"/>

      <copy file= "${wsg.fml.dir}/focus.fml" tofile= "${wsg.dist.dir}/fml/FocusFML"/>

 

      <java classname= "weblogic.wtc.jatmi.mkfldclass32" fork="true">

         <arg value= "${wsg.dist.dir}/fml/FocusFML"/>

         <classpath refid= "path.classpath"/>

      </java>

 

      <move file= "FocusFML.java" todir= "${wsg.dist.dir}/fml"/>

 

      <javac destdir= "${wsg.dist.dir}/fml" debug= "${javac.debug}" deprecation="on">

            <classpath refid= "path.classpath"/>

            <src path= "${wsg.dist.dir}/fml"/>

            <include name= "**/*.java" />

      </javac>

 

      <delete>

            <fileset dir= "${wsg.dist.dir}/fml">

                  <include name= "*.java"/>

                  <include name= "FocusFML"/>

            </fileset>

      </delete>

      <jar jarfile= "${wsg.dist.dir}/FocusFML.jar" basedir= "${wsg.dist.dir}/fml"/>

      <delete>

            <fileset dir= "${wsg.dist.dir}/fml">

                  <include name= "*.class"/>

            </fileset>

      </delete>

 

      <!--

            Create the IBSFML.jar

      -->

      <copy file= "${wsg.fml.dir}/ibs.fml" tofile= "${wsg.dist.dir}/fml/IBSFML"/>

 

      <java classname= "weblogic.wtc.jatmi.mkfldclass32" fork="true">

         <arg value= "${wsg.dist.dir}/fml/IBSFML"/>

         <classpath refid= "path.classpath"/>

      </java>

 

      <move file= "IBSFML.java" todir= "${wsg.dist.dir}/fml"/>

 

      <javac destdir= "${wsg.dist.dir}/fml" debug= "${javac.debug}" deprecation="on">

            <classpath refid= "path.classpath"/>

            <src path= "${wsg.dist.dir}/fml"/>

            <include name= "**/*.java" />

      </javac>

 

      <delete>

            <fileset dir= "${wsg.dist.dir}/fml">

                  <include name= "*.java"/>

                  <include name= "IBSFML"/>

            </fileset>

      </delete>

      <jar jarfile= "${wsg.dist.dir}/IBSFML.jar" basedir= "${wsg.dist.dir}/fml"/>

 

      <delete dir= "${wsg.dist.dir}/fml"/>

 

 

    <jar destfile= "${wsg.dist.dir}/wsg_dataenrich_receiver_sync.jar">

      <fileset dir= "${compile.dir}">

        <include name= "com/ncs/exchangeconnect/wsg/tuxedo/dataenrich/*.class"/>

      </fileset>

      <fileset dir= "${wsg.src.dir}/com/ncs/exchangeconnect/wsg/tuxedo/dataenrich">

        <include name= "META-INF/*.xml"/>

      </fileset>

    </jar>

 

    <jar destfile= "${wsg.dist.dir}/wsg_staupd_receiver_sync.jar">

      <fileset dir= "${compile.dir}">

        <include name= "com/ncs/exchangeconnect/wsg/tuxedo/staupd/*.class"/>

      </fileset>

      <fileset dir= "${wsg.src.dir}/com/ncs/exchangeconnect/wsg/tuxedo/staupd">

        <include name= "META-INF/*.xml"/>

      </fileset>

    </jar>

 

    <jar destfile= "${wsg.dist.dir}/wsg_prtnotify_receiver_sync.jar">

      <fileset dir= "${compile.dir}">

        <include name= "com/ncs/exchangeconnect/wsg/tuxedo/prtnotify/*.class"/>

      </fileset>

      <fileset dir= "${wsg.src.dir}/com/ncs/exchangeconnect/wsg/tuxedo/prtnotify">

        <include name= "META-INF/*.xml"/>

      </fileset>

    </jar>

 

      <!-- Clean up -->

      <delete dir= "${compile.dir}"/>

  </target>

 

  <target name= "repackage.ear" depends= "dist"

        description="repackage the EAR file for distribution" >

    <mkdir dir= "${wsg.dist.dir}/repack"/>

    <unzip src= "${ec.core.dir}/ec.ear" dest= "${wsg.dist.dir}/repack"/>

 

    <copy file= "${wsg.dist.dir}/WSG.jar" todir= "${wsg.dist.dir}/repack/APP-INF/lib" />

 

      <copy todir= "${wsg.dist.dir}/repack/APP-INF/lib">

            <fileset dir= "${wsg.lib.dir}">

                  <include name= "**/*.jar"/>

            </fileset>

      </copy>

 

    <move file= "${wsg.dist.dir}/wsg_dataenrich_receiver_sync.jar" todir="${wsg.dist.dir}/repack/"/>

    <move file= "${wsg.dist.dir}/wsg_staupd_receiver_sync.jar" todir="${wsg.dist.dir}/repack/"/>

    <move file= "${wsg.dist.dir}/wsg_prtnotify_receiver_sync.jar" todir="${wsg.dist.dir}/repack/"/>

 

      <copy file= "JSP/WEB-INF/classes/messages-acm.properties" tofile="JSP/WEB-INF/classes/messages-acm.properties.bak" />

      <replace file= "JSP/WEB-INF/classes/messages-acm.properties" token="@@@product.name@@@" value="${product.name }"/>

 

      <!-- Copy JSPs into a Temp directory. This is required so our JSPs have a new timestamp and get included in the war -->

    <mkdir dir= "${wsg.dist.dir}/tempJSP"/>

      <copy todir= "${wsg.dist.dir}/tempJSP">

            <fileset dir= "JSP">

                  <include name= "**/*.*"/>

                  <exclude name= "**/*.bak"/>

            </fileset>

      </copy>

 

      <war destfile= "${wsg.dist.dir}/repack/ec.war" update="true" webxml="JSP/WEB-INF/web.xml">

            <fileset dir= "${wsg.dist.dir}/tempJSP">

                  <include name= "**/*.*"/>

      </fileset>

    </war>

    <delete dir= "${wsg.dist.dir}/tempJSP"/>

 

 

    <move file= "JSP/WEB-INF/classes/messages-acm.properties.bak" tofile="JSP/WEB-INF/classes/messages-acm.properties" />

 

    <ear destfile= "${wsg.dist.dir}/ec_wsg.ear" appxml= "META-INF/application.xml">

      <fileset dir= "${wsg.dist.dir}/repack">

        <include name= "ec.war"/>

        <include name= "*.jar"/>

        <include name= "APP-INF/**/*.*"/>

        <exclude name= "*.ear"/>

      </fileset>

    </ear>

 

      <!-- Clean up -->

      <delete dir= "${wsg.dist.dir}/repack"/>

  </target>

 

 

  <target name= "repackage.filesystem" depends= "repackage.ear"

          description="creates the file system structure" >

    <mkdir dir= "${wsg.dist.dir}/temp/ec_wsg"/>

 

      <!-- Copy the core files across -->

      <copy todir= "${wsg.dist.dir}/temp/ec_wsg" includeEmptyDirs= "false" overwrite="true">

            <fileset dir= "${ec.core.dir}">

                  <exclude name= "**/*.ear"/>

                  <exclude name= "EC_domain/**/*.*"/>

            </fileset>

      </copy>

 

      <!-- Copy the core EC_domain to WSG_domain -->

      <copy todir= "${wsg.dist.dir}/temp/ec_wsg/WSG_domain" includeEmptyDirs="false" overwrite="true" >

            <fileset dir= "${ec.core.dir}/EC_domain">

                  <exclude name= "myserver/**/*.*"/>

            </fileset>

      </copy>

 

      <!-- Copy the WSG files -->

      <copy todir= "${wsg.dist.dir}/temp/ec_wsg" includeEmptyDirs= "false" overwrite="true">

            <fileset dir= "ECFiles/ec_wsg"/>

      </copy>

 

      <!-- Copy the WSG tables -->

      <copy todir= "${wsg.dist.dir}/temp/ec_wsg/other/database_schema/wsg" includeEmptyDirs="false" overwrite="true" >

            <fileset dir= "sql">

                  <include name= "**/*.sql"/>

            </fileset>

      </copy>

 

      <!-- Move the WSG.ear file -->

      <move file= "${wsg.dist.dir}/ec_wsg.ear" todir= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/applications" />

 

  </target>

 

 

  <!-- Use the development config.xml. This config deploys the product in a standalone WebLogic domain-->

   <target name= "development.configuration" depends= "repackage.filesystem"

          description="Use the config_dev.xml" >

 

      <property name= "weblogic.productionmode" value= "false"/>

 

      <copy file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config_dev.xml" tofile="${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config.xml" overwrite="true" />

      <copy file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/startWebLogic_dev.cmd" tofile="${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/startWebLogic.cmd" overwrite="true" />

 

      <delete file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config_prod.xml"/>

      <delete file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config_dev.xml"/>

 

      <delete file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/startWebLogic_prod.cmd"/>

      <delete file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/startWebLogic_dev.cmd"/>

 

      <antcall target= "substitute.variables"/>

  </target>

 

  <!-- Use the production config.xml. This config deploys the product in a managed WebLogic domain-->

  <target name= "production.configuration" depends= "repackage.filesystem"

          description="Use the config_prod.xml" >

 

      <property name= "weblogic.productionmode" value= "true"/>

 

      <copy file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config_prod.xml" tofile="${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config.xml" overwrite="true" />

      <copy file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/startWebLogic_prod.cmd" tofile="${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/startWebLogic.cmd" overwrite="true" />

 

      <delete file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config_prod.xml"/>

      <delete file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config_dev.xml"/>

 

      <delete file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/startWebLogic_prod.cmd"/>

      <delete file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/startWebLogic_dev.cmd"/>

 

      <antcall target= "substitute.variables"/>

  </target>

 

 

  <!-- Set all the environment variables -->

  <target name= "substitute.variables"

          description="Set all the environment variables" >

      <!-- Set the environmental settings -->

      <replace file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config.xml" token="@@@wsg.jdbc.db.type@@@" value="${wsg.jdbc.db.type}" />

      <replace file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config.xml" token="@@@wsg.jdbc.password@@@" value="${wsg.jdbc.password}" />

      <replace file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config.xml" token="@@@wsg.jdbc.driver@@@" value="${wsg.jdbc.driver}" />

      <replace file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config.xml" token="@@@wsg.jdbc.testtable.sql@@@" value="${wsg.jdbc.testtable.sql}" />

      <replace file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config.xml" token="@@@weblogic.productionmode@@@" value="${weblogic.productionmode}" />

      <replace file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/config.xml" token="@@@wsg.managed.server.name@@@" value="${ wsg.managed.server.name}"/>

 

      <replace file= "${wsg.dist.dir}/temp/ec_wsg/etc/standard.conf" token="@@@wsg.project.name@@@" value="${ wsg.project.name}"/>

      <replace file= "${wsg.dist.dir}/temp/ec_wsg/etc/wsgCustom.properties" token="@@@wsg.jdbc.context@@@" value="${wsg.jdbc.context}" />

 

      <replace file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/startWebLogic.cmd" token="@@@weblogic.productionmode@@@" value="${weblogic.productionmode}" />

 

      <replace file= "${wsg.dist.dir}/temp/ec_wsg/WSG_Domain/startWebLogic.sh" token="@@@weblogic.productionmode@@@" value="${weblogic.productionmode}" />

 

      <!-- Copy the WSG create script -->

      <copy file ="SQL/create-oracle.sql" todir= "${wsg.dist.dir}/temp/ec_wsg/other/database_schema" includeEmptyDirs="false" overwrite="true" />

 

      <replace file= "${wsg.dist.dir}/temp/ec_wsg/other/database_schema/create-oracle.sql" token="@@@jdbc.data.tablespace@@@" value="${jdbc.data.tablespace}" />

      <replace file= "${wsg.dist.dir}/temp/ec_wsg/other/database_schema/create-oracle.sql" token="@@@jdbc.index.tablespace@@@" value="${jdbc.index.tablespace}" />

 

      <!-- Copy the iTrust tables -->

      <copy todir= "${wsg.dist.dir}/temp/ec_wsg/other/database_schema/itrust" includeEmptyDirs="false" overwrite="true" >

            <fileset dir= "${wsg.dist.dir}/${jdbc.itrust.sqldir}">

                  <include name= "**/*.sql"/>

            </fileset>

      </copy>

      <delete dir= "${wsg.dist.dir}/temp/ec_wsg/other/database_schema/wsg/itrust"/>

 

      <mkdir dir= "${wsg.dist.dir}/temp/domain/WSG_domain"/>

      <move todir= "${wsg.dist.dir}/temp/domain/WSG_domain" includeEmptyDirs="false" overwrite="true" >

            <fileset dir= "${wsg.dist.dir}/temp/ec_wsg/WSG_domain">

                  <include name= "**/*.*"/>

            </fileset>

      </move>

 

      <mkdir dir= "${wsg.dist.dir}/zip"/>

 

      <zip destfile= "${wsg.dist.dir}/zip/WSG_Files.zip"

             basedir="${wsg.dist.dir}/temp/ec_wsg"   />

      <zip destfile= "${wsg.dist.dir}/zip/WSG_Domain.zip"

             basedir="${wsg.dist.dir}/temp/domain"   />

 

      <copy todir= "${wsg.dist.dir}/zip" includeEmptyDirs= "false" overwrite="true">

            <fileset dir= "environments">

                  <include name= "**/*.*"/>

                  <exclude name= "internal/**/*.*"/>

            </fileset>

      </copy>

 

      <zip destfile= "${wsg.dist.dir}/WSG_Application.zip"

             basedir="${wsg.dist.dir}/zip"   />

 

 

      <zip destfile= "${wsg.dist.dir}/WSG_DatabaseSchema.zip"

             basedir="${wsg.dist.dir}/temp/ec_wsg/other/" includes= "**/*.sql" />

 

      <copy file= "../EC_Designer/ExchangeConnect Designer.zip" tofile= "${wsg.dist.dir}/ExchangeConnect Designer.zip" overwrite="true"/>

      <copy file= "ExportedWorkFlows/WSG_Processes.xml" tofile="${wsg.dist.dir}/WSG_Processes.xml" overwrite="true" />

 

 

      <!-- Clean up -->

      <delete dir= "${wsg.dist.dir}/temp"/>

      <delete dir= "${wsg.dist.dir}/zip"/>

 

  </target>

 

 

 

 

  <!-- Deploys the package on the local filesystem. This is for development only!! -->

  <target name= "deploy" depends= "development.configuration"

          description="Unzips the package ready for use" >

 

      <delete dir= "${wsg.deploy.dir}"/>

      <unzip src= "${wsg.dist.dir}/WSG_Application.zip" dest="${wsg.dist.dir}/temp"/>

      <copy file= "environments/internal/deploy_local.properties" tofile="${wsg.dist.dir}/temp/deploy.properties" overwrite="true" />

      <ant antfile= "build.xml" dir= "${wsg.dist.dir}/temp" target= "extract.admin"/>

      <delete dir= "${wsg.dist.dir}/temp"/>

  </target>

 

  <!-- Packages the product ready for production -->

  <target name= "production.package" depends= "production.configuration"

          description="Packages the product ready for production" >

  </target>

 

</project>

 

      <property name= "include.batch" value= "false"/>

 

  <target name= "no.target">

      <echo level= "info">

            Invalid usage:

            - use "ant local"..........to build and extract to a local PC

            - use "ant internal.st"....to build for the internal system test environment

            - use "ant internal.dev"...to build for the internal development environment

            - use "ant external".......to build for an external release

      </echo>

 

      <fail/>

  </target>

 

  <target name= "checkProps">

      <condition property= "include.batch.isTrue">

            <istrue value= "${include.batch}"/>

      </condition>

  </target>

 

  <target name= "integrate.batch" depends= "checkProps" if="include.batch.isTrue">

        <property name= "build.file" value= "dobuild_includebatch.xml"/>

 

            <echo level= "info">

                  Integrating the Batch Job functionality

            </echo>

 

  </target>

 

  <target name= "no.batch" depends= "checkProps" unless= "include.batch.isTrue">

        <property name= "build.file" value= "dobuild.xml"/>

 

            <echo level= "info">

                  NOT Integrating the Batch Job functionality

            </echo>

  </target>

 

  <target name= "init" depends= "integrate.batch, no.batch">

  </target>

 

  <target name= "local" depends= "init" description= "builds and deploys the project to a local PC" >

 

      <copy file= "build_local.properties" tofile= "build.properties" overwrite="true"/>

 

      <ant antfile= "${build.file}" target= "deploy"/>

 

      <delete file= "build.properties"/>

  </target>

 

 

  <target name= "internal.st" depends="init" description="builds ready for the internal SIT environment" >

 

      <copy file= "buildSIT_internal.properties" tofile= "build.properties" overwrite="true"/>

 

      <ant antfile= "${build.file}" target= "production.package"/>

 

      <delete file= "build.properties"/>

  </target>

 

 

  <target name= "internal.dev" depends= "init" description= "builds ready for the internal Development environment" >

 

      <copy file= "buildDev_internal.properties" tofile= "build.properties" overwrite="true"/>

 

      <ant antfile= "${build.file}" target= "production.package"/>

 

      <delete file= "build.properties"/>

  </target>

 

 

  <target name= "external" depends= "init" description= "builds ready for an external release" >

 

      <copy file= "build_external.properties" tofile= "build.properties" overwrite="true"/>

 

      <ant antfile= "${build.file}" target= "production.package"/>

 

      <delete file= "build.properties"/>

  </target>

 

        <target name= "WSGJar" description= "builds only WSG.jar file" >

 

            <echo level= "info">

                  *********************************

                  Note: Project Mary Batch Job

                        functionality is not included

                  *********************************

            </echo>

            <copy file= "build_external.properties" tofile= "build.properties" overwrite="true"/>

 

            <ant antfile= "utilsBuild.xml" target= "dist"/>

 

            <delete file= "build.properties"/>

        </target>

 

</project>