How to construct symplectic invariants by counting J-holomorphic curves